Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Stuck with reading XML -- Wrong namespace?

MarwimFeb 4 2019 — edited Feb 5 2019

It seems to be easy to read this XML but somehow I can't get further than '/ns2:ELMAKM/ns2:ELMAKOM' - When I try to read the next element '/ns2:ELMAKM/ns2:ELMAKOM/ELMAVerfahren'

I get no row

WITH tax AS (

SELECT XMLTYPE(q'[<?xml version="1.0" encoding="ISO-8859-15" standalone='yes'?>

<ns2:ELMAKM xmlns:ns6="http://www.itzbund.de/kista/kmkw/01.01"

    xmlns:ns5="http://www.itzbund.de/kista/std/01.01"

    xmlns:ns7="http://www.elster.de/elsterxml/schema/v11"

    xmlns:ns2="http://www.itzbund.de/ELAN/01"

    xmlns:ns4="http://www.itzbund.de/kontenwahrheit/01.00"

    xmlns:ns3="http://www.itzbund.de/kista/km/01.01">

  <ns2:ELMAKOM>

    <ELMAHeader>

      <DatenArt>ELMA_KMRM</DatenArt>

      <ns2:AuthSteuernummer>BZ100281794</ns2:AuthSteuernummer>

      <ns2:AccountID>1006139260</ns2:AccountID>

      <ns2:ErstellungsDatum>2019-01-28T23:14:32.589+01:00</ns2:ErstellungsDatum>

      <ns2:KundeneigeneID>1</ns2:KundeneigeneID>

    </ELMAHeader>

    <ELMAVerfahren>

      <ns6:KISTAKM version="3.0">

        <ns3:KISTA_KM_ANTW OrdBegriff="My Company" UUID="113413ae">

          <ns3:Anfragender_DL Zulassungsnummer="123"/>

          <ns3:Anfragender Zulassungsnummer="234"/>

          <ns3:Antwort xsi:type="ns3:AntwortArt3" KdOrdBegriff="1842757" UUID="113413ae" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

            <ns3:ReturnCode>01</ns3:ReturnCode>

            <ns3:Anlass Grund="1" Datum="2019-01-25+01:00"/>

            <ns3:PersAngabe>

              <ns3:Person>

                <ns5:NName>ABC</ns5:NName>

                <ns5:VName>Ptr</ns5:VName>

                <ns5:GebDt>1984-05-26</ns5:GebDt>

              </ns3:Person>

              <ns3:Adresse xsi:type="ns5:InlandsAdresse">

                <ns5:Str>Heimat</ns5:Str>

                <ns5:HausNr>26</ns5:HausNr>

                <ns5:Ort>MyPlace</ns5:Ort>

                <ns5:Plz>12345</ns5:Plz>

              </ns3:Adresse>

            </ns3:PersAngabe>

          </ns3:Antwort>

        </ns3:KISTA_KM_ANTW>

      </ns6:KISTAKM>

    </ELMAVerfahren>

  </ns2:ELMAKOM>

</ns2:ELMAKM>stx_dokument

FROM dual

)

SELECT  elma.x.getClobVal()

FROM    tax

       ,XMLTABLE(

            XMLNAMESPACES(

                 DEFAULT 'http://www.itzbund.de/ELAN/01'

                ,'http://www.itzbund.de/ELAN/01' AS "ns2"               --war "elan"

                ,'http://www.itzbund.de/kista/km/01.01' AS "ns3"        --war "elma0"

                ,'http://www.itzbund.de/kontenwahrheit/01.00' AS "ns4"  --war "kw"

                ,'http://www.itzbund.de/kista/std/01.01'  AS  "ns5"     --war "k"

                ,'http://www.itzbund.de/kista/kmkw/01.01'  AS "ns6"     --war "kmkw"

                ,'http://www.elster.de/elsterxml/schema/v11' AS "ns7"

                ),

              '/ns2:ELMAKM/ns2:ELMAKOM'--/ELMAVerfahren'--/ns6:KISTAKM'--/ns3:KISTA_KM_ANTW/ns3:Antwort'

            PASSING tax.stx_dokument

            COLUMNS

            x XMLTYPE PATH '/'

            ) elma

Is it because ELMAVerfahren is defined in ns2 but used without a prefix ? - That's why I used the ELAN/01 namespace as default, too.

Regards

Marcus

This post has been answered by cormaco on Feb 4 2019
Jump to Answer
Comments
Post Details
Added on Feb 4 2019
2 comments
1,078 views