PLSQL read value from XML (Again)?
I posted a while ago a question about how to read values from XML, and there was a perfect answer, it was so neat and so simple yet I can not understand it and apply it on some other XML!!!
can some one help me with this one? I need to read the "id" or the "ChangeKey"
<soap:Envelope>
<soap:Header>
<t:ServerVersionInfo MajorVersion="8" MinorVersion="2" MajorBuildNumber="217" MinorBuildNumber="0"/>
</soap:Header>
<soap:Body>
<m:CreateItemResponse>
&开发者_开发百科lt;m:ResponseMessages>
<m:CreateItemResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Items>
<t:CalendarItem>
<t:ItemId Id="erwrweff3424dfw23r2fwfwsfwsfg34fwdf2" ChangeKey="sdfwwerw4224rw"/>
</t:CalendarItem>
</m:Items>
</m:CreateItemResponseMessage>
</m:ResponseMessages>
</m:CreateItemResponse>
</soap:Body>
</soap:Envelope>
I really don't feel good because I'm not able to understanding it!
Do the same thing as in the answer you referenced, but change the XPath expression (second argument to XMLTYPE) from
'//SOAProxyResult'
to e.g.
'//t:ItemId/@Id'
or
'//t:ItemId/@ChangeKey'
The third argument will need to declare the t namespace prefix:
'xmlns:t="foobarbaz"'
and of course your input XML will need to declare that namespace prefix too.
精彩评论