Namespaces in XQuery

Hi,
Please,
I'm using ojxqi to execute queries in XML files. I have some problems:
How can I execute queries in a XML file with Namespaces?
e.g. (example.xml)
<videolib>
     <dc:title>Something</dc:title>
     <dc:creator>Alex</dc:creator>
     <city>Campina Grande</city>
     <country>Brazil</country>
</videolib>
I have a XML which import the Dublin Core Namespace. I made the following query:
<videolib>
FOR $r IN document('c:/Tomcat/webapps/videolib/videolib.xml')/videolib
WHERE contains($r/dc:title/text(), "Something")
RETURN
$r/dc:title
</videolib>
When I execute it, the system return:
"Namespace prefix 'dc' used but not declared."
How can I resolve this problem?
Note: If I execute a query in a element wich don't belong to a namespace, there isn't problem.
e.g.
<videolib>
FOR $r IN document('c:/Tomcat/webapps/videolib/videolib.xml')/videolib
WHERE contains($r/country/text(), "Brazil")
RETURN
$r/country
</videolib>
it result in
<videolib>
<country>Brazil</country>
</videolib>
Thank's in advance!

can you try this one in your xquery
<ns3:AwardCreditSummary xmlns:ns2 = "urn:www.virginaustralia.com:schema:cdm:loyalty:LoyaltyAwardCredit:v10" xmlsns:ns1 = "http://hititcs.com" xmlns:ns3="urn:www.virginaustralia.com:service:task:loyalty:GetMemberAwardCreditsMsg:v10" xmlns:ns0 = "http://hititcs.com/xsd">you can just define the namespace prefixes in the root element and then all sub elements with that prefix will use them

Similar Messages

  • Output XML with a default namespace using XQuery

    I'm having a problem with namespaces in an XQuery within ALSB.
    We receive XML from a file which doesn't have any namespace and have to transform it into a different structure, giving it a default namespace such as below:
    Input XML
    <inputRoot>
         <inputAccountName>Joe Bloggs</inputAccountName>
         <inputAccountNumber>10938393</inputAccountNumber>
    </inputRoot>
    Desired output XML
    <outputRoot xmlns="http://www.example.org/outputSchema">
         <outputAccounts>
              <outputAccountName>Joe Bloggs</outputAccountName>
              <outputAccountNumber>10938393</outputAccountNumber>
         </outputAccounts>
    </outputRoot>
    When I attempt to do this using XQuery mapper tool, I end up with a namespace prefix on the outputRoot. The XQuery and result follows:
    XQuery
    declare namespace xf = "http://tempuri.org/XQueryProject/scratchTransformations/test/";
    declare namespace ns0 = "http://www.example.org/outputSchema";
    declare function xf:test($inputRoot1 as element(inputRoot))
    as element(ns0:outputRoot) {
    <ns0:outputRoot>
    <outputAccounts>
    <outputAccountName>{ data($inputRoot1/inputAccountName) }</outputAccountName>
    <outputAccountNumber>{ data($inputRoot1/inputAccountNumber) }</outputAccountNumber>
    </outputAccounts>
    </ns0:outputRoot>
    declare variable $inputRoot1 as element(inputRoot) external;
    xf:test($inputRoot1)
    Result
    <ns0:outputRoot xmlns:ns0="http://www.example.org/outputSchema">
         <outputAccounts>
              <outputAccountName>inputAccountName_1</outputAccountName>
              <outputAccountNumber>inputAccountNumber_1</outputAccountNumber>
         </outputAccounts>
    </ns0:outputRoot>
    How can I write the XQuery in such a way thay the namespace prefix isn't output? I've tried many different methods with no success. I can't declare a default element namespace because my input element doesn't have a namespace
    Thanks in advance

    I spoke too soon, it didn't work quite as perfectly as I'd thought :-) It turns out our client can't handle the xml with the namespace prefix but we've worked out the solution to return XML in the format we originally needed.
    Example below:
    XQuery
    declare namespace xf = "http://tempuri.org/XQueryProject/scratchTransformations/test/";
    declare default element namespace "http://www.example.org/outputSchema";
    declare namespace ns1 = ""
    declare function xf:test($inputRoot1 as element(ns1:inputRoot))
    as element(outputRoot) {
    <outputRoot>
    <outputAccounts>
    <outputAccountName>{ data($inputRoot1/inputAccountName) }</outputAccountName>
    <outputAccountNumber>{ data($inputRoot1/inputAccountNumber) }</outputAccountNumber>
    </outputAccounts>
    </outputRoot>
    declare variable $inputRoot1 as element(inputRoot) external;
    xf:test($inputRoot1)

  • How to add namespace prefixes to XMLType created from Object?

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE 11.2.0.3.0 Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    I'm working with SOAP request creation from Schema derived Types.
    Consider the registration of the following annotated schema (I wanted Oracle to create the types for me, but with my own names):
    exec dbms_xmlschema.deleteSchema(schemaURL => 'Parameters4.xsd');
    declare
    v_xsd xmltype := xmltype('<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
               xmlns:oraxdb="http://xmlns.oracle.com/xdb"
               xmlns = "http://www.cognera.com"
               targetNamespace = "http://www.cognera.com">
      <xs:element name="Parameters" oraxdb:SQLName="Parameters" oraxdb:SQLType="Parameters">
        <xs:complexType oraxdb:SQLType="Parameters">
          <xs:sequence>
            <xs:element name="Param1" type="xs:string" oraxdb:SQLName="Param1" oraxdb:SQLType="VARCHAR2" />
            <xs:element name="NestedItems" oraxdb:SQLName="NestedItems" oraxdb:SQLType="NestedItemsType">
              <xs:complexType oraxdb:SQLType="NestedItemsType">
                <xs:sequence>
                  <xs:element name="NestedItem" type="NestedItemType" oraxdb:SQLName="NestedItem" oraxdb:SQLType="NestedItemType"/>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:complexType name="NestedItemType" oraxdb:SQLType="NestedItemType">
        <xs:sequence>
          <xs:element name="nParam1" type="xs:string" oraxdb:SQLName="nParam1" oraxdb:SQLType="VARCHAR2"/>
          <xs:element name="nParam2" type="xs:string" oraxdb:SQLName="nParam2" oraxdb:SQLType="VARCHAR2"/>
          <xs:element name="nParam3" type="xs:string" oraxdb:SQLName="nParam3" oraxdb:SQLType="VARCHAR2"/>
        </xs:sequence>
      </xs:complexType>
    </xs:schema>
    begin
      dbms_xmlschema.registerSchema(schemaURL => 'Parameters4.xsd', --this name is local to each ERS schema.                                
                                          schemaDoc => v_xsd,
                                          local => TRUE,
                                          genTypes => TRUE, --only want the types
                                          genbean => FALSE,
                                          genTables => TRUE, --not sure if I need this
                                          force => TRUE,
                                          owner => user);
    end;
    Types created were:
    CREATE OR REPLACE TYPE "NestedItemType" AS OBJECT ("SYS_XDBPD$" "XDB"."XDB$RAW_LIST_T","nParam1" VARCHAR2(4000 CHAR),"nParam2" VARCHAR2(4000 CHAR),"nParam3" VARCHAR2(4000 CHAR))NOT FINAL INSTANTIABLE
    CREATE OR REPLACE TYPE "NestedItemsType" AS OBJECT ("SYS_XDBPD$" "XDB"."XDB$RAW_LIST_T","NestedItem" "NestedItemType")FINAL INSTANTIABLE
    CREATE OR REPLACE TYPE "Parameters" AS OBJECT ("SYS_XDBPD$" "XDB"."XDB$RAW_LIST_T","Param1" VARCHAR2(4000 CHAR),"NestedItems" "NestedItemsType")FINAL INSTANTIABLE
    I found that in order to build these types using constructors (to avoid PLS-00306: wrong number or types of arguments in call to 'NestedItemType'), that I needed to edit these types (drop the xdb magic):
    CREATE OR REPLACE TYPE "NestedItemType" AS OBJECT ("nParam1" VARCHAR2(4000 CHAR),"nParam2" VARCHAR2(4000 CHAR),"nParam3" VARCHAR2(4000 CHAR))FINAL INSTANTIABLE
    CREATE OR REPLACE TYPE "NestedItemsType" AS OBJECT ("NestedItem" "NestedItemType")FINAL INSTANTIABLE
    CREATE OR REPLACE TYPE "Parameters" AS OBJECT ("Param1" VARCHAR2(4000 CHAR),"NestedItems" "NestedItemsType")FINAL INSTANTIABLE
    I read on the forums of a hack to get a namespace added in the output:
    CREATE OR REPLACE TYPE "Parameters" AS OBJECT ("@xmlns" VARCHAR2(4000), -- namespace attribute HACK
                                                           "Param1" VARCHAR2(4000 CHAR),"NestedItems" "NestedItemsType")FINAL INSTANTIABLE
    Putting it all together, I have:
    DECLARE
      v_Parameters    "Parameters";
      v_xml           xmltype;
      v_print_output  clob;     
    begin
      v_Parameters :=  "Parameters"('www.cognera.com',
                                    'hello',
                                  "NestedItemsType"("NestedItemType"('one',
                                                                 'two',
                                                                 'three'
      v_xml := xmltype(xmlData => v_Parameters);
      select xmlserialize(document
                          xmlquery('declare namespace soap = "http://www.w3.org/2003/05/soap-envelope";                                                             
                                    declare namespace cognera = "http://www.cognera.com";
                                    <soap:Envelope>
                                       <soap:Header/>
                                       <soap:Body>
                                       </soap:Body>
                                     </soap:Envelope>
                                   ' passing v_xml returning content) as clob
                          indent size=2
                         ) into v_print_output from dual;
      dbms_output.put_line(v_print_output);
    end;
    This outputs:
    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
      <soap:Header/>
      <soap:Body>
        <Parameters xmlns="www.cognera.com">
          <Param1>hello</Param1>
          <NestedItems>
            <NestedItem>
              <nParam1>one</nParam1>
              <nParam2>two</nParam2>
              <nParam3>three</nParam3>
            </NestedItem>
          </NestedItems>
        </Parameters>
      </soap:Body>
    </soap:Envelope>
    What I really want is:
    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:c="www.cognera.com">
      <soap:Header/>
      <soap:Body>
        <c:Parameters>
          <c:Param1>hello</c:Param1>
          <c:NestedItems>
            <c:NestedItem>
              <c:nParam1>one</c:nParam1>
              <c:nParam2>two</c:nParam2>
              <c:nParam3>three</c:nParam3>
            </c:NestedItem>
          </c:NestedItems>
        </c:Parameters>
      </soap:Body>
    </soap:Envelope>
    How do I do this without having to programatically add the namespace using a custom XQuery function?

    See this similar thread, it should give you some better alternatives than the "@xmlns" hack :
    Add Namespaces via XQuery to an XML Instance
    For example :
    SQL> SELECT XMLSerialize(DOCUMENT
      2           XMLTransform(
      3             xmltype(
      4               "Parameters"('hello', "NestedItemsType"("NestedItemType"('one','two','three')))
      5             )
      6           , xmlparse(content
      7  '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      8    <xsl:output encoding="UTF-8" indent="yes" method="xml"/>
      9    <xsl:param name="ns"/>
    10    <xsl:template match="/">
    11      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    12        <soap:Header/>
    13          <soap:Body>
    14               <xsl:apply-templates select="*"/>
    15             </soap:Body>
    16         </soap:Envelope>
    17    </xsl:template>
    18    <xsl:template match="*">
    19      <xsl:element name="{local-name()}" namespace="{$ns}">
    20        <xsl:apply-templates select="@*|node()"/>
    21      </xsl:element>
    22    </xsl:template>
    23  </xsl:stylesheet>')
    24           , q'{ns="'www.cognera.com'"}'
    25           )
    26           INDENT
    27         ) AS "XSLT Output"
    28  FROM dual ;
    XSLT Output
    <?xml version="1.0" encoding="UTF-8"?>
    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
      <soap:Header/>
      <soap:Body>
        <Parameters xmlns="www.cognera.com">
          <Param1>hello</Param1>
          <NestedItems>
            <NestedItem>
              <nParam1>one</nParam1>
              <nParam2>two</nParam2>
              <nParam3>three</nParam3>
            </NestedItem>
          </NestedItems>
        </Parameters>
      </soap:Body>
    </soap:Envelope>
    You can store the stylesheet in the XDB repository or in a table and access it using a DBUriType.
    It then provides a concise way to both add the namespace and wrap the payload in the envelope.

  • How to add all namespaces in root node of xquery transformation result?

    Hi,
    I'm using xquery Transformation in oracle service bus to transfrom output. The schema used for output transfromation has elements being imported from several schemas. so that output xml has these long tags with namespaces of repective schemas e.g.
    <rr:Get360ViewOfProductResponse      xmlns:rr="http://canaldigital.com/schema/product/CPMProductInformation/v2.0/">
    <ResponseHeader>
    <com:ResponseCode xmlns:com="http://broadcast.telenor.com/tsi/common/commonparameters_v1" >0</com:ResponseCode>
    <com:ResponseText xmlns:com="http://broadcast.telenor.com/tsi/common/commonparameters_v1" >0</com:ResponseText>
    </ResponseHeader>
    </rr:Get360ViewOfProductResponse>
    what I want to achieve is that all namespaces come once in the rootNode and all childnodes just use the repective prefixes, so that the xml size doesnt grow too large.Like below.
    <rr:Get360ViewOfProductResponse      xmlns:com="http://broadcast.telenor.com/tsi/common/commonparameters_v1" xmlns:rr="http://canaldigital.com/schema/product/CPMProductInformation/v2.0/" xmlns:pr="http://broadcast.telenor.com/tsi/common/program_v1">
    <ResponseHeader>
    <com:ResponseCode>0</com:ResponseCode>
    <com:ResponseText>0</com:ResponseText>
    </ResponseHeader>
    </rr:Get360ViewOfProductResponse>
    the difference is that ResponseCode and responseText should only use their prefix, and not complete namespace. How can i acheive this.
    Thanks in advance.
    Edited by: 856401 on Feb 9, 2012 1:53 AM

    I get error 'Invalid expression- Unexpected token copy-namespaces'. Is it supported by xquery version 1.0 ? Following is the updated xquery transformation which gives static error:
    xquery version "1.0" encoding "Cp1252";
    (:: pragma bea:global-element-parameter parameter="$get360ViewOfProductResponse1" element="ns5:Get360ViewOfProductResponse" location="../XSD/CPMSchema_v20.xsd" ::)
    (:: pragma bea:global-element-return element="ns6:Get360ViewOfProductResponse" location="../XSD/CPMSchema_v3.xsd" ::)
    declare namespace ns2 = "http://broadcast.telenor.com/tsi/common/displayinformation_v1";
    declare namespace ns1 = "http://broadcast.telenor.com/tsi/common/commonparameters_v1";
    declare namespace ns4 = "http://broadcast.telenor.com/tsi/common/Property_v2";
    declare namespace ns3 = "http://broadcast.telenor.com/tsi/common/ProductMain_v2";
    declare namespace ns0 = "http://broadcast.telenor.com/tsi/common/condition_v1";
    declare namespace ns9 = "http://broadcast.telenor.com/tsi/common/extension_v1";
    declare namespace ns5 = "http://broadcast.telenor.com/tsi/psd/cpm/CPMSchema_v20";
    declare namespace ns6 = "http://canaldigital.com/schema/product/CPMProductInformation/v3.0/";
    declare namespace xf = "http://tempuri.org/CPM_OSB_v3/XQuery/Get360ViewOfProductResponse/";
    declare namespace ns7 = "http://broadcast.telenor.com/tsi/common/productofferingpricewithrules_v2";
    declare namespace ns8 = "http://broadcast.telenor.com/tsi/common/pricecomponent_v2";
    declare copy-namespaces preserve, inherit;
    declare function xf:Get360ViewOfProductResponse($get360ViewOfProductResponse1 as element(ns5:Get360ViewOfProductResponse))
    as element(ns6:Get360ViewOfProductResponse) {
    <ns6:Get360ViewOfProductResponse>
    <ResponseHeader>
    <ns1:ResponseCode>0</ns1:ResponseCode>
    <ns1:ResponseText>{ data($get360ViewOfProductResponse1/responseDescription) }</ns1:ResponseText>
    </ResponseHeader>
    </ns6:Get360ViewOfProductResponse>
    declare variable $get360ViewOfProductResponse1 as element(ns5:Get360ViewOfProductResponse) external;
    xf:Get360ViewOfProductResponse($get360ViewOfProductResponse1)

  • XQuery mixed prefixed / default namespaces in input documents

    Hi there,
    I am developing an Atom Publishing Protocol server. The feeds produced by the server, which are regular atom documents being generated with XQuery, need to be formatted such that they have no namespace prefixes, only xmlns="..." attributes. However, my input documents (atom entry documents stored in dbxml) sometimes have the atom: namespace prefix.
    How can I get XQuery to 'notice' that the namespace is the same as the default element namespace and remove the prefixes from the output?
    Example input document in database (generated by Windows Live Writer):
    <?xml version="1.0" encoding="utf-8"?>
    <atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
    <atom:id>urn:uuid:a8cc06e6-3d63-4411-a984-019dc3bf6d75</atom:id>
    <atom:title>With NS</atom:title>
    <atom:content type="html"><p>aera raw</p>
    <p>awre</p> <p>awre </p> <p>aw</p>
    <p> </p> <p>awreawer</p>
    <p>awer</p> <p> </p>
    <p> </p> <p>awer </p> </atom:content>
    </atom:entry>
    Some XQuery that reproduces the problem:
    declare default element namespace "http://www.w3.org/2005/Atom";
    declare namespace app = "http://www.w3.org/2007/app";
    let $entries := collection('dbxml:entries')/entry
    return
    <feed xmlns="http://www.w3.org/2005/Atom">
    <id>http://some.server/</id>
    <title type="text">Example of problem</title>
    <author><name>Andrew Bruce</name></author>
    <updated>{current-dateTime()}</updated>
    <link href="http://some.place/" rel="self"/>
    {$entries}
    </feed>
    This outputs (formatted to aid readability):
    <?xml version="1.0" encoding="utf-8"?>
    <feed xmlns="http://www.w3.org/2005/Atom">
    <id>http://some.server/</id>
    <title type="text">Example of problem</title>
    <author><name>Andrew Bruce</name></author>
    <updated>2008-04-05T22:47:23.136Z</updated>
    <link href="http://some.place/" rel="self"/>
    <atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
    <atom:id>urn:uuid:a8cc06e6-3d63-4411-a984-019dc3bf6d75</atom:id>
    <atom:title>With NS</atom:title>
    <atom:content type="html"><p>aera raw</p>
    <p>awre</p> <p>awre </p> <p>aw</p>
    <p> </p> <p>awreawer</p>
    <p>awer</p> <p> </p>
    <p> </p> <p>awer </p> </atom:content>
    </atom:entry>
    </feed>
    Any help would be greatly appreciated.
    Andrew Bruce

    Hi Andrew,
    DB XML will try to preserve the namespace prefix or lack-thereof of the XML it is serializing. In this case the atom entry from the source document uses the prefix, so DB XML uses it. Since the choice of namespace prefix is orthogonal to the meaning of the XML document, DB XML does not provide a way to alter this behaviour.
    John

  • BEA XQuery Namespace Problem

    Hi,
    I'm facing problem in getting correct XQuery results with BEA when namespace is provided in XML Document.
    I'm trying to execute XQuery against the following XML Document (having xmlns):
    <?xml version="1.0"?>
    <ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
         <templateId root="2.16.840.1.113883.3.27.1776"/>
         <id extension="req_cda_123" root="2.16.840.1.113883.4.49"/>
         <code code="34095-0" codeSystem="2.16.840.1.113883.6.1" displayName="COMPREHENSIVE HISTORY & PHYSICAL NOTE"/>
         <title>Comprehensive History & Physical Note</title>
         <effectiveTime value="20060527"/>
         <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
         <setId extension="req_cda_123" root="2.16.840.1.113883.4.49"/>
         <versionNumber value="1"/>
         <recordTarget>
              <patientRole>
                   <id extension="pid_123" root="2.16.840.1.113883.4.49"/>
                   <patient>
                        <name>
                             <given>John</given>
                             <family>Doe</family>
                        </name>
                        <administrativeGenderCode code="M" codeSystem="2.16.840.1.113883.5.1"/>
                        <birthTime value="19580106"/>
                   </patient>
                   <providerOrganization>
                        <id extension="prov_123" root="2.16.840.1.113883.4.49"/>
                   </providerOrganization>
              </patientRole>
         </recordTarget>
    </ClinicalDocument>
    XQuery is:
    let $patFirstName := (//recordTarget/patientRole/patient/name/given)
    return if ($patFirstName) then
              <result>true {$patFirstName}</result>
         else
              <result>false</result>
    The above XQuery always result in false
    I've tried the XQuery which is traversing through root:
    let $patFirstName := (./ClinicalDocument/recordTarget/patientRole/patient/name/given)
    return if ($patFirstName) then
              <result>true {$patFirstName}</result>
         else
              <result>false</result>
    It also results in false.
    Then I've changed the XML Document and removed its namespace declaration (xmlns) as:
    <?xml version="1.0"?>
    <ClinicalDocument>
         <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
         <templateId root="2.16.840.1.113883.3.27.1776"/>
         <id extension="req_cda_123" root="2.16.840.1.113883.4.49"/>
         <code code="34095-0" codeSystem="2.16.840.1.113883.6.1" displayName="COMPREHENSIVE HISTORY & PHYSICAL NOTE"/>
         <title>Comprehensive History & Physical Note</title>
         <effectiveTime value="20060527"/>
         <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
         <setId extension="req_cda_123" root="2.16.840.1.113883.4.49"/>
         <versionNumber value="1"/>
         <recordTarget>
              <patientRole>
                   <id extension="pid_123" root="2.16.840.1.113883.4.49"/>
                   <patient>
                        <name>
                             <given>John</given>
                             <family>Doe</family>
                        </name>
                        <administrativeGenderCode code="M" codeSystem="2.16.840.1.113883.5.1"/>
                        <birthTime value="19580106"/>
                   </patient>
                   <providerOrganization>
                        <id extension="prov_123" root="2.16.840.1.113883.4.49"/>
                   </providerOrganization>
              </patientRole>
         </recordTarget>
    </ClinicalDocument>
    Now the same XQueries result in true.
    I don't know why BEA's XQuery engine is behaving like this with namespace declaration. I want expert's help in this regard.
    Thanks,
    Ismail

    I found that giving the full URL in declare namespace resolves my issue. Oracle's XMLPatch accepts XDiff document generated by this XQuery.

  • XQuery Namespace Problem !

    Hello everyone...
    I'm trying to generate a Xdiff document using XQuery. First, i have tried to generate a static XDiff document using Xquery. I'm getting a problem with namespace. The XQuery I have written is
    select xmlroot(XMLQuery('
    declare namespace xsi="xsi"; (: :)
    declare namespace xd="xd"; (: :)
    let $chk1:=( <xd:delete-node xd:node-type="element" xd:xpath="/RootElement[1]/Invalid[1]" />)
    return <xd:xdiff xsi:schemaLocation="http://xmlns.oracle.com/xdb/xdiff.xsd http://xmlns.oracle.com/xdb/xdiff.xsd" xmlns:xd="http://xmlns.oracle.com/xdb/xdiff.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <?oracle-xmldiff operations-in-docorder="false" output-model="current" diff-algorithm="global"?>{$chk1}</xd:xdiff>
    returning content), VERSION '1.0')
    from dual;
    The above query gives me the output
    <?xml version="1.0"?>
    <xd:xdiff xmlns:xd="http://xmlns.oracle.com/xdb/xdiff.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLo
    cation="http://xmlns.oracle.com/xdb/xdiff.xsd http://xmlns.oracle.com/xdb/xdiff.xsd">
    <?oracle-xmldiff operations-in-docorder="false" output-model="current" diff-algorithm="global"?>
    <xd:delete-node xmlns:xd="xd" xd:node-type="element" xd:xpath="/RootElement[1]/Invalid[1]"/>
    </xd:xdiff>
    I don't want that xmlns="xd" attribute. How to eliminate that?
    Please help me.
    Thanks in advance,
    R Kaja Mohideen

    I found that giving the full URL in declare namespace resolves my issue. Oracle's XMLPatch accepts XDiff document generated by this XQuery.

  • Assign default namespace to XML fragment using XQuery

    Hi everybody!
    I need to add a default namespace declaration to a XML fragment using XQuery. I wrote following statement to assign fragment to $body:
    <soap-env:Body>{
    fn-bea:inlinedXML($content/text())}
    </soap-env:Body>
    The problem is "$content/text()" has no namespace declaration so I need to assign a default namespace (xmlns="") to it in order to apply some XQuery transformations to its content.
    I know this can be easily done with a XSLT but I would like use XQuery instead.
    Could anyone tell me how I could perform this task?
    Thank you in advance,
    Daniel.

    Re: xquery function - send namespace as binding variable and define it in a tag

  • XMLQuery (XQuery) with namespace

    I'm pretty new to XML/XQuery and have the following problem.
    I've got a DB outside oracle which is the same as I got in Oracle (10.2.0.1.0). Using XMLSpy I can make a simple query with a default namespace that gives me an XML document.
    xquery version "1.0";
    declare default element namespace "POI";
    for $x in fn:doc("H:\urs\025_XPOI\XDB\xdb\Simple\xml\001_03082006\xpoi\simple.xml")/Simple_XPOIS/Simple
    where $x/ID = 1
    return $x
    When I try the same in Oracle, it fails. I have no idea how to use the XMLNamespaces......
    SQL>
    SQL> WITH XMLNamespaces (DEFAULT 'POI')
    2 SELECT XMLQuery('
    3 for $x in fn:doc("/home/Simple/xml/001_03082006/xpoi/simple.xml")/Simple_XPOIS/Simple
    4 where $x/ID = 1
    5 return $x
    6 '
    7 RETURNING CONTENT) AS RESULT FROM DUAL;
    WITH XMLNamespaces (DEFAULT 'POI')
    ERROR at line 1:
    ORA-32033: unsupported column aliasing
    ####################

    Does this help
    SQL> var docPath varchar2(128)
    SQL> var xmltext varchar2(4000)
    SQL> --
    SQL> begin
      2    :docPath := '/public/rdfSample.xml';
      3    :xmltext :=
      4  '<?xml version="1.0"?>
      5  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://mets.d2lab.net/onts/core.owl#" xmlns:core="http://mets.d
    2lab.net/onts/core.owl#" xmlns:ct="http://mets.d2lab.net/onts/ct.owl#" xmlns:dc="http://protege.stanford.edu/plugins/owl/dc/dublincore.owl#"
    xmlns:geo="http://reliant.teknowledge.com/DAML/Geography.owl#" xmlns:icmsp="http://mets.d2lab.net/onts/icmsp.owl#" xmlns:isocc="http://www.
    daml.org/2001/09/countries/iso-3166-ont#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmln
    s:xsd="http://www.w3.org/2001/XMLSchema#">
      6     <rdf:Description rdf:ID="AERO000001">
      7             <rdf:type rdf:resource="http://mets.d2lab.net/onts/core.owl#Municipality"/>
      8             <core:hasName>ST PETERSBURG</core:hasName>
      9             <core:hasRefs rdf:resource="#AERO000002"/>
    10             <core:fromDocument rdf:resource="#id00001"/>
    11             <core:hasName>SAINT  PETERSBURG</core:hasName>
    12             <core:hasName>PETERSBURG</core:hasName>
    13     </rdf:Description>
    14  </rdf:RDF>';
    15  end;
    16  /
    PL/SQL procedure successfully completed.
    SQL> declare
      2    res boolean;
      3  begin
      4    if (dbms_xdb.existsResource(:docPath)) then
      5      dbms_xdb.deleteResource(:docPath);
      6    end if;
      7    res := dbms_xdb.createResource(:docPath,:xmltext);
      8    commit;
      9  end;
    10  /
    PL/SQL procedure successfully completed.
    SQL> set long 10000 lines 1000 pages 0
    SQL> --
    SQL> select xdburitype(:docPath).getXML()
      2    from dual
      3  /
    <?xml version="1.0"?>
    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://mets.d2lab.net/onts/core.owl#" xmlns:core="http://mets.d2lab.
    net/onts/core.owl#" xmlns:ct="http://mets.d2lab.net/onts/ct.owl#" xmlns:dc="http://protege.stanford.edu/plugins/owl/dc/dublincore.owl#" xmln
    s:geo="http://reliant.teknowledge.com/DAML/Geography.owl#" xmlns:icmsp="http://mets.d2lab.net/onts/icmsp.owl#" xmlns:isocc="http://www.daml.
    org/2001/09/countries/iso-3166-ont#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd
    ="http://www.w3.org/2001/XMLSchema#">
      <rdf:Description rdf:ID="AERO000001">
        <rdf:type rdf:resource="http://mets.d2lab.net/onts/core.owl#Municipality"/>
        <core:hasName>ST PETERSBURG</core:hasName>
        <core:hasRefs rdf:resource="#AERO000002"/>
        <core:fromDocument rdf:resource="#id00001"/>
        <core:hasName>SAINT  PETERSBURG</core:hasName>
        <core:hasName>PETERSBURG</core:hasName>
      </rdf:Description>
    </rdf:RDF>
    SQL> select xmlquery( 'for $doc in doc($DOCPATH) return $doc' passing :DOCPATH as DOCPATH returning content)
      2    from dual
      3  /
    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://mets.d2lab.net/onts/core.owl#" xmlns:core="http://mets.d2lab.
    net/onts/core.owl#" xmlns:ct="http://mets.d2lab.net/onts/ct.owl#" xmlns:dc="http://protege.stanford.edu/plugins/owl/dc/dublincore.owl#" xmln
    s:geo="http://reliant.teknowledge.com/DAML/Geography.owl#" xmlns:icmsp="http://mets.d2lab.net/onts/icmsp.owl#" xmlns:isocc="http://www.daml.
    org/2001/09/countries/iso-3166-ont#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd
    ="http://www.w3.org/2001/XMLSchema#"><rdf:Description rdf:ID="AERO000001"><rdf:type rdf:resource="http://mets.d2lab.net/onts/core.owl#Munici
    pality"/><core:hasName>ST PETERSBURG</core:hasName><core:hasRefs rdf:resource="#AERO000002"/><core:fromDocument rdf:resource="#id00001"/><co
    re:hasName>SAINT  PETERSBURG</core:hasName><core:hasName>PETERSBURG</core:hasName></rdf:Description></rdf:RDF>
    SQL> select xmlquery
      2         (
      3           'declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; (: :)
      4            declare namespace core="http://mets.d2lab.net/onts/core.owl#"; (: :)
      5            for $doc in doc($DOCPATH)/rdf:RDF/rdf:Description/core:fromDocument/@rdf:resource return $doc'
      6            passing :DOCPATH as "DOCPATH" returning content
      7         )
      8    from dual
      9  /
    #id00001
    SQL> --You should be able to use collection to refer to all the documents if a folder...
    Eg
    select xmlquery( 'for $doc in collection($DOCPATH) return $doc' passing :DOCPATH as DOCPATH returning content)
    from dual

  • Xquery transformation and namespaces

    I'm transforming one XML document based on schema A to another XML document based on schema B. Thransformation works ok, except for the problem with namespaces. My result document looks like this:
    <ns0:root xmlns:ns0="namespaceA">
         <ns0:request>
              <ns1:Element xmlns:ns1="namespaceB">value1</ns1:Element>
              <ns1:Attribute xmlns:ns1="namespaceB">value2</ns1:Attribute>
              <ns1:Attribute xmlns:ns1="namespaceB">value3</ns1:Attribute>
              <ns1:Attribute xmlns:ns1="namespaceB">value4</ns1:Attribute>
         </ns0:request>
    </ns0:root>
    The problem is that namespace attribute is repeated in each element. I want to declare namespaceB in root and than use only prefixes. So document should loook like this:
    <ns0:root xmlns:ns0="namespaceA" xmlns:ns1="namespaceB">
         <ns0:request>
              <ns1:Element>value1</ns1:Element>
              <ns1:Attribute>value2</ns1:Attribute>
              <ns1:Attribute>value3</ns1:Attribute>
              <ns1:Attribute>value4</ns1:Attribute>
         </ns0:request>
    </ns0:root>
    Is it possible to achieve that, and how?
    Thanks for help.

    Helo!
    I saw yesterday this soluction:
    It's best not to think of this as "removing the namespaces" but rather as
    "changing the element names". The name of an element consists of a namespace
    URI and a local name. So the name of the Email element, for example, is
    ("urn:mpeg:mpeg7:schema:2001", "email"). In your desired result, you want an
    Email element without the namespace, that is, you want the name of the
    element in the result to be ("", "email"). So your query has to rename every
    element, or to put it another way, it has to create an element whose name is
    different from the original.
    The way to do this is to write a recursive function something like this:
    declare function f:strip-namespace($e as element()) as element() {
    element {QName((), local-name($e)} {
    for $child in $e/(@*,*)
    return
    if ($child instance of element())
    then f:strip-namespace($child)
    else $child
    AUTHOR: Michael Kay
    see at:
    http://www.x-query.com/pipermail/talk/2006-January/001062.html

  • How to use Foreach in Xquery

    This is my Biz service Output:
    <OutputParameters xmlns="http://=XYZ/pcbpel/adapter/db/WT/WT_IN_CS5_PKG/WT_IN_PROM_OSB/" xmlns:xsi="XYZ/XMLSchema-instance">
    <P_REC_TYPE>
    <P_REC_TYPE_ITEM>
    <ATTRIBUTE_NAME>
    Free MMS to newly activated subscribers Balance
    </ATTRIBUTE_NAME>
    <ATTRIBUTE_VALUE>5.000</ATTRIBUTE_VALUE>
    </P_REC_TYPE_ITEM>
    <P_REC_TYPE_ITEM>
    <ATTRIBUTE_NAME>
    Free MMS to newly activated subscribers Expiry Date
    </ATTRIBUTE_NAME>
    <ATTRIBUTE_VALUE>03-10-2012</ATTRIBUTE_VALUE>
    </P_REC_TYPE_ITEM>
    <P_REC_TYPE_ITEM>
    <ATTRIBUTE_NAME>Monetary bonus for all contracts Balance</ATTRIBUTE_NAME>
    <ATTRIBUTE_VALUE>1.118</ATTRIBUTE_VALUE>
    </P_REC_TYPE_ITEM>
    <P_REC_TYPE_ITEM>
    <ATTRIBUTE_NAME>
    Monetary bonus for all contracts Expiry Date
    </ATTRIBUTE_NAME>
    <ATTRIBUTE_VALUE>03-10-2012</ATTRIBUTE_VALUE>
    </P_REC_TYPE_ITEM>
    </P_REC_TYPE>
    <P_ERR_MSG xsi:nil="true"/>
    <P_ERR_STATUS xsi:nil="true"/>
    </OutputParameters>
    THis is my Current Xquery.Want to Iterate for P_REC_TYPE_ITEM above.
    How to write the Xquery Source,plz suggest
    (:: pragma bea:global-element-parameter parameter="$outputParameters1" element="ns1:OutputParameters" location="../../OraCRMServices_SB/XSD/WT_WT_IN_CS5_PKG_WT_IN_PROM_OSB.xsd" ::)
    (:: pragma bea:global-element-return element="ns0:PrepaidPromotionDtlsResponse" location="../XSD/ShowPrepaidPromotionDtlsResponse.xsd" ::)
    declare namespace ns1 = XYX/db/WT/WT_IN_CS5_PKG/WT_IN_PROM_OSB/";
    declare namespace ns0 = "http:///xml/ShowPrepaidPromotionDtlsResponse";
    declare namespace xf = "http:///ShowPrepaidDtls_SB/Transformations/InPromotionReadToSiebel/";
    declare function xf:InPromotionReadToSiebel($outputParameters1 as element(ns1:OutputParameters))
    as element(ns0:PrepaidPromotionDtlsResponse) {
    <ns0:PrepaidPromotionDtlsResponse>
    <ns0:ListOfPrepaidPromotions>
    <ns0:PrepaidPromotionDtls Name = "{ data($outputParameters1/ns1:P_REC_TYPE/ns1:P_REC_TYPE_ITEM[1]/ns1:ATTRIBUTE_NAME) }"
    Value = "{ data($outputParameters1/ns1:P_REC_TYPE/ns1:P_REC_TYPE_ITEM[1]/ns1:ATTRIBUTE_VALUE) }"/>
    for $P_ERR_MSG in $outputParameters1/ns1:P_ERR_MSG
    return
    <ns0:ErrorMessage>{ data($P_ERR_MSG) }</ns0:ErrorMessage>
    for $P_ERR_STATUS in $outputParameters1/ns1:P_ERR_STATUS
    return
    <ns0:ErrorCode>{ data($P_ERR_STATUS) }</ns0:ErrorCode>
    </ns0:ListOfPrepaidPromotions>
    </ns0:PrepaidPromotionDtlsResponse>
    declare variable $outputParameters1 as element(ns1:OutputParameters) external;
    xf:InPromotionReadToSiebel($outputParameters1)
    Regards
    Shona

    http://www.java2s.com/Code/XML/XQuery/Nestedforloop.htm
    http://www.w3schools.com/xquery/xquery_select.asp
    Thanks,
    Vijay

  • Getting error while updating data element using Xquery Automator

    Hi,
    I am getting following error while i am trying to update a data element in my task.
    <Nov 28, 2011 5:02:40 PM IST> <Error> <oms> <BEA-000000> <automation.AutomationDispatcher: Failed to execute
    on/plugin/external/ACOI_TMIP_POC/1.0.0/CLARIFY_Task.automatedtask.acoi_tmip_poc.ResponseAutomation] due to E
    hile running Script resource [file:///D:/AshishWorkspace_WithOrchestration/ACOI_TMIP_POC/resources/CLARIFY_R
    exception location: ; SystemID: module with no systemId*; Line#: 15; Column#: -1*
    com.mslv.oms.automation.AutomationException: Exception thrown while running Script resource [file:///D:/Ashi
    rchestration/ACOI_TMIP_POC/resources/CLARIFY_Response.xquery]; exception location: ; SystemID: *module with
    e#: 15; Column#: -1
    the Xquery that i am using is pretty simple:
    declare namespace automator = "java:oracle.communications.ordermanagement.automation.plugin.ScriptSenderContextInvocation";
    declare namespace context = "java:com.mslv.oms.automation.TaskContext";
    declare namespace log = "java:org.apache.commons.logging.Log";
    declare namespace oms="urn:com:metasolv:oms:xmlapi:1";
    declare namespace prop = "OSM_POC";
    declare variable $xmlnsosm7POC := "";
    declare variable $log external;
    declare variable $automator external;
    declare variable $context external;
    let $CLFY_XML := //CLFY_XML
    let $Id_Number :=//Id_Number
    return
    automator:setUpdateOrder($automator,"true"),
    log:info($log,fn:concat('ID request number is: ', $Id_Number)),
    <ord:OrderDataUpdate xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:odu="http://www.oracle.com/OMS/OrderDataUpdate" targetNameSpace="http://www.oracle.com/OMS/OrderDataUpdate" xmlns:ord="urn:com:metasolv:oms:xmlapi:1">
    <ord:Add path="/CLFY_ID">{data($Id_Number)}</ord:Add>
    </ord:OrderDataUpdate>
    Can anyone please tell me the reason due to which this error is coming.
    Thanking in advance
    Ashish Garg

    Hello.
    Ok I need you to tell me a little bit more about your automator, did you config an Xquery Automator with Event Type: Internal?
    You should declare namespace automator = "java:oracle.communications.ordermanagement.automation.plugin.ScriptReceiverContextInvocation";
    instead of
    declare namespace automator = "java:oracle.communications.ordermanagement.automation.plugin.ScriptSenderContextInvocation";
    And let my ask you, what are you trying to do with the next lines:
    let $CLFY_XML := //CLFY_XML
    let $Id_Number :=//Id_Number
    Becouse I think you are trying to acces the data on the task, If that is the reason, you should better use something like:
    let $order := ..//oms:GetOrder.Response
    let $orderId := $order/oms:_root/oms:orderHeader/oms:orderId
    with the above lines you are accesing the data that has been added to the task and the just acces the node that you nedd, for example here Im accesig the node
    orderId under OrderHeader
    Another thing is that if you want to update node which already exists in the task data, then you have to use something like:
    <OrderDataUpdate xmlns="http://www.metasolv.com/OMS/OrderDataUpdate/2002/10/25">
    <Update path="/orderHeader/orderId">{$orderId}</Update>
    </OrderDataUpdate>
    But if you have to add a new path you should have something like this:
    <OrderDataUpdate xmlns="http://www.metasolv.com/OMS/OrderDataUpdate/2002/10/25">
         <Add path="/OrderHeader">
              <Transaction>
                   <Name>{$orderId/text())}</Name>
              <ComponentKey>{$controlData/text()}</ComponentKey>
              </Transaction>
         </Add>
    </OrderDataUpdate>
    For the above transaction you should have in the dictionary the structure, OrderHeader in the root, and inside this the structure another node with the respective names
    <Transaction>
                   <Name>{$orderId/text())}</Name>
              <ComponentKey>{$controlData/text()}</ComponentKey>
              </Transaction>
    Another thing is that you should have all this structures in the Task Data of this Task.
    Hope this help
    Lucas.

  • Is there any way to get a better performance with this Xquery ?

    I created two tables.
    One has XBRL docoument with XMLType based on Clob and I'm going to select several columns from it and insert them into the other table.
    I used this SQL using XMLTable.
    INSERT INTO SV_XBRL_ELEMENT
    SELECT r.finance_cd,r.base_month,xt.context_id,xt.ns,xt.name,nvl(xt.lang,'na')
    as lang,xt.unit,xt.decimals,xt.value
    FROM SV_XBRL_DOC r,
    XMLTABLE(
    XMLNAMESPACES(
    'http://www.w3.org/1999/xlink' AS "xlink",
    'http://www.xbrl.org/2003/linkbase' AS "link",
    'http://www.xbrl.org/2003/instance' AS "xbrli",
    'http://www.xbrl.org/2003/iso4217' AS "iso4217",
    'http://www.xbrlkorea.com/kr/kisinfo/fr/gaap/ci/2007-02-09' AS "kisinfo-ci",
    'http://www.xbrlkorea.com/kr/kisinfo/fr/gcd/2007-02-09' AS "kisinfo-gcd",
    'http://www.xbrlkorea.com/kr/kisinfo/fr/profile/2007-02-09' AS "kisinfo-profile",
    'http://www.xbrlkorea.com/kr/kisinfo/fr/ratio/2007-02-09' AS "kisinfo-ratio",
    'http://www.xbrlkorea.com/kr/kisinfo/fr/common/scenario' AS "kisinfo-scenario",
    'http://www.xbrl.or.kr/kr/fr/gaap/ci/2006-05-31' AS "kr-gaap-ci",
    'http://www.xbrl.or.kr/kr/fr/common/pte/2006-05-31' AS "krfr-pte",
    'http://www.xbrl.or.kr/kr/fr/common/ptr/2006-05-31' AS "krfr-ptr",
    'http://www.xbrl.or.kr/2006/role/subitem-notes' AS "p0",
    'http://xmlns.oracle.com/xdb' AS "ora"),
    for $item in
    $doc/xbrli:xbrl/*[not(starts-with(name(),"xbrli:")) and
    not(starts-with(name(),"link:"))]
    where $item/@contextRef
    return <item contextRef="{$item/@contextRef}" xml:lang="{$item/@xml:lang}"
    unitRef="{$item/@unitRef}" name="{local-name($item)}" ns="{namespace-uri($item)}">{$item}</item>'
    PASSING r.xbrl as "doc"
    COLUMNS context_id varchar2(128) PATH '@contextRef',
    ns varchar2(128) PATH '@ns',
    name varchar2(128) PATH '@name',
    lang varchar2(2) PATH '@xml:lang',
    unit varchar2(16) PATH '@unitRef',
    decimals varchar2(64) PATH '@decimals',
    value varchar(256) PATH '.'
    ) xt
    SV_XBRL_DOC has 1450 records(1450 documents).
    SV_XBRL_ELEMENT has more than 110,280 record (110,280 elements)
    the sql above takes more than 6000 seconds with my machine (10g,sun5.8 4 cpus), I admit it's a big number of records, I'm looking for more efficient way to do.
    Is there any point to boost the sql ?
    here is the part of the xbrl document sample.
    <?xml version="1.0"?>
    <xbrli:xbrl xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fines-b-ot="http://fss.xbrl.or.kr/kr/br/b/ot/2007-06-30" xmlns:fines-aa001="http://fss.xbrl.or.kr/kr/br/gaap/aa001/2007-06-30" xmlns:xbrldt="http://xbrl.org/2005/xbrldt" xmlns:ref="http://www.xbrl.org/2004/ref" xmlns:xbrldi="http://xbrl.org/2006/xbrldi" xmlns:iso4217="http://www.xbrl.org/2003/iso4217">
    <link:schemaRef xlink:type="simple" xlink:href="http://fss.xbrl.or.kr/kr/br/fines/aa001/2007-06-30/fines-aa001-2007-06-30.xsd"/>
    <xbrli:context id="ctx_AAA001C">
    <xbrli:entity>
    <xbrli:identifier scheme="http://fss.xbrl.or.kr">0010002</xbrli:identifier>
    <xbrli:segment>
    <xbrldi:explicitMember dimension="fines-b-ot:newItemDimension">fines-b-ot:AAA001C</xbrldi:explicitMember>
    </xbrli:segment>
    </xbrli:entity>
    <xbrli:period>
    <xbrli:instant>1999-03-31</xbrli:instant>
    </xbrli:period>
    </xbrli:context>
    <xbrli:context id="ctx_BAA001C">
    <xbrli:entity>
    <xbrli:identifier scheme="http://fss.xbrl.or.kr">0010002</xbrli:identifier>
    <xbrli:segment>
    <xbrldi:explicitMember dimension="fines-b-ot:newItemDimension">fines-b-ot:BAA001C</xbrldi:explicitMember>
    </xbrli:segment>
    </xbrli:entity>
    <xbrli:period>
    <xbrli:instant>1999-03-31</xbrli:instant>
    </xbrli:period>
    </xbrli:context>
    <xbrli:context id="ctx_CAA001C">
    <xbrli:entity>
    <xbrli:identifier scheme="http://fss.xbrl.or.kr">0010002</xbrli:identifier>
    <xbrli:segment>
    <xbrldi:explicitMember dimension="fines-b-ot:newItemDimension">fines-b-ot:CAA001C</xbrldi:explicitMember>
    </xbrli:segment>
    </xbrli:entity>
    <xbrli:period>
    <xbrli:instant>1999-03-31</xbrli:instant>
    </xbrli:period>
    </xbrli:context>
    <xbrli:context id="ctx_DAA001C">
    <xbrli:entity>
    <xbrli:identifier scheme="http://fss.xbrl.or.kr">0010002</xbrli:identifier>
    <xbrli:segment>
    <xbrldi:explicitMember dimension="fines-b-ot:newItemDimension">fines-b-ot:DAA001C</xbrldi:explicitMember>
    </xbrli:segment>
    </xbrli:entity>
    <xbrli:period>
    <xbrli:instant>1999-03-31</xbrli:instant>
    </xbrli:period>
    </xbrli:context>
    <xbrli:unit id="KRW">
    <xbrli:measure>iso4217:KRW</xbrli:measure>
    </xbrli:unit>
    <fines-b-ot:AAA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">14</fines-b-ot:AAA001R>
    <fines-b-ot:AAA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">0</fines-b-ot:AAA001R>
    <fines-b-ot:AAA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">14</fines-b-ot:AAA001R>
    <fines-b-ot:AAA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:AAA001R>
    <fines-b-ot:A1AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">7</fines-b-ot:A1AA001R>
    <fines-b-ot:A1AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">0</fines-b-ot:A1AA001R>
    <fines-b-ot:A1AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">7</fines-b-ot:A1AA001R>
    <fines-b-ot:A1AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:A1AA001R>
    <fines-b-ot:A2AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">7</fines-b-ot:A2AA001R>
    <fines-b-ot:A2AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">0</fines-b-ot:A2AA001R>
    <fines-b-ot:A2AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">7</fines-b-ot:A2AA001R>
    <fines-b-ot:A2AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:A2AA001R>
    <fines-b-ot:BAA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">4788</fines-b-ot:BAA001R>
    <fines-b-ot:BAA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">49</fines-b-ot:BAA001R>
    <fines-b-ot:BAA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">4837</fines-b-ot:BAA001R>
    <fines-b-ot:BAA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">30</fines-b-ot:BAA001R>
    <fines-b-ot:B1AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">4788</fines-b-ot:B1AA001R>
    <fines-b-ot:B1AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">48</fines-b-ot:B1AA001R>
    <fines-b-ot:B1AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">4836</fines-b-ot:B1AA001R>
    <fines-b-ot:B1AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">29</fines-b-ot:B1AA001R>
    <fines-b-ot:B11AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">2317</fines-b-ot:B11AA001R>
    <fines-b-ot:B11AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">21</fines-b-ot:B11AA001R>
    <fines-b-ot:B11AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">2338</fines-b-ot:B11AA001R>
    <fines-b-ot:B11AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">2</fines-b-ot:B11AA001R>
    <fines-b-ot:B111AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">0</fines-b-ot:B111AA001R>
    <fines-b-ot:B111AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">0</fines-b-ot:B111AA001R>
    <fines-b-ot:B111AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">0</fines-b-ot:B111AA001R>
    <fines-b-ot:B111AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:B111AA001R>
    <fines-b-ot:B112AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">60</fines-b-ot:B112AA001R>
    <fines-b-ot:B112AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">2</fines-b-ot:B112AA001R>
    <fines-b-ot:B112AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">62</fines-b-ot:B112AA001R>
    <fines-b-ot:B112AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:B112AA001R>
    <fines-b-ot:B113AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">185</fines-b-ot:B113AA001R>
    <fines-b-ot:B113AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">1</fines-b-ot:B113AA001R>
    <fines-b-ot:B113AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">186</fines-b-ot:B113AA001R>
    <fines-b-ot:B113AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:B113AA001R>
    <fines-b-ot:B114AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">408</fines-b-ot:B114AA001R>
    <fines-b-ot:B114AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">5</fines-b-ot:B114AA001R>
    <fines-b-ot:B114AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">413</fines-b-ot:B114AA001R>
    <fines-b-ot:B114AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:B114AA001R>
    <fines-b-ot:B115AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">1664</fines-b-ot:B115AA001R>
    <fines-b-ot:B115AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">13</fines-b-ot:B115AA001R>
    <fines-b-ot:B115AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">1677</fines-b-ot:B115AA001R>
    <fines-b-ot:B115AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">2</fines-b-ot:B115AA001R>
    <fines-b-ot:B12AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">2471</fines-b-ot:B12AA001R>
    <fines-b-ot:B12AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">27</fines-b-ot:B12AA001R>
    <fines-b-ot:B12AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">2498</fines-b-ot:B12AA001R>
    <fines-b-ot:B12AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">27</fines-b-ot:B12AA001R>
    <fines-b-ot:B2AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">0</fines-b-ot:B2AA001R>
    <fines-b-ot:B2AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">0</fines-b-ot:B2AA001R>
    <fines-b-ot:B2AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">0</fines-b-ot:B2AA001R>
    <fines-b-ot:B2AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:B2AA001R>
    <fines-b-ot:B3AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">0</fines-b-ot:B3AA001R>
    <fines-b-ot:B3AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">1</fines-b-ot:B3AA001R>
    </xbrli:xbrl>

    Using 11g along XML indexes can greatly improve this XQuery. We can discuss further offline.
    Regards,
    Geoff

  • XQuery performance in Oracle 10gR2

    Hello
    I'm actually trying to measure the performances of XQuery FLOWR queries on Oracle 10gR2. For that, I've created a simple table with one integer field (ID) and one XMLType field. This XMLType field contains 10000 documents. The size of these documents varies between 2Kb and 14Kb approximately.
    A simple XQuery like below (without "WHERE" or complexe "RETURN" clause) runs quite well and I get the query results in a resonable time.
    SELECT xtab.COLUMN_VALUE
    FROM contractXDraft, XMLTABLE(
         'declare namespace ctxCD="contractX/contractXDraft";for $x in /ctxCD:contractXDraft
         return
         <response>
              Hello
         </response>'
    PASSING OBJECT_VALUE) xtab;
    On the other hand, if a add a "WHERE" clause to filter the results, the query execute time become very long (~hours...) and I must always abort the query execution by killing the "oracle" process because the page file memory used by this process increase linearly ! Here below is represented a such query :
    SELECT xtab.COLUMN_VALUE
    FROM contractXDraft, XMLTABLE(
         'declare namespace ctxCD="contractX/contractXDraft";for $x in /ctxCD:contractXDraft
    where $x/ctxCD:ReferenceDetails/ctxCD:ContractHeaderDetails/ctxCD:ContractNumber = "19163-contract657-2.xml"
         return
         <response>
              Hello
         </response>'
    PASSING OBJECT_VALUE) xtab;
    These above queries are executed on a server dedicated for these tests. This server is a Pentium IV 3.2 GHz with 1GB of RAM and Windows 2003 Server Enterprise SP1 is installed on it.
    I want to know if someone can give me an explanation about this huge difference of execution time between the two queries above ?? Is it a syntax mistake ? Is it an hardware problem ?
    Thank you very much for your help !!
    Regards
    MD

    MD,
    Sounds like your XMLType field is using unstructured storage (i.e., LOB-based) instead of the structured storage (i.e., O-R based). You can check out the XML DB online doc (http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb01int.htm#BABECDCF) to learn more about the differences between the two. Essentially, without any associated indexes, using XQuery over unstructured storage will result in a full table scan, which can be very slow when there are large number of rows.
    Regards,
    Geoff

  • Validate date in Xquery version "1.0" to be used in OSB

    I have a requirement where i have to populate error code and messages if a date is invalid. For which I can use
    xquery version "1.0" encoding "Cp1252";
    (:: pragma bea:global-element-return element="Error" location="../../IDCardStatus/xsd/xsdError.xsd" ::)
    declare namespace xf = "http://tempuri.org/IDCardRequest/xq/DateValidation/";
    declare function xf:DateValidation($date as xs:string)
        as element(Error) {
    <Error>
    {if ((fn:concat(fn:substring($date,1,4),'-',fn:substring($date,5,2),'-',fn:substring($date,7,8))) castable as xs:date)
    then
    else
            <ErrorSeq>
            <ErrorCode>97534</ErrorCode>
      <ErrorMssg></ErrorMssg>
      </ErrorSeq>
    </Error>
    declare variable $date as xs:string external;
    xf:DateValidation($date)
    But castable is not implemented in Oracle Fusion Middleware Xquery implementation and Try Catch can be used if Xquery throughs error but are implemented in xquery version "3.0" and Oracle Fusion Middleware still uses version "1.0". Please Help as its a common requirement in most of the projects i have come along.Thanks in anticipation

    Sorry, I assumed you were using 12c.  OSB 11g supports the XQuery 1.0 W3C Working Draft from 23 July 2004 and also does not include the castable expression.  OSB 12c supports the full XQuery 1.0 recommendation (including the castable expression). 

Maybe you are looking for