Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 10482

Parsing XML File in ABAP

$
0
0

Hello,

 

an existiting abap program receives a XML String over http and it creates a dom structure of it by using .

Now I want to use the same technique for an other xml file, which is formed based on an other xsd file.

 

When I do sent this to the service the parse_string method returns a value of 1 which is not ok.

The code snippet and the xml file is below.

Do I have to save the xsd File somewher or provide it elsewhere, or what can be the eror here.

my xml Fiel starts with

<epcis:EPCISDocument xmlns:epcis="urn:epcglobal:epcis:xsd:1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" creationDate="2005-07-11T11:30:47.0Z" schemaVersion="1">

 

Best regards

Michael

 

 

data:

        lref_xmldoc         TYPE REF TO cl_xml_document_base,

        lv_retcode          TYPE sysubrc,

 

CREATE OBJECT lref_xmldoc.
*   parse payload as XML
    lv_retcode = lref_xmldoc->parse_string( stream = lv_cdata ).
    lv_isinitial = lref_xmldoc->is_initial( ).

    IF lv_retcode = lref_xmldoc->c_ok AND
       lv_isinitial IS INITIAL.

      lref_xmlnode = lref_xmldoc->m_document->get_root_element( ).

....

 

     endif.

 

here is the xml document.

 

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<epcis:EPCISDocument

xmlns:epcis="urn:epcglobal:epcis:xsd:1"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

creationDate="2005-07-11T11:30:47.0Z"

schemaVersion="1">

<EPCISBody>

<EventList>

<ObjectEvent>

<eventTime>2005-04-03T20:33:31.116-06:00</eventTime>

<eventTimeZoneOffset>-06:00</eventTimeZoneOffset>

<epcList>

<epc>urn:epc:id:sgtin:0614141.107346.2017</epc>

</epcList><action>OBSERVE</action>

<bizStep>urn:epcglobal:epcis:bizstep:fmcg:shipped</bizStep>

<disposition>urn:epcglobal:epcis:disp:fmcg:unknown</disposition>

<readPoint>

<id>urn:epc:id:sgln:0614141.07346.1234</id>

</readPoint>

<bizLocation>

<id>urn:epcglobal:fmcg:loc:0614141073467.A23-49</id>

</bizLocation>

<bizTransactionList>

<bizTransaction type="urn:epcglobal:fmcg:btt:po">http://transaction.acme.com/po/12345678</bizTransaction>

</bizTransactionList>

</ObjectEvent>

<ObjectEvent>

<eventTime>2005-04-04T20:33:31.116-06:00</eventTime>

<eventTimeZoneOffset>-06:00</eventTimeZoneOffset>

<epcList>

<epc>urn:epc:id:sgtin:0614141.107346.2018</epc>

</epcList>

<action>OBSERVE</action>

<bizStep>urn:epcglobal:epcis:bizstep:fmcg:received</bizStep>

<disposition>urn:epcglobal:epcis:disp:fmcg:processing</disposition>

<readPoint>

<id>urn:epcglobal:fmcg:loc:0614141073467.RP-1529</id>

</readPoint>

<bizLocation>

<id>urn:epcglobal:fmcg:loc:0614141073467.A23-49-shelf1234</id>

</bizLocation>

<bizTransactionList>

<bizTransaction type="urn:epcglobal:fmcg:btt:po">http://transaction.acme.com/po/12345678</bizTransaction>

<bizTransaction type="urn:epcglobal:fmcg:btt:asn">http://transaction.acme.com/asn/1152</bizTransaction>

</bizTransactionList>

</ObjectEvent>

</EventList>

</EPCISBody>

</epcis:EPCISDocument>


Viewing all articles
Browse latest Browse all 10482

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>