Extract on xmltype with multiple namespaces
Given the following xml instance document can you share an example to retrieve the data of the <TransactionNumber> and <IdValue> elements using the XMLType data type. This document is generated by XBD and has 3 different namespaces.
declare
lv_xml xmltype := xmltype(
'<ConfirmAddStudentDeposit xmlns="urn:sungardsct:udc:ws:messages:1.0">
<StudentDepositIdentifier>
<AccountIdentifier xmlns="urn:sungardsct:udc:domain:ar:1.0">
<IdValue xmlns="urn:sungardsct:udc:resources:common:1.0" name="BannerUID">210009102</IdValue>
</AccountIdentifier>
<TransactionNumber xmlns="urn:sungardsct:udc:domain:ar:1.0">8</TransactionNumber>
<ReceiptNumber xmlns="urn:sungardsct:udc:domain:ar:1.0">1606</ReceiptNumber>
</StudentDepositIdentifier>
</ConfirmAddStudentDeposit>');
lv_frag xmltype;
begin
lv_frag := lv_xml.extract('/ConfirmAddStudentDeposit/StudentDepositIdentifier/TransactionNumber', 'xmlns="urn:sungardsct:udc:ws:messages:1.0" xmlns="urn:sungardsct:udc:domain:ar:1.0"');
if lv_frag is null then
dbms_output.put_line('NO good');
else
dbms_output.put_line('maybe working');
end if;
end;
You'll need to use prefixs or namespaces
declare
lv_xml xmltype := xmltype(
'<ConfirmAddStudentDeposit xmlns="urn:sungardsct:udc:ws:messages:1.0">
<StudentDepositIdentifier>
<AccountIdentifier xmlns="urn:sungardsct:udc:domain:ar:1.0">
<IdValue xmlns="urn:sungardsct:udc:resources:common:1.0" name="BannerUID">210009102</IdValue>
</AccountIdentifier>
<TransactionNumber xmlns="urn:sungardsct:udc:domain:ar:1.0">8</TransactionNumber>
<ReceiptNumber xmlns="urn:sungardsct:udc:domain:ar:1.0">1606</ReceiptNumber>
</StudentDepositIdentifier>
</ConfirmAddStudentDeposit>');
lv_frag xmltype;
begin
lv_frag := lv_xml.extract('/a:ConfirmAddStudentDeposit/a:StudentDepositIdentifier/c:TransactionNumber', 'xmlns:a="urn:sungardsct:udc:ws:messages:1.0" xmlns:c="urn:sungardsct:udc:domain:ar:1.0"');
if lv_frag is null then
dbms_output.put_line('NO good');
else
dbms_output.put_line('maybe working');
end if;
end;
Similar Messages
-
XML Structured Index with multiple namespaces
Hi,
I'm having some trouble creating an xmlindex with structured component on a clob xmltype column without registered schema, whose data uses multiple namespaces.
The code I'm using atm:
CREATE TABLE "DECLARATIONS"
"ID" NUMBER(19,0),
"XML" "SYS"."XMLTYPE"
CREATE INDEX decl_header_ix ON "DECLARATIONS"(xml) INDEXTYPE IS XDB.XMLINDEX
PARAMETERS ('PATHS (INCLUDE (/emcs:emcsDeclaration/emcs:header//*)
NAMESPACE MAPPING (xmlns:emcs="http://www.myurl.eu/myapp/schema/emcs/nl"))');
INSERT INTO "DECLARATIONS" VALUES (1,'
<?xml version = ''1.0'' encoding = ''UTF-8'' standalone = ''yes''?>
<emcs:emcsDeclaration xsi:schemaLocation="http://www.myurl.eu/myapp/schema/emcs/nl emcs_domain.xsd"
xmlns:common="http://www.myurl.eu/myapp/schema/common"
xmlns:emcs="http://www.myurl.eu/myapp/schema/emcs/nl"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<emcs:header>
<common:identifier>70</common:identifier>
<common:declarationSequenceNumber>54566</common:declarationSequenceNumber>
<common:dateCreated>2010-10-21-01:00</common:dateCreated>
<common:status>01 Draft e-AAD in preparation</common:status>
</emcs:header>
</emcs:emcsDeclaration>');A this moment it's not desirable for us to register the schemas used in oracle. According to the documentation I should be able to add a structured component to the index as follows:
BEGIN
DBMS_XMLINDEX.registerParameter('MY_XSI_GROUP_PARAMETER'
, 'ADD_GROUP GROUP MY_XSI_GROUP
XMLTABLE decl_header
XMLNAMESPACES (''http://www.myurl.eu/myapp/schema/emcs/nl'' AS emcs,
''http://www.myurl.eu/myapp/schema/common'' AS common),
COLUMNS
status VARCHAR2(30) PATH ''/emcs:emcsDeclaration/emcs:header/common:status/text()''
END;
ALTER INDEX DECL_HEADER_IX PARAMETERS('PARAM MY_XSI_GROUP_PARAMETER');However this results in an ORA-00904: invalid identifier. After some experimenting it seems that oracle tries to parse the namespace URLs as identifiers (even tho http://download.oracle.com/docs/cd/E14072_01/appdev.112/e10492/xdb_indexing.htm#BCGJAAGH & http://download.oracle.com/docs/cd/E14072_01/appdev.112/e10492/xdb_xquery.htm#BABJCHCC specify the former), so I swapped them around:
BEGIN
DBMS_XMLINDEX.dropParameter('MY_XSI_GROUP_PARAMETER');
DBMS_XMLINDEX.registerParameter('MY_XSI_GROUP_PARAMETER'
, 'ADD_GROUP GROUP MY_XSI_GROUP
XMLTABLE decl_header
XMLNAMESPACES (emcs ''http://www.myurl.eu/myapp/schema/emcs/nl'',
common ''http://www.myurl.eu/myapp/schema/common''),
COLUMNS
status varchar2(30) PATH ''/emcs:emcsDeclaration/emcs:header/common:status/text()''
END;
ALTER INDEX DECL_HEADER_IX PARAMETERS('PARAM MY_XSI_GROUP_PARAMETER');Oracle seems to get a bit further with this, resulting in a ORA-19102: XQuery string literal expected. Here I pretty much hit a dead end. Removing the xmlnamespaces declaration altogether leads to a ORA-31013: Invalid XPATH expression. Going through the examples on http://www.liberidu.com/blog/?p=1805 works fine, but as soon as I try to add namespaces to it they stop working as well.
So my question is: how do I get xmlnamespaces (with non-default namespaces) to work in a structured xmlindex component?If you want, I can help you tomorrow. Call me at my nieuwegein office or mail me at marco[dot]gralike[at]amis[dot]nl
I have some time tomorrow, so I can help you with this. My next presentation for UKOUG will be on XML indexes strategies anyway...
In the meantime and/or also have a look at:
XML Howto's (http://www.liberidu.com/blog/?page_id=441) specifically:
XML Indexing
* Unstructured XMLIndex (part 1) – The Concepts (http://www.liberidu.com/blog/?p=228)
* Unstructured XMLIndex (Part 2) – XMLIndex Path Subsetting (http://www.liberidu.com/blog/?p=242)
* Unstructured XMLIndex (Part 3) – XMLIndex Syntax Dissected (http://www.liberidu.com/blog/?p=259)
* Unstructured XMLIndex Performance and Fuzzy XPath Searches (http://www.liberidu.com/blog/?p=310)
* Structured XMLIndex (Part 1) – Rules of Numb (http://www.liberidu.com/blog/?p=1791)
* Structured XMLIndex (Part 2) – Howto build a structured XMLIndex (http://www.liberidu.com/blog/?p=1798)
* Structured XMLIndex (Part 3) – Building Multiple XMLIndex Structures (http://www.liberidu.com/blog/?p=1805)
The posts were based on Index for XML with Repeated Elements maybe that is a bit better to read than on my notepad on the internet (aka blog)
Edited by: Marco Gralike on Oct 28, 2010 7:51 PM -
XPath expression with multiple namespaces?
Hello all.
I have been scouring the forums and Google and can't seem to find anything similar to my problem.
I have the following XML with three namespaces. Two are defined in the root element and the third is defined in the the IdSession element. To make things even more confusing, the second and third namespaces have the same prefix, 'f'.
This is the xml:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<NamespaceTestCall xmlns="http://my.default/namespace"
xmlns:f="http://my.second/namespace">
...<f:Level1>
......<f:IdSession xmlns:f="http://my.third/namespace">12345</f:IdSession>
......<Language>ENG</Language>
...</f:Nivel1>
</NamespaceTestCall>
My question is, how do I get at the IdSession element? Don't I need to create an XPath object and assign it more than one NamespaceContext?
This is what I am doing:
Document xmlDocument = loadXML(xmlSource);
XPath xpathEvaluator = XPathFactory.newInstance().newXPath();
xpathEvaluator.setNamespaceContext(new NamespaceContextProvider("a", "http://my.third/namespace"));
... xpathEvaluator.evaluate("//a:IdSession", ...);
This code works but it might not return the 'IdSession' I want, since by searching like this '//a:IdSession' it is looking in the whole document. If there were another 'IdSession' somewhere else in the document with the same URI, it would be returned. I want the 'IdSession' that lives inside of 'Level1'.
So what I would like to do is something like this:
... xpathEvaluator.evaluate("/*/Level1/a:IdSession", ...);
But this does NOT work because 'Level1' has its own namespace. So what it seems like I need to do is the following:
... xpathEvaluator.evaluate("/*/b:Level1/a:IdSession", ...);
Having already added the 'Level1' namespace to the XPath object, with the prefix 'b'. But unlike JDOM, there is no 'add' functionality, only 'set', meaning if you call set twice the second call overwrites the first.
Is there anyway to do this?
Many thanks!
BobHello,
Sorry, that was my bad. I should have explained that NamespaceContextProvider is nothing more than my implementation of the NamespaceContext interface. The way I did it, I simply implemented getNamespaceURI() and getPrefix(). And the constructor accepted two parameters -- prefix and URI. So my problem was that when I assigned this NamespaceContext to my XPath object it would only have one prefix and one URI.
But I found an implementation here:
http://www.oreillynet.com/cs/user/view/cs_msg/50304
that instead of only having one prefix and URI uses a map. Thus its method setNamespace() adds the prefix and URi to the map, and getPrefix() and getPrefixes() retrieve them from the map.
Now when I want to use more than one namespace I simply call setNamespace() as many times as necessary, adding a prefix and URI pair each time, and when I am done I assign it to my XPath object.
And it works!
Thanks for the response!
Bob -
XSD validation with multiple namespaces
Hi All,
I'm trying to validate some XML using an XSD that contains multiple namespace schema descriptions, as such, the main XSD file must import an XSD for each namespace.
The difficulty is that I cannot seem to find a way (in Oracle) to run a XSD validation using this (multi-XSD file) method.
Has anyone out there tackled a similar problem?
Cheers,
Bencheck out the class
CL_XML_SCHEMA
Regards
Raja -
Issue with extracting node values of an XMLElement with multiple namespaces
I have created a Table with XMLType Column
CREATE TABLE xmlNode
( ID numeric(10) primary key,
DATA XMLType);
Then inserted one row
INSERT INTO xmlNode(ID, DATA) VALUES(1, '<lineItemElement orderLineItemID="12323" transactionType="New" xmlns="http://rcss.bell.ca/schema/lineitemmessages">
<rcss:catalogeID xmlns:rcss="http://rcss.bell.ca/schema/PartnerBatch">3234</rcss:catalogeID>
<rcss:venueID xmlns:rcss="http://rcss.bell.ca/schema/PartnerBatch">345345</rcss:venueID>
<rcss:startDate xmlns:rcss="http://rcss.bell.ca/schema/PartnerBatch">2007-09-10T00:00:00Z</rcss:startDate>
<rcss:endDate xmlns:rcss="http://rcss.bell.ca/schema/PartnerBatch">2007-09-10T00:00:00Z</rcss:endDate>
<rcss:contact contactID="234234" xmlns:rcss="http://rcss.bell.ca/schema/PartnerBatch">
<rcss:address>
<rcss:streetAddress1>?asdsd</rcss:streetAddress1>
<rcss:streetAddress2>?sdss</rcss:streetAddress2>
<rcss:city>?ddf</rcss:city>
<rcss:province>?sdcfsdcf</rcss:province>
<rcss:country>sds</rcss:country>
<rcss:postalCode>1121332</rcss:postalCode>
</rcss:address>
</rcss:contact>
</lineItemElement>')
Then i ran:
SELECT
extractValue(data,'/lineItemElement/rcss:catalogeID','xmlns=http://rcss.bell.ca/schema/lineitemmessages, xmlns:rcss=http://rcss.bell.ca/schema/PartnerBatch')
from xml where id=1
There is nothing returned.
Please advise how could I get the node value when there is namespace?
I know how to extract values if there is one namespace but i'm not able to extract values if there are two namespaces.
Any help is appreciable!!
Thanks in Advance.I fixed that problem too. What I thought was a singleton was actually a repeating element. I needed to be able to "multiply" the repeating node for the main node, but I couldn't find a concise way of doing this in SQL. So instead I did it in with two loops.
FOR rec IN (
SELECT
extractvalue(value(e), 'surchargeEntry/company',p_namespace) company
,extractvalue(value(e), 'surchargeEntry/surchargeType',p_namespace) surcharge_type
,extractvalue(value(e), 'surchargeEntry/shortDescription',p_namespace) short_description
,extractvalue(value(e), 'surchargeEntry/longDescription',p_namespace) long_description
,e.column_value surcharge_entry_xml
FROM TABLE(xmlsequence(extract(p_xml, 'surchargeInquiryResponse' ||
'/surchargeAttributes/surchargeEntry'
,p_namespace))) e
) LOOP
FOR rec_country IN (
SELECT
extractvalue(value(c), 'country/originationCountry',p_namespace) origination_country
,extractvalue(value(c), 'country/destinationCountry',p_namespace) destination_country
FROM TABLE(xmlsequence(extract(rec.surcharge_entry_xml, 'surchargeEntry/country',p_namespace))) c
LOOP
nafta_fee_obj.append_surcharge_entry_data(
v_arr
,r_surcharge_entry(
rec.company
,rec.surcharge_type
,rec.short_description
,rec.long_description
,rec_country.origination_country
,rec_country.destination_country
END LOOP;
END LOOP;
I populate a collection, which is easy to pass around between routines. I can easily convert the collection to a ref cursor, and index-by array, comma-delimited string, etc.
Apparently, the namespace is required in SQL, but not in staright PL/SQL.
I've also noticed that the docs say xmltype() has all these member functions, but when I try to use some of them, I get an error that it's undefined. Like getNumVal(). There are some functions I can use in SQL, or PL/SQL, but not vice-versa.
- Dan Clamage -
Complex xml with multiple namespaces giving LPX-00601: Invalid token error
Hi
Apologies if this is a really simple question.
I have not worked with xml before and I'm drowning in different ways to do the extract.
I have a very complex xml, sample below, which I'm trying to do one siple extract to get myself going.
I have the data in a table in an xmltype column,
I am trying to extract containernumber first and get the error.
select xml_column, extract(xml_column,'/env:Envelope/env:Body/ns0:QueryCntrNumberResponse/ns0:QueryResContainerDetail/ns1:ContainerNumber/ns2:ContainerNumber')
from test_xml;
Not sure if I should use the namespaces and have tried without but results are always NULL
I would really appreciate any pointers around these ultiple namespaces.
Thanks
Nicki
XML Sample
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns0="http://com.cargosmart.cargotracking.webservice.cntr.dto"
xmlns:ns1="http://com.cargosmart.cargotracking.webservice.common.dto"
xmlns:ns2="http://com.cargosmart.cargotracking.webservice.basic.dto"
xmlns:ns3="http://com.cargosmart.cargotracking.webservice.bl.dto"
xmlns:ns4="http://com.cargosmart.cargotracking.webservice.bkg.dto">
<env:Body>
<ns0:QueryByCntrNumberResponse>
<ns0:QueryRes ult="">
<ns0:QueryCriteria>
<ns1:CarrierSCACCode>APLU</ns1:CarrierSCACCode>
<ns1:ContainerNumber>APZU344693-1</ns1:ContainerNumber>
</ns0:QueryCriteria>
<ns0:ContainerDetail>
<ns1:ContainerNumber>
<ns2:ContainerNumber>APZU344693</ns2:ContainerNumber>
<ns2:ContainerCheckDigit>1</ns2:ContainerCheckDigit>
<ns2:GrossWeight>
<ns2:Weight>20260.8</ns2:Weight>
<ns2:WeightUnit>KGS</ns2:WeightUnit>
</ns2:GrossWeight>
</ns1:ContainerNumber>
NOT THE FULL COLUMNCould I just ask you one more question.
I had already expanded the query to include the repeating sections using xmlsequence.
Has that been replaced too?
select extractvalue(xml_column,'/env:Envelope/env:Body/ns0:QueryByCntrNumberResponse/ns0:QueryResult/ns0:ContainerDetail/ns1:ContainerNumber/ns2:ContainerNumber',
'xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns0="http://com.cargosmart.cargotracking.webservice.cntr.dto"
xmlns:ns1="http://com.cargosmart.cargotracking.webservice.common.dto"
xmlns:ns2="http://com.cargosmart.cargotracking.webservice.basic.dto"
xmlns:ns3="http://com.cargosmart.cargotracking.webservice.bl.dto"
xmlns:ns4="http://com.cargosmart.cargotracking.webservice.bkg.dto"') col1,
extractvalue(value(t2),'/ns1:Event/ns1:EventDescription', 'xmlns:ns1="http://com.cargosmart.cargotracking.webservice.common.dto"') Event_Description,
extractvalue(value(t2),'/ns1:Event/ns1:EventDT/ns2:LocDT', 'xmlns:ns1="http://com.cargosmart.cargotracking.webservice.common.dto" xmlns:ns2="http://com.cargosmart.cargotracking.webservice.basic.dto"') Event_DT,
extractvalue(value(t2),'/ns1:Event/ns1:Location/ns2:LocationName', 'xmlns:ns1="http://com.cargosmart.cargotracking.webservice.common.dto" xmlns:ns2="http://com.cargosmart.cargotracking.webservice.basic.dto"') location
from test_xml t1,
table(xmlsequence(extract(t1.xml_column,'/env:Envelope/env:Body/ns0:QueryByCntrNumberResponse/ns0:QueryResult/ns0:ContainerDetail/ns1:Event','xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns0="http://com.cargosmart.cargotracking.webservice.cntr.dto"
xmlns:ns1="http://com.cargosmart.cargotracking.webservice.common.dto"
xmlns:ns2="http://com.cargosmart.cargotracking.webservice.basic.dto"
xmlns:ns3="http://com.cargosmart.cargotracking.webservice.bl.dto"
xmlns:ns4="http://com.cargosmart.cargotracking.webservice.bkg.dto"'))) t2; -
Using xpath.evaluate(): xpath exp with multiple namespaces
Hi,
I have to evaluate a xpath expression with parent node and child node having different namespaces. Like : env:parent/mig:child.
I have set the namespacecontext for the child node[i.e., for the prefix 'mig'.]
But am getting this error :
javax.xml.transform.TransformerException: Prefix must resolve to a namespace: env
How can I set the namespace context for both the parent and child nodes? Or is there are any other way of doing it?
I cant use //mig:child as the requirement needs the whole xpath expression [env:parent/mig:child] to be given as input for the xpath.evaluate() method.
Here's the code :
File file = new File("D:\\Backup\\XMLs\\test.xml");
Document xmlDocument = builder.parse(file);
XPath xpathEvaluator = XPathFactory.newInstance().newXPath();
xpathEvaluator.setNamespaceContext(new NamespaceContextProvider("env", "http://xmlns.oracle.com/apps/account/1.0"));
NodeList nodeList =
(NodeList)xpathEvaluator.evaluate("/env:parent/mig:child", xmlDocument,
XPathConstants.NODESET);
xpathEvaluator.setNamespaceContext(new NamespaceContextProvider("mig", "http://xmlns.oracle.com/apps/account/1.0"));
Thanks in advance.If you want, I can help you tomorrow. Call me at my nieuwegein office or mail me at marco[dot]gralike[at]amis[dot]nl
I have some time tomorrow, so I can help you with this. My next presentation for UKOUG will be on XML indexes strategies anyway...
In the meantime and/or also have a look at:
XML Howto's (http://www.liberidu.com/blog/?page_id=441) specifically:
XML Indexing
* Unstructured XMLIndex (part 1) – The Concepts (http://www.liberidu.com/blog/?p=228)
* Unstructured XMLIndex (Part 2) – XMLIndex Path Subsetting (http://www.liberidu.com/blog/?p=242)
* Unstructured XMLIndex (Part 3) – XMLIndex Syntax Dissected (http://www.liberidu.com/blog/?p=259)
* Unstructured XMLIndex Performance and Fuzzy XPath Searches (http://www.liberidu.com/blog/?p=310)
* Structured XMLIndex (Part 1) – Rules of Numb (http://www.liberidu.com/blog/?p=1791)
* Structured XMLIndex (Part 2) – Howto build a structured XMLIndex (http://www.liberidu.com/blog/?p=1798)
* Structured XMLIndex (Part 3) – Building Multiple XMLIndex Structures (http://www.liberidu.com/blog/?p=1805)
The posts were based on Index for XML with Repeated Elements maybe that is a bit better to read than on my notepad on the internet (aka blog)
Edited by: Marco Gralike on Oct 28, 2010 7:51 PM -
XMLTable with multiple namespaces
I have a web service that returns the following XML:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetGeoLocationIDByWellTagIDResponse xmlns="http://tempuri.org/">
<GetGeoLocationIDByWellTagIDResult xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:int>9110910</a:int>
</GetGeoLocationIDByWellTagIDResult>
</GetGeoLocationIDByWellTagIDResponse>
</s:Body>
</s:Envelope>There is the possibility of more than one Int being returned, so I am trying to use xmltable to pull out this information. But I am having some difficulty pulling out the ID node, because (I am guessing) the node is named "a:int". Here is an example of how I am attempting to get this data:
select x.*
from
(select xmltype.createxml('<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetGeoLocationIDByWellTagIDResponse xmlns="http://tempuri.org/">
<GetGeoLocationIDByWellTagIDResult xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:int>9110910</a:int>
</GetGeoLocationIDByWellTagIDResult>
</GetGeoLocationIDByWellTagIDResponse>
</s:Body>
</s:Envelope>') xml from dual) t,
xmltable(
xmlnamespaces (
'http://tempuri.org/' as "e",
'http://schemas.microsoft.com/2003/10/Serialization/Arrays' as "a"),
'//e:GetGeoLocationIDByWellTagIDResponse/a:GetGeoLocationIDByWellTagIDResult'
passing t.xml
columns
loc_id int path 'a:int'
) x;This just returns null.
How do I references the "a:int" node in the columns clause to correctly get this record back?SQL> with sample_data as (
2 select xmltype('<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
3 <s:Body>
4 <GetGeoLocationIDByWellTagIDResponse xmlns="http://tempuri.org/">
5 <GetGeoLocationIDByWellTagIDResult xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
6 <a:int>60395867</a:int>
7 <a:int>7948500</a:int>
8 <a:int>2282774</a:int>
9 <a:int>47054172</a:int>
10 <a:int>47434315</a:int>
11 <a:int>52639251</a:int>
12 </GetGeoLocationIDByWellTagIDResult>
13 </GetGeoLocationIDByWellTagIDResponse>
14 </s:Body>
15 </s:Envelope>') xml
16 from dual
17 )
18 select x.loc_id
19 from sample_data t
20 , xmltable(
21 xmlnamespaces (
22 'http://schemas.microsoft.com/2003/10/Serialization/Arrays' as "a"
23 , 'http://schemas.xmlsoap.org/soap/envelope/' as "s"
24 , default 'http://tempuri.org/'
25 )
26 , '/s:Envelope/s:Body/GetGeoLocationIDByWellTagIDResponse/GetGeoLocationIDByWellTagIDResult/a:int'
27 passing t.xml
28 columns
29 loc_id number path '.'
30 ) x
31 ;
LOC_ID
60395867
7948500
2282774
47054172
47434315
52639251
6 rows selected -
Response with multiple namespaces...
Hi there!
We have several webservices working as "document", they receive a XML document and send a XML document as response.
The problem is that the returned document has a namespace prefix for each XML tag. All of then with the same name space:
[n1:enviar_ofersecResponse xmlns:n1="a name space"]
[n2:IdentificacionMensaje xmlns:n2="a name space" v="respuesta_ofersecen01_20040921.1"/]
[n3:FechaHoraMensaje xmlns:n3="a name space" v="2004-09-21T12:07:30+02:00"/]
[n4:IdentificacionRemitente xmlns:n4="a name space" v="HC_G"/]
[n5:FuncionRemitente xmlns:n5="a name space" v="A08"/]
... and so on...
How avoid this different prefix with the same name space for each tag?. Our xml documents are big... about 5 M... so it's a waste of space and time process all those prefix and namespaces...
Thanks in advance!.Hello,
We are experiencing this as well as we are upgrading from WLS 7.0 to 8.1. WLS 7.0 worked as expected. We made no changes to the webservices.xml between 7.0 and 8.1. This response element snippet is an example of 7.0 compared to 8.1:
***BEFORE - wls 7***
<ns1:memberFound>Y</ns1:memberFound>
***AFTER - wls 8.1***
<ns1:memberFound xmlns:ns1="http://www.definityhealth.com/webservice/member/memberlookup">Y</ns1:memberFound>
I'm pursuing this with support and will report back findings here.
thanks,
chad. -
I have an XML file
<?xml version="1.0"?>
-<Document xmlns="http://www.taleo.com/ws/integration/toolkit/2011/05">
+<Attributes>
-<Content>
-<ExportXML xmlns="http://www.taleo.com/ws/integration/toolkit/2005/07/action/export">
-<record>
<field name="ContestNumber">12000000RT</field>
<field name="JobInformation,JobType,Description">Experienced</field>
</record>
</ExportXML>
</Content>
</Document>
I am using the following file to retrieve the data
SELECT *
FROM XMLTable(XMLNAMESPACES('http://www.taleo.com/ws/integration/toolkit/2011/05' as "n1",
'http://www.taleo.com/ws/integration/toolkit/2005/07/action/export' as "n2"), '//n1:Document/Content/n2:ExportXML/record'
passing xmltype(
bfilename('TEST','TALEOOUT-12-26.xml')
, nls_charset_id('AL32UTF8')
columns
ContestName varchar2(1000) path 'field[1]'
)What am i doing wrongThis was the code that worked.Thanks A_Non .
SELECT *
FROM XMLTable(XMLNAMESPACES('http://www.taleo.com/ws/integration/toolkit/2011/05' as "n1",
'http://www.taleo.com/ws/integration/toolkit/2005/07/action/export' as "n2"),
'/n1:Document/n1:Content/n2:ExportXML/n2:record'
passing xmltype(
bfilename('TEST','TALEOOUT-12-26.xml')
, nls_charset_id('AL32UTF8')
columns
ContestNumber VARCHAR2 (4000) path 'n2:field[1]',
Job_Info_JobTypDesc VARCHAR2 (4000) path 'n2:field[2]',
JobFamily VARCHAR2 (4000) path 'n2:field[3]',.........
)Edited by: Rameshkumar T on Nov 30, 2012 10:59 AM -
XML doc with multiple namespaces
Hi,
a little stupid question...
Is it possible to get a xml file that assigns two different namespaces and I don't want to use a prefix?
example:
xml doc uses namespace xmlns:a="someuri" and xmlns:b="otheruri"
<?xml version="1.0" encoding="UTF-8"?>
<Root xmlns="someuri" xmlns:b="otheruri">
<test/>
<b:rest/>
</Root>
Some way to get prefix b out of it?
Thanxokay, it was a stupid question...
solution:
<?xml version="1.0" encoding="UTF-8"?>
<Root xmlns="someuri" xmlns:b="otheruri">
<test/>
<rest xmlns="otheruri"/>
</Root> -
Multiple namespaces in an XML document
I have an XML document that I am trying to use within a data flow (XML Source)--the problem is that I keep getting an error message stating that the XML document has multiple namespaces and therefore, SSIS will not create the XSD for me. If I take out the second namespace, I am able to successfully get the task to execute, but this XML is created with 2 namespaces and there is no way to get around this (I cannot get the report server to change these parameters)--my question is: does anyone know of a way to get SSIS to handle multiple namespaces so that I can process this XML document and extract the necessary data elements from it.
Any assistance would be greatly appreciated.
Thank you!!!!I am replying too much late..........thinking might be useful for someone !!!!
SSIS does not handle multiple namespaces in the XML source file. You can find examples where you see the format
<Namespace:Element>.
The first step to avoid multiple namespaces is to transform your source file to a format that doesn’t refer to the namespaces.
SSIS has an XML task that can do the transformation. Add the XML task to an SSIS Control Flow and edit it.
Change the OperationType property value to XSLT, the SourceType to File connection and the Source to your source file that has the problem.
Set the SaveOperationResult property to True.
Expand the OperationResult branch and Set DestinationType to File Connection and the Destination to a new XML file.
Add the following to a new file and save it with an xslt file extension.
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no" />
<xsl:template match="/|comment()|processing-instruction()">
<xsl:copy>
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@*|node()" />
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
Back in the XML task, set the SecondOperandType to File connection and the Second Operand to your new XSLT file.
When you run the XML task, it will take your original file and apply the transformation rules defined in the XSLT file. The results will be saved in your new XML file.
This task only needs to be run once for the original XML file. When you look at the new file, you’ll see the same data as in the original, but without namespace references.
Now you can return to your data flow and alter the XML Source to reference the new XML file.
Click on the Generate XSD and you should be able to avoid your error.
When you click on the Columns tab in your XML Source, you will probably see a warning. This is because the data types may not be fully defined (for example there’s no mention of string lengths). This shouldn’t be a problem as long as the default data type
(255-character Unicode string) meets your needs.
=================life is beatiful..so !!===========
Rahul Vairagi
=================================== Rahul Vairagi =================================== My Blogs: www.sqlserver2005forum.blogspot.com www.knwhub.blogspot.com -
Analysis Authorization based on Hier node with multiple display hierarchies
Hi guys - I've got a problem where s.o. might have an idea of how to switch on the light at the end of the tunnel, I am currently standing in:
Requirement:
Cost Center Authorization should be given through RSECADMIN, reporting should be possible for any hierarchy that exists for the authorization relevant info object.
Preferred solution:
The Cost Center Analysis Authorization should be given through RSECADMIN - Hierarchy node assignment.
u2022 A dedicated Authorization Cost Center Hierarchy will be maintained in ECC6 as an alternative cost center hierarchy and extracted into BW.
u2022 The RSECADMIN Hierarchy node assignment should be based on a particular node (Type 2).
u2022 The display level will be specified as required (here: Level 7)
u2022 The Authorization granted should be independent of hierarchy name and version (validity 3).
Reporting Scenario and technical impact:
As mentioned above, when designing and running a query the user should be able to freely select other (i.e. than the authorization) display hierarchies for the authorization relevant reporting object 'Cost Center' as well. The technical names of the semantically relevant hierarchy nodes could therefore vary. E.g. cost centers 1, 2 and 3, being assigned under hierarchy node u2018Au2019 of the RSECADMIN relevant authorization hierarchy, could be subsumed by hierarchy node u2018Bu2019 in another display hierarchy, which the user may want to display in accordance to his reporting needs. Ideally, the alternative display hierarchy should therefore display node u2018Bu2019.
My findings so far (based on prototyping) turn out that this is not possible as long u2018Bu2019 (and its hierarchy) is not authorized in RSECADMIN. Can these findings be confirmed? And if not, would anyone have an idea of how to facilitate the reporting scenario?
Would there be any other way to grant access, possibly based on RSECADMIN single values, and also enable the user to flexibly display hierarchies with only those hierarchy nodes whose single cost center values the user has been given access to?
Thanks everyone for your input...
Claus
Edited by: Claus64 on Jul 13, 2009 4:10 AMHI CLause,
On Jul 14 2009, you wrote in SDN and said:
FYI: Found a solution...
The hierarchy analysis authorization will be based on a navigational attribute of cost center.
With analysis authorizations it is possible to declare the Auth object (e.g. 0COSTCENTER__RACCAUT0) as authorization relevant and leave the superior object 0COSTCENTER auth irrelevant.
The auth will be given for 0COSTCENTER__RACCAUT0. This object will be placed as a filter of the query, being restricted by an Authorization variable for hierarchy nodes.
Due to the concept of Analysis Authorizations, this variable will automatically pick up the nodes granted as part of RSECADMIN Hierarchy based Authorization.
As mentioned above, 0COSTCENTER as the regular reporting characteristic remains auth irrelevant and can therefore take any hierarchy thatu2019s available. Reporting on single values will be possible, too. Only those nodes show up that hold the authorized cost centers in accordance to the authorization.
If the auth relevant 0COSTCENTER__RACCAUT0 is not used in the query definition by either not taking it in as a filter or skipping the Auth variable, the query will launch the message that the authorization is missing. No data show up at all.
Claus
See this thread:
Analysis Authorization based on Hier node with multiple display hierarchies
I am also in the same situation as you and need to understadn your solution. I understand that you created a Nav Attr on 0COSTCENTER and made this auth relevant whilst ensuring that 0COSTCENTER is NOT auth relevant. This is all fine. The issue was you have multiple hierachies for 0COSTCENTER, how did the new Nav Attr help you solve your issue. When loading 0COSTCENTER what values did you load ino the new Nav Attribute and how did that link to the hierachies? Also, in RSECADMIN you created hiearchy nodes based on the Nav Attribute but I am confused as to what values you have in the Nav Attr.
I appreciate if you can share your solution from the past in more details.
many thanks -
C# Script to open and read an Excel spreadsheet with multiple worksheets
Can someone provide me the C# syntax and Edit Script to open an Excel spreadsheet with multiple worksheets and then using the data to create and output a .csv file? The multiple worksheets contain different data elements that I'll need to parse out and then
store as a .csv file that will then be read to pump data into our SQL Server Database.
Thanks for your review and am hopeful for a reply.
PSULionRPI think this code originally came from Joel, who comes here quite a bit. I'm not a C# expert, like Joe is, but I think this is pretty close to what you want.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;
using Microsoft.Office.Interop.Excel;
using System.IO;
namespace WindowsFormsApplication2
public partial class Form1 : Form
public Form1()
InitializeComponent();
private void button1_Click(object sender, EventArgs e)
Main();
public void Main()
string filePath = "C:\\Users\\Ryan\\Desktop\\MainExcel.xlsx";
Microsoft.Office.Interop.Excel.Application xlobj = new Microsoft.Office.Interop.Excel.Application();
Workbook w = default(Workbook);
Workbook w1 = default(Workbook);
Worksheet s = default(Worksheet);
Worksheet s1 = default(Worksheet);
Worksheet xlsht = default(Worksheet);
xlobj.Visible = true;
int intItem = 1;
DirectoryInfo dirSrc = new DirectoryInfo(@"C:\Users\Ryan\Desktop\Test_Folder\");
foreach (FileInfo ChildFile in dirSrc.GetFiles())
try
// Renaming the excel sheet
w = xlobj.Workbooks._Open(ChildFile.FullName,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
w1 = xlobj.Workbooks._Open(filePath,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
//this doesn't make any sense
//w1 = xlobj.Workbooks.Open(filePath);
//if (intItem > 3)
Excel.Worksheet lastSht =
(Excel.Worksheet)w1.Worksheets[w1.Worksheets.Count];
xlsht = (Excel.Worksheet)w1.Worksheets.Add(Type.Missing,
lastSht,
Type.Missing, Type.Missing);
s = (Excel.Worksheet)w.Worksheets[1];
s1 = (Excel.Worksheet)w1.Worksheets[intItem];
s1.Name = ChildFile.Name;
// it will copy and paste sheet from one to another with formula
s.UsedRange.Copy(Type.Missing);
Excel.Range r = s1.get_Range("A1", Type.Missing);
r.PasteSpecial(Excel.XlPasteType.xlPasteValues,
Excel.XlPasteSpecialOperation.xlPasteSpecialOperationNone,
Type.Missing, Type.Missing);
s1.UsedRange.Formula = s.UsedRange.Formula;
// Renaming the excel sheet
//w.Save();
w.Close(false, Type.Missing, Type.Missing);
w1.Close(false, Type.Missing, Type.Missing);
catch (Exception ex)
//w.Save();
w1.Save();
w.Close(false, Type.Missing, Type.Missing);
w1.Close(false, Type.Missing, Type.Missing);
intItem = intItem + 1;
//Dts.TaskResult = ScriptResults.Success
Do you need help getting everything into a CSV, or can you take it from here???
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it. -
How do you get a line with MULTIPLE fields to WRAP ?
How do you get a line with MULTIPLE fields to WRAP ?
Good afternoon everyone...
THE PROBLEM: Why doesn’t a line with multiple fields WRAP?
HYPOTHETICAL EXAMPLE/WHAT I”D LIKE TO SEE
If I have 2 fields on a line (this is now a hypothetical example and nothing to do with my actual report)….let’s call them field A and field B. And if field A has values of all ‘X’ and field B has values of all ‘Y’…then….the normal case would be (ignore dots – only for spacing):
A……………………… B
XXXXXXXXXXXXXXXXXX YYYYYYYYYYYYYYYYY
But what if A is too long? I would want to see B wrap onto the next line like this:
A……………………………………………………B
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX YYYYYY
YYYYYYYYYYYYY
And similarly….if B is extra long, can the line print as:
A………………………. B
XXXXXXXXXXXXXXXXXXX YYYYYYYYYYYYYYYYYYYYYYYYYYY
YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
I don’t want the case where B is long and I get:
A………………… …B…
XXXXXXXXXXXXXXXXX YYYYYYYYYYYYYYYYYYYYYY
………………………..YYYYYYYYYYYYYYYYYYYYY
I can see how you can wrap an individual field like that…but how can you WRAP a line of[b] fields within the frame so it wraps to the BEGINNING of the frame on next line?
My SPECIFIC CASE
I have a report that I have stripped down to a simple structure for the purposes of this explanation.
My DATA MODEL has the main QUERY (for plant family and species data). The columns of the query are divided into 2 groups. The 1st GROUP contains the family data. Below that is the rest of the species data in a 2nd GROUP.
Linking from the 2nd species group (above) is a new QUERY to extract REGION data based on the common key field. Under this 2nd query is another group with all the REGION columns.
The LAYOUT MODEL has a group frame (the main , base one)
On top of this is a repeating frame based on the 1st group (family data).
On top of this is another repeating frame for the 2nd group (species data).
On top of this is 2 Frames on the same line line. The 1st frame contains columns from the species group .
The 2nd frame on this line is a repeating frame. The PRINT DIRECTION for this frame is ACROSS/DOWN. It repeats details of the REGION where the species is found. These columns come from this group come from the REGION QUERY and GROUP.
All fields on the report line have variable horizontal elasticity.
The problem is that when there is too much data on the line, it does NOT WRAP to the 2nd line.. It TRUNCATES.
Can the line be made to WRAP????..
In my current report, 1 of 2 things is happening:
1) All fields print on the line until it hits the page boundary and then it just stops. Truncated!
2) All fields print on the current line, then Oracle Reports throws a new page to print the REMAINDER of the long, input line
But I would like a LONG line to continue printing onto the following line of the same page.
I have tried all combinations of the elasticity fields and the ‘ADVANCED LAYOUT’ properties.
I have been focussing my attention with this problem on the frames .
We are using REPORT BUILDER V 6.0.8.26.0
Thankyou to anyone who may offer assistance.
Tony Calabrese.Steve,
you gain 1 thing, but you lose something else!
This thing is SO frustrating!
Hey Steve! Good afternoon.
I've done as you suggested....I have a long text boilerplate item - the only 1 on the line...and it has all the column in it.
So it looks like:
&col1 &col2 &col3 &col4 &col5 etc etc etc
And the line expands nicely to each field's requirements.
And when it gets to the right page boundary...it WRAPS to the next line! Beautiful!!!
The only thing is that...when I had individual fields across the line I was able to create format triggers for those fields. And in doing so I was able to reduce the font and change the justification. I had to do that because some of the fields had to appear superscripted.
So I wanted something like (ignore the dots):
...................................ppppp
AAAA BBBB CCCCC DDDD EEEE FFFFFF
So the field of 'ppppp' appeared slightly higher on the line than the other fields...
I can't see how I can do this with a single TEXT field containing all the &COL values.
Have you ever come across anything like this?
Thankyou again,
Tony Calabrese 12/4/2007
Maybe you are looking for
-
Media Encoder error about activation when exporting in activated version of Premiere CS4
I get the following error when I try to export media in Premiere CS4 (Note: I have a legal and activated copy of CS4 Master Collection). In Premiere, it appears to go through (the loading progress bar fills and then disappears) but when I check the f
-
Snow Leopard 10.6.4 and Xerox Phaser 8560
Ok, so I got the new trackpad, which to be useful, requires upgrading to 10.6.4. After I did, it worked great, problem, my printer stopped working correctly and would print irregular. This is a known issue going back to 10.6.3 back in April. I am run
-
How do I create a believable colour change on a vibrant colour in photoshop?
Hi I work for the ambulance service and I only mess around with Photoshop CS6. I am trying to change a British ambulance to a firetruck red. The only problem is because the yellow is so vibrant when I adjust the hues it looks really fake (as you can
-
How to manually insert artist photos in the artist column?
I wanted to know specifically how to customize artist photos in the artist section of the iPod / iPhone, etc. As you can see, it shows a corresponding album to that artist, but I wanted to put a photo of the artist there like they have in the iTunes
-
itunes is not able to download apple ios update . every time a msg pops out saying timed out???? how can i solve it.. pls help!!!