Skip to Main Content

Database Software

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!

Extract value from xml (LPX-00601: Invalid token)

PeterValencicOct 2 2015 — edited Oct 2 2015

Hi,

I have this kind of XML / example..

declare

    l_clob clob;

    l_xml xmltype;

begin

    l_clob := '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:fu="http://www.fu.gov.si/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <soapenv:Body>

        <fu:BusinessPremiseResponse Id="data">

            <fu:Header>

                <fu:DateTime>2015-10-02T10:56:40.416Z</fu:DateTime>

                <fu:MessageID>2107C422-FC85-291C-E053-0CC910AC3C4F</fu:MessageID>

            </fu:Header>

            <fu:Error>

                <fu:ErrorCode>S001</fu:ErrorCode>

                <fu:ErrorMessage>eriworwiweorioweriorio</fu:ErrorMessage>

            </fu:Error>

        </fu:BusinessPremiseResponse>

    </soapenv:Body>

</soapenv:Envelope>

';

l_xml := xmltype(l_clob);

  put_xl_line(l_xml.extract('/soapenv:Envelope/soapenv:Body/fu:BusinessPremiseResponse/fu:Error/fu:ErrorCode/text()','xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"').getStringVal());

end;

what I want is to extract /soapenv:Envelope/soapenv:Body/fu:BusinessPremiseResponse/fu:Error/fu:ErrorCode

I get this kind of error:

ORA-31011: XML parsing failed

ORA-19202: Error occurred in XML processing

LPX-00601: Invalid token in: '/soapenv:Envelope/soapenv:Body/fu:BusinessPremiseResponse/fu:Error/fu:ErrorCode/text()'

ORA-06512: at "SYS.XMLTYPE", line 107

ORA-06512: at line 23

thank you

This post has been answered by odie_63 on Oct 2 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 30 2015
Added on Oct 2 2015
2 comments
5,496 views