xml-into problem

15 pts.
Tags:
I want to process an xml file from the IFS in an RPG program, but always get "The XML parser detected error code 302." Nothing I do seems to fix the problem. I checked the XML-file with WRKLNK, it is ccsid 1208 (utf-8) and the first character is 3C (<). Job ccsid is 65535. Iseries release V5R4.
Any help would be much appreciated!

File and program code as follows: 

XML-file:
        
                                                
    createInvoice        
    1                
    3                            
    1                              
                                               

RPG-program:
H Debug                                                 
H Datfmt(*ISO)                                          
H Datedit(*YMD)                                         
H Option(*srcstmt)                                      
H Indent('|')                                           
H DftActGrp(*NO)                                        
                                                        
d xmlfile         s           6000a   varying           
d xmlopt          s            100a   varying           
d divider         s             52a                            
                                                               
d BusinessEvent   ds                  qualified                
d                                     based(Template)          
d  BusinessEventType...                                        
d                               30a                            
d  BusinessEventTypeId...                                      
d                                1s 0                          
d  SendingSystem...                                            
d                                1s 0                          
d  SalesChannel...                                             
d                                1s 0                          
                                                               
 /free                                                         
  xmlfile  = '/TEST/FILE.xml';      
  xmlopt =  'doc=string case=any allowextra=yes allowmissing=yes';                                        
  xml-into BusinessEvent %xml(%trim(xmlfile): xmlopt);               
  *inlr = *on;                                                       
/End-free                                                                                                          


Software/Hardware used:
V5R4
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 4  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.
  • BestUM
    Error in copy/pasting the xml file content. The following is correct.
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>          
    <BusinessEvent>                                                  
        <BusinessEventType>createInvoice</BusinessEventType>         
        <BusinessEventTypeId>1</BusinessEventTypeId>                 
        <SendingSystem>3</SendingSystem>                             
        <SalesChannel>1</SalesChannel>                               
    </BusinessEvent>                                                 
    15 pointsBadges:
    report
  • TomLiotta

    From the V5R4 ILE RPG Programmer's Guide:

    • The parser does not support every CCSID. If your job CCSID is one |of the CCSIDs that the parser does not handle, you must parse your document in |UCS-2. |
    • |The following EBCDIC CCSIDs are supported: 1047, 37, 1140, 273, |1141, 277, 1142, 278, 1143, 280, 1144, 284, 1145, 285, 1146, 297, 1147, 500, |1148, 871, and 1149.
    • |The following ASCII CCSIDs are supported: 819, 813, 920.
    • |The following Unicode CCSIDs are supported: 1200, 13488, |17584.

    UTF8 (CCSID 1208) is not listed as supported by the ILE RPG language built-in XML-INTO operation code. When an unsupported CCSID is encountered, error code 302 is thrown.

    Also, a job CCSID of 65535 is just asking for trouble. Use the appropriate CCSID if you're going to be doing any kind of character conversions at all. CCSID 65535 is 'binary; no character conversion'.

    Tom

    125,585 pointsBadges:
    report
  • PeteD123
    Hello,
    This is an old thread but I have had a similar problem in 2018 and am replying to update a statement about ccsid 1208. XML-INTO (v7r2) is able to read ccsid 1208 (utf-8) encoded files and that is not longer a problem. However, job ccsid 65635 would probably be trouble ... I use ccsid 37 (native EBCDIC) and this combination worked for XML-INTO while 819 (ASCII) to 37 (EBCDIC) did not for the data I was using.
    10 pointsBadges:
    report
  • TheRealRaven
    Yes, by definition, CCSID says that no translation should happen. It's for binary files, not text. After all the years for this line of systems, it's hard to grasp why there are sites still running with CCSID 65535 as the default setting.
    35,980 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: