XML Parsing Error : How to Interpret What the Machine is Telling You

XML Parsing ErrorXML, HTML, CSS, JavaScript – all of these languages work together to make the complex web pages we see today. XML or Extensible Markup Language is used to store and transport data. It complements HTML which is used to display the data. XML is commonly used to transmit data between different kinds of applications. We walk you through XML Parsing error codes and what they mean. We assume you have a basic web development background. If not, you may first want to take this course to get started with web development

What is XML Parser

An XML parser processes and evaluates the XML code. Without a parser, the code written by you cannot be understood by the computer. Parsers come in a variety of formats and styles. They could be free-standing software, modules, classes and libraries. HTML parsing is somewhat similar. You learn more about HTML parsing and how HTML displays the data in this course.

  • Where do I find a parser? Normally, you won’t need to find a parser. Modern day browsers such as Firefox,incorporate XML parsers.
  • Mechanism of XML parser: Parsers convert code into something that the hardware will recognize. Objective of parsers is to transform XML into a readable code.

Kinds of XML Parsers

There are two kinds of parsers – ones that validate and the ones that don’t. Also keep in mind that you have to follow the rules. This includes root elements, nesting and a declaration statement. Parsers which validate compare a set of specific rules corresponding to each XML file. While a non-validating parser quickly checks the code to ensure that you have all the basics. However, a validating parser looks deeper.

  • Standalone XML Parsers

As the name suggests, standalone parsers are separate packages that only parse XML.They are useful if you need to parse code locally or without a server package or editor. They are not so frequently used as most editing software will have a built in parser.

  • XML Parsing Error

If the XML parser finds an error in the xml document during parsing, message RNX0351 is issued. From the message you can get the specific error code corresponding to the error as well as the offset in the document where the error was found.

XML Parser Error CodeDescription
1The parser detected an invalid character when scanning white space outside element content.
2The parser detected an invalid start of a processing instruction, element, comment, or document type declaration outside element content.
3The parser detected a duplicate attribute name.
4The parser detected the markup character ‘<‘ in an attribute value.
5The start and end tag names of an element were different.
6The parser detected an invalid character in element content.
7The parser detected an invalid start of an element, comment, processing instruction, or CDATA(character Data) section in element content.
8The parser detected in element content the CDATA closing character sequence ‘]]>’ without the matching opening character sequence ‘<![CDATA[‘.
9The parser detected an invalid character in a comment.
10The parser detected in a comment the character sequence ‘–‘ (two hyphens) not followed by ‘>’.
11The parser detected an invalid character in a processing instruction data segment.
12A processing instruction target name was ‘xml’ in  any of the cases- lower, upper or toggle.
13The parser detected an invalid digit in a hexadecimal character reference (of the form &#xdddd;, for example &#x0eb1).
14The parser detected an invalid digit in a decimal character reference (of the form &#dddd;).
15A character reference did not refer to an authorized XML character.
16The parser detected an invalid character in an entity reference name.
17The parser detected an invalid character in an attribute value.
18The parser detected a possible invalid start of a document type declaration.
19The parser detected a second document type declaration.
20An element name was not specified correctly. The beginning character was not a letter, ‘_’, or ‘:’, or the parser detected an invalid character either in or following the element name.
21An attribute was not specified correctly. The beginning character of the attribute name was not a letter, ‘_’, or ‘:’, or a character other than ‘=’ was detected following the attribute name, or one of the delimiters of the value was not correct, or an invalid character was detected in or following the name.
22An empty element tag was not terminated by a  markup language character ‘>’ following the ‘/’.
23The element end tag wasn’t specified correctly. The beginning character was not a letter, ‘_’, or ‘:’, or the tag wasn’t terminated by ‘>’.
24The parser detected an invalid start of a comment or CDATA section in element content.
25A processing instruction target name wasn’t specified correctly. The starting character of the processing instruction target name wasn’t a letter, ‘_’, or ‘:’, or the parser detected an invalid character in or following the processing instruction target name.
26A processing instruction wasn’t terminated by the closing character sequence ‘?>’.
27The parser detected an invalid character following ‘&’ in a character reference or entity reference.
28The version information wasn’t present in the XML declaration.
29The ‘version’ in the XML declaration wasn‘t specified correctly. ‘version’ was not followed by ‘=’, or the value was not present or improperly delimited, or the value specified a bad character, or the start and end delimiters didn’t match, or the parser detected an invalid character following the version information value closing delimiter in the XML declaration.
30The parser detected an invalid attribute instead of the optional encoding declaration in the XML declaration.
31The encoding declaration value in the XML declaration was missing or incorrect. The value did not start with lowercase or uppercase A through Z, or ‘encoding’ wasn’t followed by ‘=’, or the value was missing or improperly delimited or it specified a bad character, or the start and end delimiters didn’t match, or the parser detected an invalid character following the closing delimiter.
32The parser detected an invalid attribute instead of the optional standalone declaration in the XML declaration.
33The ‘standalone’ attribute in the XML declaration wasn’t specified correctly. ‘standalone’ wasn’t 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 n’t match, or the parser detected an invalid character following the closing delimiter.
34The XML declaration wasn’t terminated by the proper character sequence ‘?>’, or contained an invalid attribute.
35The parser detected the start of a document type declaration after the end of the root element.
36The parser detected the start of an element after the end of the root element.
300The parser reached the end of the  concerned document before the document was complete.
301The %HANDLER procedure for XML-INTO or XML-SAX returned a non-zero value, causing the XML parsing to end.
302The parser doesn’t support the requested CCSID value or the first character of the XML document was not ‘<‘.
303The concerned document was too large for the parser to handle. The parser tried to parse the incomplete document, but the data at the end of the document was necessary for the parsing to complete.
500-999Internal error in the external parser. Report the error to your service representative.
10001-19999Internal error in the parser. Report the error to your service representative.

The error codes help you identify the exact cause of the error in your source code and fix it accordingly.  Once fixed the parsing process goes on smoothly to deliver object code. To learn more about writing your own XML code, you can take this course.

Note that XML is just part of the set of languages an libraries that go into making the Internet what it is today. It would be a good idea to learn how HTML, CSS and XML come together to display pages as we see them. Udemy has a clear and simple course that shows you just how it’s done. You can take it a step further by creating your own responsive HTML page, and seeing how it shows up on different form factor devices! (and Udemy has your back – here’s a course that shows you how to create responsive HTML pages!). Go ahead, try it out!