XML-INTO – No data retrieved

10 pts.
Tags:
RPG
XML
XML Parser Messages
Hi, I am trying to read the contents of an XML file that resides on the IFS in folder XMLTEST. My program runs without error but does not retrieve any data. If I remove the AllowExtra and AllowMissing keywords I get error RNQ0353 XML document does not match RPG variable, reason code 5.

Any ideas would be appreciated. Thanks.

This is my XML

<?xml version="1.0" ?>

<Document>

<WLWTIFXX><TFROOM>WGHSTAT1SX</TFROOM></WLWTIFXX>

</Document>

[document][/document][wlwtifxx][/wlwtifxx][tfroom][/tfroom][tfroom][/tfroom][wlwtifxx][/wlwtifxx][document][/document]This is my RPGLE code

D WLWTIFXX        DS                  QUALIFIED              D                                     DIM(999)               D AllFields                           LikeDS(All_Fields)                                                                  D All_Fields      DS                  QUALIFIED              D                                     Based(Template)        D  TFROOM                       10A                         

D Xmlfile         S           1000A   Varying 

/free                                                                                             xmlfile = '/XMLTEST/WLWTIF.XML';                                                                xml-into WLWTIFXX %xml(xmlfile: 'DOC=file  +    path=Document/WLWTIFXX +                        case=any      +                                 allowextra=yes +                                allowmissing=yes');                                                                          

  *Inlr = *On;               /end-free    

 



Software/Hardware used:
V5R4

Answer Wiki

Thanks. We'll let you know when a new response is added.

According to the ILE RPG Language Reference:

When the RPG variable is an array or array of data structures, or when the %HANDLER built-in function is specified, the XML elements corresponding to the array elements are expected to be contained in another XML element. By default, the XML elements will be expected to be child elements of the outermost XML element in the document. The path option can be used to specify the exact path to the XML elements corresponding to the array elements. For example, if the outermost XML element is named “transaction”, and it has a child element named “parts” which itself has several child elements named “part”, then to read the “part” XML elements into an array, you would specify the option ‘path=transaction/parts/part’.

<transaction>
<parts>
<part type = “bracket” size=”15″ num=”100″/>
<part type=”frame” size=”2″ num=”500″/>
</parts>
<transaction>

When the XML document does not match the RPG variable, for example if the XML document does not contain the default or specified path, or if it is missing some XML elements or attributes to match the subfields of an RPG data structure, the XML-INTO operation will fail with status 00353. The allowextra and allowmissing options can be used to specify whether an XML element can have more or less data than is required to fully set the RPG variable.

The way I read that, it means your <i>path</i> parameter should read “Document/WLWTIFXX/TFROOM”. Have you tried that?

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following