XML Parsing Error | Line Number 1, Column 2
How to solve parse error in your first XML file. Given below a simple XML file.
<xml version=”1.0″ encoding=”UTF-8″ ?>
<body>Don’t forget me this weekend!</body>
Copy above XML data to a text file and save the same as XML file.
Sometimes it throws XML Parsing Error: XML or text declaration not at start of entity.
The reason is the empty space at the beginning of the first line. Make sure that there is no space preceding the tag <note>
When this happens the following error is printed on the screen
XML Parsing Error: XML or text declaration not at start of entity
Line Number 1, Column 2:
Points to remember when saving XML file:
- Make sure no space before starting tag.
- Close each tag. For example you need to close tag <to> with </to>.