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!

Parsing values in an undeclared namespace xmlns=""

256287Jun 14 2010 — edited Jun 14 2010
I'm having difficulties extracting values from a web service SOAP response (below) . As best as I can tell the Oracle XML parser does not like undeclared namespaces? Specifically in our service response the summaryInfo element has an undeclared namespace (see xmlns="" beside the <summaryInfo> element ). When I remove this from the response the Oracle parser is able to extract it's element value correctly.
SQL> select * from V$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE    11.1.0.7.0      Production
TNS for Linux: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
 Service Response 
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
    <getSummaryInfoResponse xmlns="http://abc.com/">
      <summaryInfo xmlns="">
        <totalPayments>148</totalPayments>
        <lastPaymentDate>04/19/2010</lastPaymentDate>
        <currentBalance>37</currentBalance>
        <lastPaymentAmount>37</lastPaymentAmount>
      </summaryInfo>
    </getSummaryInfoResponse>
  </S:Body>
  </S:Envelope>
So in Oracle this will NOT return the totalPayments node:
 SELECT EXTRACTVALUE (VALUE (t),
                     '/*/totalPayments',
                     'xmlns="http://abc.com/" xmlns=""'
                    ) "totalPayments",
       VALUE (t).getstringval () "payload"
  FROM DUAL c,
       TABLE
          (XMLSEQUENCE
              (EXTRACT
                  (XMLTYPE.createxml
                      ('
    <getSummaryInfoResponse xmlns="http://abc.com/" elementFormDefault="qualified">
      <summaryInfo xmlns="">
        <totalPayments>148</totalPayments>
        <lastPaymentDate>04/19/2010</lastPaymentDate>
        <currentBalance>37</currentBalance>
        <lastPaymentAmount>37</lastPaymentAmount>
      </summaryInfo>
    </getSummaryInfoResponse>'
                      ),
                   '//summaryInfo',
                   'xmlns="http://abc.com/" xmlns=""'
                  )
              )
          ) t
However, when removing xmlns="" it will correctly return the totalyPayments node value of 148.

What am I missing in my syntax?

Edited by: rnanton on Jun 14, 2010 10:53 AM
This post has been answered by Jason_(A_Non) on Jun 14 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 12 2010
Added on Jun 14 2010
1 comment
1,524 views