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
Similar Messages
-
Indexes with multiple columns v/s multiple indexes with single column
Hi Everyone,
I have a table with below structure
Create Table Test_Table
Col1 int,
Col2 int,
Col3 int,
Col4 int,
Col5 int,
Col6 int,
Col7 int,
Col8 bigint
Col9 money
Col10 money
Now this table is being used in various reports. Since reports need various data, the filter clause for the report’s have various combination of table columns
Example, Report 1 can have query like
Select * from Test_Table where col1 = @val1
Report 2:
Select * from Test_Table where col1 = @val1 and col2 >=@val2
Report3:
Select * from Test_Table where col1 = @val1 and col2 >=@val2 and col3 =@val3 and col4 in(@val4)
Report4:
Select * from Test_Table where col1 = @val1 and col2 >=@val2 and col4 = @col4
And many more combinations.
Currently the table has many combinations of indexes
Index1: col1, col2
Index2: Col2
Index3: col1, col2, col4
Index4: col3 include (col9)
Index5: col1, col2, col3, col4, col9
Now I am into a performance issue where I have to create one more index with a slight variation from the existing combination of columns.
Can you please let me know instead of having these various combination of indexes can I create multiple indexes on individual columns.
Considering the above 4 examples which I have given for 4 reports, if I create 4 indexes separately on 4 individual columns col1, col2, col3, col4 will it be effective on all4 reports?
Please suggest me the best way to create indexes on this table
Thanks in advance,
RakshaDo you really need to bring all columns ? Do not use SELECT *.
Just a guess try index on col1, col2, col3, col4
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
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 -
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; -
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> -
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 -
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 -
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 -
Creating XML using DBMS_XMLGEN with a namespace
Is it possible to create an XMLTYPE using the DBMS_XMLGEN function set that contains a namespace. As far as I can see only the 'setrowsettag' function allows any control over what goes into the root element - should I be including, for example, an attribute called 'xmlns' with a value?
The reason I ask all this is I'm trying to validate xml created from a select statement against a registered xsd.
The xsd I've registered:
<?xml version="1.0" encoding="WINDOWS-1252"?>
<xs:schema targetNamespace="http://www.sepa.org/2007/XMLSchemas/Site" xmlns:sit="http://www.sepa.org/2007/XMLSchemas/Site" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sepa.org/2007/XMLSchemas/Site Site.xsd" xmlns:oraxdb="http://xmlns.oracle.com/xdb" oraxdb:flags="311" oraxdb:schemaURL="http://www.sepa.org/2007/XMLSchemas/Site.xsd" oraxdb:schemaOwner="XMLDBMASTER" oraxdb:numProps="14">
<xs:element name="site" oraxdb:propNumber="5953" oraxdb:global="true" oraxdb:SQLName="site" oraxdb:SQLType="site1681_T" oraxdb:SQLSchema="XMLDBMASTER" oraxdb:memType="258" oraxdb:defaultTable="site1683_TAB" oraxdb:defaultTableSchema="XMLDBMASTER">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
<xs:complexType oraxdb:SQLType="site1681_T" oraxdb:SQLSchema="XMLDBMASTER">
<xs:sequence>
<xs:element name="SiteIDType" type="xs:ID" oraxdb:propNumber="5940" oraxdb:global="false" oraxdb:SQLName="SiteIDType" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<xs:element name="SiteNameType" type="xs:string" minOccurs="1" oraxdb:propNumber="5941" oraxdb:global="false" oraxdb:SQLName="SiteNameType" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<xs:element name="SiteAddressStructure" oraxdb:propNumber="5947" oraxdb:global="false" oraxdb:SQLName="SiteAddressStructure" oraxdb:SQLType="SiteAddressStructure1682_T" oraxdb:SQLSchema="XMLDBMASTER" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false">
<xs:complexType oraxdb:SQLType="SiteAddressStructure1682_T" oraxdb:SQLSchema="XMLDBMASTER">
<xs:sequence>
<xs:element name="AddressLine1" type="xs:string" minOccurs="1" oraxdb:propNumber="5942" oraxdb:global="false" oraxdb:SQLName="AddressLine1" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<xs:element name="AddressLine2" type="xs:string" minOccurs="0" oraxdb:propNumber="5943" oraxdb:global="false" oraxdb:SQLName="AddressLine2" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<xs:element name="AddressLine3" type="xs:string" minOccurs="0" oraxdb:propNumber="5944" oraxdb:global="false" oraxdb:SQLName="AddressLine3" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<xs:element name="AddressLine4" type="xs:string" minOccurs="1" oraxdb:propNumber="5945" oraxdb:global="false" oraxdb:SQLName="AddressLine4" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<xs:element name="PostCode" type="xs:string" minOccurs="0" oraxdb:propNumber="5946" oraxdb:global="false" oraxdb:SQLName="PostCode" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="SiteTelephoneNoType" type="xs:string" minOccurs="0" oraxdb:propNumber="5948" oraxdb:global="false" oraxdb:SQLName="SiteTelephoneNoType" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<xs:element name="SiteMobilePlantType" type="xs:string" minOccurs="0" oraxdb:propNumber="5949" oraxdb:global="false" oraxdb:SQLName="SiteMobilePlantType" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<xs:element name="SiteFaxNoType" type="xs:string" minOccurs="0" oraxdb:propNumber="5950" oraxdb:global="false" oraxdb:SQLName="SiteFaxNoType" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<!--***Location code must reference the code in the Location Dataset***-->
<xs:element name="SiteLocationCode" type="xs:string" minOccurs="1" oraxdb:propNumber="5951" oraxdb:global="false" oraxdb:SQLName="SiteLocationCode" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<xs:element name="SitePopulationEquivType" type="xs:positiveInteger" minOccurs="0" oraxdb:propNumber="5952" oraxdb:global="false" oraxdb:SQLName="SitePopulationEquivType" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
The method for generating the XML:
DECLARE
v_ctx DBMS_XMLGEN.ctxhandle;
v_xml XMLTYPE;
BEGIN
v_ctx:=DBMS_XMLGEN.newcontext
SELECT e.site_id "SiteIDType", e.site_name "SiteNameType", sit_address(e.addr_line1, e.addr_line2,
e.addr_line3, e.addr_line4, e.post_code) AS "SiteAddressStructure", e.tel_no "SiteTelephoneNoType"
, e.mobile_plant "SiteMobilePlantType",
e.fax_no "SiteFaxNoType", e.ge1_location_code "SiteLocationCodeType" ,e.population_equivalent "SitePopulationEquivType"
FROM EL03_SITES e
WHERE e.site_id = 15'
DBMS_XMLGEN.setrowsettag (v_ctx, 'site');
DBMS_XMLGEN.setrowtag (v_ctx, NULL);
v_xml := DBMS_XMLGEN.getxmltype (v_ctx);
INSERT INTO js_xml_test
(ID, xml_data
VALUES ('site test', v_xml
COMMIT;
DBMS_XMLGEN.closecontext (v_ctx);
END;
The resulting XML:
<site>
<SiteIDType>15</SiteIDType>
<SiteNameType>Finlas Water Treatment Works</SiteNameType>
<SiteAddressStructure>
<AddressLine1>Finlas Water Treatment Works</AddressLine1>
<AddressLine2>Shermor Farm</AddressLine2>
<AddressLine3>Luss</AddressLine3>
<AddressLine4>Alexandria</AddressLine4>
<PostCode>G83 8RH</PostCode>
</SiteAddressStructure>
<SiteTelephoneNoType>01389 850224</SiteTelephoneNoType>
<SiteMobilePlantType>N</SiteMobilePlantType>
<SiteLocationCodeType>123428</SiteLocationCodeType>
</site>
When I try to validate it, I get:
ORA-30937: No schema definition for 'site' (namespace '') in parent '/'
ORA-06512: at "SYS.XMLTYPE", line 345
ORA-06512: at line 30
How do I get a namespace declaration in the XML? Any suggestions gratefully received.Did you change any of the text in the lob write statements ?
I believe you get this error if you increase the number of characters without increasing the 1st argument which looks as though it represents the number of characters -
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. -
11i EBS XML Publisher Report with Multiple Data Source
I need to create XML Publisher report in 11i EBS pulling data from another 10.7 EBS Instance as well as 11i EBS in single report.
I am not allowed to create extract or use db links.
My problem is how to create Data Source Connection using Java Concurrent Program.
The approach I am trying is
1. create Java concurrent program to establish connection to 10.7 instance.
2. Will write the SQL queries in Data Tempalete with 2 Data Source 1 for 11i EBS and 2 for 10.7 EBS
3. Template will show the data from both query in 1 report..
Is there any other way to proceed using datasource API...
thanksoption1:
The query should be same @ detail level, only the template has to be different for summary and details.
@runtime, user can choose to see the detail/summary
Disadvantage, if the data is huge,
advantage , only one report.
option2:
create two separate reports summary and details
and create diff data and diff layout and keep it as different report
Advantage, query will perform based on the user run report, summary/detail, so that you can write efficient query.
Dis advantage , two reports query/template to be maintained. -
XML Output - Issue with multiple field labels.
Dear Users,
I am trying to create an XML sheet as output for my program, and am struck at a point where I don't need field labels appearing on the XML output.
The code looks as below:
l_element_order = l_document->create_simple_element(
name = 'Order'
parent = l_element_ordertype ).
l_value = it_order-aufnr.
l_rc = l_element_order->set_attribute( name = 'AUFNR' value = l_value ).
On my output though, both the field labels 'Order' and 'AUFNR' appear side by side. I would ideally only want the 'Order' label to appear.
Is there a method through which I can suppress the labels?!
I am using the following classes as a part of the code:
DATA: l_ostream TYPE REF TO if_ixml_ostream,
l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_renderer TYPE REF TO if_ixml_renderer,
l_document TYPE REF TO if_ixml_document,
l_value TYPE string.
Would be much appreciated if someone could help me with this please. Thanks!
VijayHi,
recipent list is filled once,there are no loops in the program, and the SOST shows two same items with some have same time stamp and some have difference of a second.
Regards
Govind -
XML-Cals table with aid namespaces
hi at all!
i have a xml-cals table which i'd like to import in indesign including the aid-namespaces especially the tablestyle. for me, it never worked out. is it actually possible to include the aid namespaces in a xml-cals table model?!
thanks in advace
juerschen
this is my cals table:
<eigenschaften_tab>
<table typ="eigenschaften" tab_modell="CALS">
<tgroup cols="2">
<colspec colnum="1" colname="eigenschaft" colwidth="72.87007874021651pt"/>
<colspec colnum="2" colname="ausprägung" colwidth="93.89370078728348pt"/>
<tbody>
<row>
<entry>Standort:</entry>
<entry>hell, halbschattig</entry>
</row>
<row>
<entry>Wuchs:</entry>
<entry>mittel</entry>
</row>
<row>
<entry>Pflanzenschmuck:</entry>
<entry>Blatt</entry>
</row>
<row>
<entry>Farbe:</entry>
<entry>gelb, grün</entry>
</row>
</tbody>
</tgroup>
</table>
</eigenschaften_tab>Hi,
I think that it is not possible because the CALS and InDesign XML are using different namespaces.
-Nissan -
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
Maybe you are looking for
-
Considering a few websites stopped working for me seeing as I was still using 3.6.X, I reluctantly decided to finally upgrade today, and it automatically upgraded to version 12. Needless to say, I wanted it to look exactly as it did in 3.6.26, and I
-
Frames on photos - what am I doing wrong?
Hello, I am having trouble figuring out something. I have re-sized a group of photos to ultiimately display on a photo gallery page and wanted to add frames to them. Whenever I apply a frame to the photo, the photo gets really small and a large area
-
HT1420 How do you recover a purchased app?
Hello, How do you recover a previously paid app that does appear under "Purchased" when you click on the 'App Store' app? Note that I have a printed copy of the "Purchased History" which does show the "Locabulary Pro 1.0" app purchased on 4/12/12. Th
-
Saving Files from Photoshop to Lightroom
In LR 3 when I saved an image after editing in PS, the edited file showed up next to the original RAW file. Now in LR 4, the saved image is placed at the end of the folder. It there a preference somewhere that I can set to tell LR that I want it plac
-
Hello, Am new to Oracle RAC. We have a 2 node 11gR2 Cluster and we are in the process of doing some failover testing. For database deployments we use an internal third part tool called the deployer which has tokens for DB configurations and the DBHos