Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

B.17.2. XML Syntax Errors

Syntax errors are caught by the XML parser. The error message contains information for identifying the problem.
This example error message from the XML parser consists of three lines — the first line denotes the error message, and the two following lines contain the context and location of the XML code containing the error. The third line contains an indicator showing approximately where the error lies on the line above it:
error: (name_of_guest.xml):6: StartTag: invalid element name
Information contained in this message:
This is the file name of the document that contains the error. File names in parentheses are symbolic names to describe XML documents parsed from memory, and do not directly correspond to files on disk. File names that are not contained in parentheses are local files that reside on the target of the connection.
This is the line number in the XML file that contains the error.
StartTag: invalid element name
This is the error message from the libxml2 parser, which describes the specific XML error.

B.17.2.1. Stray < in the document

The following error occurs:
error: (name_of_guest.xml):6: StartTag: invalid element name
This error message shows that the parser expects a new element name after the < symbol on line 6 of a guest's XML file.
Ensure line number display is enabled in your text editor. Open the XML file, and locate the text on line 6:
<domain type='kvm'>
This snippet of a guest's XML file contains an extra < in the document:
Remove the extra < or finish the new element.