Using XML-into in RPG getting error

15 pts.
Tags:
RPG
XML
Hello.. I am having an issue using xml-into when my xml has only an ending tag. I am receiving error "XML document does not match RPG variable". The vendor sending the xml file to me states it is still valid xml and should not cause error. How can I get around this error using xml-into. My xml looks like this..
<?xml version="1.0"?>
<estimate>
  <stage>prod</stage>
  <dealerId>83802</dealerId>
  <estimateId>10392829</estimateId>
  <vin>5PVNV8JV7H4S56947</vin>
  <mileage>57042</mileage>
  <roNumber>61520</roNumber>
  <createdOn>2018-10-01 15:45:27 UTC</createdOn>
  <items>
    <item>
      <lineNumber>15587271</lineNumber>
      <opcode>HINO-RR-000-0010</opcode>
      <laborTime/>
      <complaint>CAME IN FOR RECALL AA8Z0</complaint>
      <cause>PERFORMED RECALL</cause>
      <correction>COMPLETED RECALL</correction>
      <warranty>Y</warranty>
      <policy>N</policy>
      <variation/>
      <parts/>
    </item>
  </items>
</estimate>
and my xml-into looks like this -
XML-INTO estimate %XML(%trim(Pathp1) : 'doc=file path=estimate + case=any allowextra=yes allowmissing=yes + ns=remove countprefix=cnt');
I believe I get the error because <laborTime/> and <parts/> are only ending tags with no beginning tags. I used the allowmissing=yes thinking that would help but still getting error.
Thank you
1

Answer Wiki

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

Check out this older post from this site on the issue HERE it’s from 2010 but addresses the issue.

Discuss This Question: 3  Replies

 
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.
  • TheRealRaven
    You didn't include the message ID, so it's not certain. It appears to be RNQ0353. What did you find when took the 'Recovery' steps given in the message?
    33,670 pointsBadges:
    report
  • clauinger
    Yes the message id is RNQ0353. The recovery steps said you needed to either fix the xml or add allowmissing=Yes to the xml-into statement. I already had the allowmissing=Yes in the xml-statement and the xml is ok. When I searched internet to see if it was valid to have only ending tags, it said yes it was. For instance the   <laborTime/> only was valid xml. So I am not sure why it thinks the xml is not matching RPG variable. Also my data structure is defined as

    estimate        DS                  Qualified            
    d  stage                        20                         
    d  dealerId                     10                         
    d  estimateId                   10                         
    d  vin                          20                         
    d  mileage                       7  0                      
    d  roNumber                     10                         
    d  createdOn                    20                         
    d  items                              LikeDS(items)        
                                                               
    d  items          DS                  Qualified            
    d   item                              LikeDS(item)         
    d                                     Dim(20)              
                                                               
    d  item           DS                  Qualified            
    d   lineNumber                  10                         
    d   opcode                      10                         
    d   laborTime                    7  1                      
    d   complaint                  432                         
    d   cause                      432                         
    d   correction                 432                       
    d   warranty                     1                       
    d   policy                       1                       
    d   variation                   10                       
    d   parts                             LikeDS(parts)      
                                                             
    d  parts          DS                  Qualified          
    d   part                              LikeDS(part)       
    d                                     Dim(99)            
                                                             
    d  part           DS                  Qualified          
    d   partNumber                  20                       
    d   quantity                     7  1                    
    d   unitPrice                   11  1                    

    15 pointsBadges:
    report
  • GregManzo
    Technically <laborTime/> is not an ending tag, it's a closed tag. It's the same as having begin & end with nothing between, ie: <laborTime></laborTime> and yes, it is valid XML. But that doesn't explain your error.
    I've always preferred XML-SAX over XML-INTO because it gives me more control, so I'm not 100% sure but willing to have a guess.
    I notice you have some data elements that are too big for your variables, eg: createdOn & opcode. Can you try making them bigger & see if it helps?
    2,950 pointsBadges:
    report

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.

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

Following

Share this item with your network: