classAnova - Knowledge Shared


Posted by: Bob Cozzi
IT Researcher
Cozzi Productions, Inc.
North Aurora, IL
Bob Cozzi's RPG IV Cheat Sheets
has no ratings.
Published: 08 Feb 2011
Revised: 04 Aug 2011 - 3023 days ago
Last viewed on: 13 Nov 2019 (18270 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.

Bob Cozzi's RPG IV Cheat Sheets Published by: Bob Cozzi on 08 Feb 2011 view comments

RPG XML-INTO Error Codes

To cause the XML-INTO operation code in RPG IV to return one of the following error codes, you must do the following:

  • Specify the (E) operation extender (see example) when issuing XML-INTO.
  • Check the value of %ERROR() after XML-INTO returns.
  • If %ERROR() = *ON, then check the value of %STATUS.
  • If %STATUS() = 351, then the Program Status Data Structure (PSDS) contains one of the XML Parser Error Code listed in the table below.

Example RPG IV XML Error Code Detection:

     D PSDS           SDS                  Qualified 
     D  xmlError                     10I 0 Overlay(PSDS:368)
      /free
           xml-into(e) myfield %XML(ifsFile : 'doc=file');
           if %error();
              if %status() = 351;
                 joblog('XML-INTO returned error %s':%char(psds.XMLERROR));
                 return;
              endif
           endif
      /end-free

For status 00351, the return code from the parser will be placed in the subfield ″External return code″ in positions 368-371 of the PSDS. This subfield will be set to zero at the beginning of the operation and set to the value returned by the parser at the end of the operation.

XML Parser Error Code Description
1 The parser found an invalid character while scanning white space outside element content.
2 The parser found an invalid start of a processing instruction, element, comment, or document type declaration outside element content.
3 The parser found a duplicate attribute name.
4 The parser found the markup character '<' in an attribute value.
5 The start and end tag names of an element did not match.
6 The parser found an invalid character in element content.
7 The parser found an invalid start of an element, comment, processing instruction, or CDATA section in element content.
8 The parser found in element content the CDATA closing character sequence ']]>' without the matching opening character sequence ''.
11 The parser found an invalid character in a processing instruction data segment.
12 A processing instruction target name was 'xml' in lowercase, uppercase or mixed case.
13 The parser found an invalid digit in a hexadecimal character reference.
14 The parser found an invalid digit in a decimal character reference (of the form &#dddd;).
15 A character reference did not refer to a legal XML character.
16 The parser found an invalid character in an entity reference name.
17 The parser found an invalid character in an attribute value.
18 The parser found a possible invalid start of a document type declaration.
19 The parser found a second document type declaration.
20 An element name was not specified correctly. The first character was not a letter, '_', or ':', or the parser found an invalid character either in or following the element name.
21 An attribute was not specified correctly. The first character of the attribute name was not a letter, '_', or ':', or a character other than '=' was found following the attribute name, or one of the delimiters of the value was not correct, or an invalid character was found in or following the name.
22 An empty element tag was not terminated by a '>' following the '/'.
23 The element end tag was not specified correctly. The first character was not a letter, '_', or ':', or the tag was not terminated by '>'.
24 The parser found an invalid start of a comment or CDATA section in element content.
25 A processing instruction target name was not specified correctly. The first character of the processing instruction target name was not a letter, '_', or ':', or the parser found an invalid character in or following the processing instruction target name.
26 A processing instruction was not terminated by the closing character sequence '?>'.
27 The parser found an invalid character following '&' in a character reference or entity reference.
28 The version information was not present in the XML declaration.
29 The 'version' in the XML declaration was not specified correctly. 'version' was not followed by '=', or the value was missing or improperly delimited, or the value specified a bad character, or the start and end delimiters did not match, or the parser found an invalid character following the version information value closing delimiter in the XML declaration.
30 The parser found an invalid attribute instead of the optional encoding declaration in the XML declaration.
31 The encoding declaration value in the XML declaration was missing or incorrect. The value did not begin with lowercase or uppercase A through Z, or 'encoding' was not followed by '=', or the value was missing or improperly delimited or it specified a bad character, or the start and end delimiters did not match, or the parser found an invalid character following the closing delimiter.
32 The parser found an invalid attribute instead of the optional standalone declaration in the XML declaration.
33 The 'standalone' attribute in the XML declaration was not specified correctly. 'standalone' was not followed by a '=', or the value was either missing or improperly delimited, or the value was neither 'yes' nor 'no', or the value specified a bad character, or the start and end delimiters did not match, or the parser found an invalid character following the closing delimiter.
34 The XML declaration was not terminated by the proper character sequence '?>', or contained an invalid attribute.
35 The parser found the start of a document type declaration after the end of the root element.
36 The parser found the start of an element after the end of the root element.
300 The parser reached the end of the document before the document was complete.
301 The %HANDLER procedure for XML-INTO or XML-SAX returned a non-zero value, causing the XML parsing to end.
302 The parser does not support the requested CCSID value or the first character of the XML document was not '<'.
303 The document was too large for the parser to handle. The parser attempted to parse the incomplete document, but the data at the end of the document was necessary for the parsing to complete.
500-999 Internal error in the external parser. Please report the error to your service representative.
10001-19999 Internal error in the parser. Please report the error to your service representative.

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

COMMENTS