2 Replies Latest reply: Nov 29, 2012 11:29 PM by RameshkumarT RSS

    XML with multiple namespaces

    RameshkumarT
      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 wrong
        • 1. Re: XML with multiple namespaces
          Jason_(A_Non)
          The Content and record nodes fall into the default namespace of their parent so you will need to include the namespace references in the XPath as well. Below should be the correct XPath statement for you to use.
          Not tested
          '/n1:Document/n1:Content/n2:ExportXML/n2:record'
          • 2. Re: XML with multiple namespaces
            RameshkumarT
            This 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