Midrange News for the IBM i Community


Posted by: jsaund22
XML-INTO error RNX0353 Reason Code 5
has no ratings.
Published: 31 Aug 2011
Revised: 23 Jan 2013 - 1586 days ago
Last viewed on: 28 May 2017 (6990 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

XML-INTO error RNX0353 Reason Code 5 Published by: jsaund22 on 31 Aug 2011 view comments(12)

I'm new to both this forum and to XML processing with RPG.  I have an XML file that I need to parse, but I keep getting RNX0353 RC5 when running.  I have been running it in debug to confirm that it's working and this error always seems to present itself as an error on the last Product in the XML file.  I have attempted processing files with 3, 4, 5, and 6 products.

 

Here's my code:

  

     D Root            ds                  qualified
     D   Requested_Date...
     D                               10a
     D   Customer_Name...
     D                               40a
     D   Customer_Number...
     D                               10a
     D   Customer_PO...
     D                               20a
     D   ShipTo_Number...
     D                               10a
     D   ShipToAddress_City...
     D                               25a
     D   ShipToAddress_Region...
     D                               10a
     D   Products_Ordered...
     D                                     likeds(Prod_Ord_t)
      *
     D Prod_Ord_t      DS                  qualified
     D                                     based(Template)
     D   Product                           likeds(Product_t)
     D                                     dim(999)
      *
     D Product_t       DS                  qualified
     D                                     based(Template)
     D   Item_Number                 20a
     D   Quantity                    11s 3 
      *
     D IFSPATH         S            100A   Varying
     D Options         S            100A   Varying


      /free
        
        IFSPATH = '/home/xmlfiles/test.xml';

        Options = 'doc=file case=any allowextra=yes +
                   allowmissing=yes trim=none';

        xml-into Root %xml(IFSPATH: options);

      /end-free                   

And here's my XML:

 

<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
 <userinfo></userinfo>
 <Shipping_Condition></Shipping_Condition>
 <Header_PricingConditions></Header_PricingConditions>
 <Header_Notes></Header_Notes>
 <Culture_Code>en-US</Culture_Code>
 <Sales_Area></Sales_Area>
 <Sales_DocumentType>SO</Sales_DocumentType>
 <Sales_Order_Number>C0058699</Sales_Order_Number>
 <Sales_Order_Date>2011-08-16</Sales_Order_Date>
 <Requested_Date>2011-08-17</Requested_Date>
 <Customer_Name>My Company</Customer_Name>
 <Customer_Number>27756</Customer_Number>
 <Sales_Office></Sales_Office>
 <Sales_Group></Sales_Group>
 <Sales_Order_DeliveryBlock></Sales_Order_DeliveryBlock>
 <Sales_Order_BillingBlock></Sales_Order_BillingBlock>
 <ShipTo_Number></ShipTo_Number>
 <ShipTo_Name>My Company</ShipTo_Name>
 <ShipToAddress_Name2/>
 <ShipToAddress_Street>1295 RUE DE LANAUDIERE</ShipToAddress_Street>
 <ShipToAddress_District></ShipToAddress_District>
 <ShipToAddress_PostalCode>J6E 3N9</ShipToAddress_PostalCode>
 <ShipToAddress_City>JOLIETTE,</ShipToAddress_City>
 <ShipToAddress_Region>QC</ShipToAddress_Region>
 <ShipToAddress_Country>CA</ShipToAddress_Country>
 <ShipToAddress_Jurisdiction></ShipToAddress_Jurisdiction>
 <ShipToCapturedAddress>0</ShipToCapturedAddress>
 <OrderConfirmationRecipient>6088280177</OrderConfirmationRecipient>
 <OrderConfirmationComments>Order Confirmation Comments</OrderConfirmationComments>
 <TouchLess>
   <disableTouchlessUpdateReason></disableTouchlessUpdateReason>
   <disableTouchlessUpdate>0</disableTouchlessUpdate>
   <TouchLessError></TouchLessError>
   <AllowTouchLess>0</AllowTouchLess>
   <AllowTouchLessBeforeValidation></AllowTouchLessBeforeValidation>
   <IgnoreWarnings>0</IgnoreWarnings>
   <IgnoreWarningsBeforeValidation></IgnoreWarningsBeforeValidation>
 </TouchLess>
 <Priority_Order>6</Priority_Order>
 <EmbeddedSimulation>0</EmbeddedSimulation>
 <TargetApplication></TargetApplication>
 <EDPMaterialMapping>false</EDPMaterialMapping>
 <Routing>
   <Wanted>false</Wanted>
   <Recipient></Recipient>
   <Message></Message>
 </Routing>
 <SapID></SapID>
 <Credit_Cards></Credit_Cards>
 <Total>899.26</Total>
 <Products_Ordered>
   <Product>
     <Item_Number>BJ9</Item_Number>
     <CustomerMaterialId>GA100</CustomerMaterialId>
     <ItemSaveAutoCorrection></ItemSaveAutoCorrection>
     <AutoCorrectionAction></AutoCorrectionAction>
     <EAN></EAN>
     <Description>9oz BROWN JERSEY, MENS, KW/DZ</Description>
     <Quantity>4</Quantity>
     <Item_Unit>DZ</Item_Unit>
     <Total>31.2</Total>
     <Item_PricingConditions></Item_PricingConditions>
     <Item_Notes></Item_Notes>
     <Requested_Date></Requested_Date>
     <Sales_Area>_</Sales_Area>
     <BillingBlock></BillingBlock>
   </Product>
   <Product>
     <Item_Number>335DTIGM</Item_Number>
     <CustomerMaterialId>GA335DTIGM##</CustomerMaterialId>
     <ItemSaveAutoCorrection></ItemSaveAutoCorrection>
     <AutoCorrectionAction></AutoCorrectionAction>
     <EAN></EAN> 
     <Description>\"PRECISION ARC\"DEER TIG,MD/DZ</Description>
     <Quantity>1</Quantity>
     <Item_Unit>DZ</Item_Unit>
     <Total>78.36</Total>
     <Item_PricingConditions></Item_PricingConditions>
     <Item_Notes></Item_Notes>
     <Requested_Date></Requested_Date>
     <Sales_Area>_</Sales_Area>  
     <BillingBlock></BillingBlock>
   </Product>
   <Product>
     <Item_Number>KKWC14</Item_Number>
     <CustomerMaterialId>GAKKWCI4##</CustomerMaterialId>
     <ItemSaveAutoCorrection></ItemSaveAutoCorrection>
     <AutoCorrectionAction></AutoCorrectionAction>
     <EAN></EAN>
     <Description>14\"DBLD OVER KNTD KVLR SLV/PR</Description>
     <Quantity>12</Quantity>
     <Item_Unit>PR</Item_Unit>
     <Total>57.6</Total>
     <Item_PricingConditions></Item_PricingConditions>
     <Item_Notes></Item_Notes>
     <Requested_Date></Requested_Date>
     <Sales_Area>_</Sales_Area>
     <BillingBlock></BillingBlock>
   </Product>
   <Product>
     <Item_Number>S13FNT-9</Item_Number>
     <CustomerMaterialId>GASI3FNTO9</CustomerMaterialId>
     <ItemSaveAutoCorrection></ItemSaveAutoCorrection>
     <AutoCorrectionAction></AutoCorrectionAction>
     <EAN></EAN>
     <Description>GREY FM NTRL CTD GLV, SZ 9/DZ</Description>
     <Quantity>1</Quantity>
     <Item_Unit>DZ</Item_Unit>
     <Total>18.36</Total>
     <Item_PricingConditions></Item_PricingConditions>
     <Item_Notes></Item_Notes>
     <Requested_Date></Requested_Date>
     <Sales_Area>_</Sales_Area>
     <BillingBlock></BillingBlock>
   </Product>
   <Product>
     <Item_Number>S13PU-9</Item_Number>
     <CustomerMaterialId>GAS13PU9</CustomerMaterialId>
     <ItemSaveAutoCorrection></ItemSaveAutoCorrection>
     <AutoCorrectionAction></AutoCorrectionAction>
     <EAN></EAN>
     <Description>POLYURETHANE,YELLOW CF, 9 /DZ</Description>
     <Quantity>1</Quantity>
     <Item_Unit>DZ</Item_Unit>
     <Total>16.92</Total>
     <Item_PricingConditions></Item_PricingConditions>
     <Item_Notes></Item_Notes>
     <Requested_Date></Requested_Date>
     <Sales_Area>_</Sales_Area>
     <BillingBlock></BillingBlock>
   </Product>
 </Products_Ordered>
</Root>

Any idea what I may be either doing wrong or overlooking?

 

Thanks,

J

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: XML-INTO error RNX0353 Reason Code 5
Posted: 5 years 8 months 27 days 14 hours 22 minutes ago
Edited: Tue, 06 Sep, 2011 at 12:59:39 (2091 days ago)

I could be wrong, but LIKEDS does NOT inherit the DIM(x) value. It does inherit the "DIM" keyword, but not the number of elements you specified, so is probably defaults to 1.

Try changing your final subfield to this and see if it helps:

 

D   Products_Ordered...
D                                     likeds(Prod_Ord_t) DIM(999)
Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: XML-INTO error RNX0353 Reason Code 5
Posted: 5 years 8 months 27 days 14 hours 6 minutes ago

Jamey, you must CONFIRM your membership by clicking on the link in the verification email we sent to you when you signed up for midrangeNews.com otherwise your content will be purged each evening. We've also added a check in the system so that new content can no longer be posted unless you have confirmed your membership.

Posted by: DaleB
Premium member *
Reading, PA
Comment on: XML-INTO error RNX0353 Reason Code 5
Posted: 5 years 8 months 27 days 13 hours 37 minutes ago

Sounds right, Bob; LIKEDS does not inherit DIM. But Prod_Ord_t is not a DIM'ed DS; the DIM(999) is on a subfield, so that's probably OK the way it is.

RNX0353 reason code 5 is that "The XML document contains extra XML attributes or elements that do not match subfields." J, the additional message text should tell you which subfield for which the error was detected.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: XML-INTO error RNX0353 Reason Code 5
Posted: 5 years 8 months 27 days 13 hours 16 minutes ago

Good catch dale. I completely missed that.

Posted by: jsaund22
Premium member *
Comment on: XML-INTO error RNX0353 Reason Code 5
Posted: 5 years 8 months 27 days 12 hours 10 minutes ago
Edited: Thu, 01 Sep, 2011 at 10:44:28 (2096 days ago)

Thanks for the help.  Here's the error message:

 

Message . . . . :   The XML document does not match the RPG variable; reason
  code 5.
Cause . . . . . :   While parsing an XML document, the parser found that the
  XML document does not correspond to RPG variable root and the options do not
  allow for this. The reason code is 5. The exact subfield for which the error
  was detected is root.products_ordered.product(5). The options are "doc=file
  case=any allowextra=yes allowmissing=yes trim=none". The XML document name
  is /home/xmlfiles/test.xml; *N indicates that the XML document was not an
  external file.

 

...and here's the debug view of the Root data structure:

 

> EVAL root
ROOT.REQUESTED_DATE = '2011-08-17'
ROOT.CUSTOMER_NAME = 'My Company '
ROOT.CUSTOMER_NUMBER = '27756 '
ROOT.SHIPTO_NUMBER = ' '
ROOT.SHIPTOADDRESS_CITY = 'JOLIETTE, '
ROOT.SHIPTOADDRESS_REGION = 'QC '
ROOT.PRODUCTS_ORDERED.PRODUCT.ITEM_NUMBER(1) = 'BJ9 '
ROOT.PRODUCTS_ORDERED.PRODUCT.QUANTITY(1) = 00000004.000
ROOT.PRODUCTS_ORDERED.PRODUCT.ITEM_NUMBER(2) = '335DTIGM '
ROOT.PRODUCTS_ORDERED.PRODUCT.QUANTITY(2) = 00000001.000
ROOT.PRODUCTS_ORDERED.PRODUCT.ITEM_NUMBER(3) = 'KKWC14 '
ROOT.PRODUCTS_ORDERED.PRODUCT.QUANTITY(3) = 00000012.000
ROOT.PRODUCTS_ORDERED.PRODUCT.ITEM_NUMBER(4) = 'S13FNT-9 '
ROOT.PRODUCTS_ORDERED.PRODUCT.QUANTITY(4) = 00000001.000
ROOT.PRODUCTS_ORDERED.PRODUCT.ITEM_NUMBER(5) = 'S13PU-9 '
ROOT.PRODUCTS_ORDERED.PRODUCT.QUANTITY(5) = 00000001.000
ROOT.PRODUCTS_ORDERED.PRODUCT.ITEM_NUMBER(6) = ' '
ROOT.PRODUCTS_ORDERED.PRODUCT.QUANTITY(6) = .
ROOT.PRODUCTS_ORDERED.PRODUCT.ITEM_NUMBER(7) = ' '
ROOT.PRODUCTS_ORDERED.PRODUCT.QUANTITY(7) = .

So it appears that each product is being populated properly, I'm just not sure why the error is presenting itself. 

 

If I run this over an XML with three products, it errors on the third element of the Product array DS.  If I use a 6-product XML, it errors on the 6th element.

 

I'm going to whittle out all the extraneous information in the XML to see if it still gives me an error with only the elements that I'm trying to parse out.  I'll let you know how it goes.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: XML-INTO error RNX0353 Reason Code 5
Posted: 5 years 8 months 27 days 11 hours 30 minutes ago
Edited: Thu, 01 Sep, 2011 at 12:00:12 (2096 days ago)

XML Escaping

XML provides escape facilities for including characters which are problematic to include directly. For example:

" = &quot;
' = &apos;
> = &gt;
< = &lt;
& = &amp;

Can the provider of the XML to your system encode/escape the XML symbols?

Of course, first check to see if that will work by removing them from the data in the product de!--script--ion and other locations and see if it works for you.

Posted by: DaleB
Premium member *
Reading, PA
Comment on: XML-INTO error RNX0353 Reason Code 5
Posted: 5 years 8 months 27 days 11 hours 13 minutes ago
Edited: Thu, 01 Sep, 2011 at 11:36:31 (2096 days ago)

I'm no XML expert; the element names are all case sensitive, right? You have "root" and "/Root". I copied your excerpt and tried locally, and got the same error. When I changed the file to "/root", I didn't get any errors.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: XML-INTO error RNX0353 Reason Code 5
Posted: 5 years 8 months 27 days 10 hours 53 minutes ago

Yes and No Dale. XML is case-sensitive, but with the case=any option, the tag name's letter case is ignored--however this is frowned upon. Better to use all lower or all uppercase tag names, but if you're given mixed, you have to use the (much) slower case=any option instead of case=lower or case=upper

Posted by: jsaund22
Premium member *
Comment on: XML-INTO error RNX0353 Reason Code 5
Posted: 5 years 8 months 27 days 10 hours 41 minutes ago

Thanks Dale!

 

You were right -- the beginning and ending Root tags didn't match.  I edited the XML to make the tags <Root> and </Root> and it worked perfectly!

 

Thanks for the help, I don't think I would've found that myself for quite a long time.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: XML-INTO error RNX0353 Reason Code 5
Posted: 5 years 8 months 27 days 10 hours 36 minutes ago

So what we've (well I have anyway) discovered here is that even with case=any, the XML tag names must have matching upper/lowercase letters. I wonder if that's a feature or a bug?

Posted by: jsaund22
Premium member *
Comment on: XML-INTO error RNX0353 Reason Code 5
Posted: 5 years 8 months 27 days 10 hours 14 minutes ago

That's a requirement of XML, so I don't think the RPG XML processor can be blamed.  I just never thought to look to make sure that the case matched.  Sometimes it just takes another set of eyes.

Posted by: DaleB
Premium member *
Reading, PA
Comment on: XML-INTO error RNX0353 Reason Code 5
Posted: 5 years 8 months 27 days 8 hours 45 minutes ago

I think the case=any applies to how the XML elements compare to the RPG field names. So if you have "Product" in the XML, your RPG field could be "Product", "PRODUCT", "product", or even "pRodUcT".