Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML Parsing error: Extra content at the end of the document

Tags:

parsing

xml

I am getting this error in my xml file: XML Parsing error: Extra content at the end of the document

I am using Notepad++ and it shows the second word in red in the header tags <ABC BLAH>hello</ABC BLAH> - it shows the BLAH in red. Because of this, I assume the problem is in the whitespace in the header tags and throws a validation error at that line. How do I resolve this?

This is the xml file:

<?xml version="1.0" encoding="UTF-8"?>
<rows>
    <row>
        <Order>1</Order>
        <Requirements>ABC</Requirements>
        <Testing Procedures>blah blah </Testing Procedures> 
        <Assessment Observations / Comments>blah blah</Assessment Observations / Comments> <-- throws Parsing error at this line.
    </row>
</rows>
like image 685
input Avatar asked Nov 18 '11 21:11

input


1 Answers

<Testing Procedures="">blah blah </Testing Procedures>

Can't have spaces in element names.

<Assessment Observations="" / Comments>blah blah</Assessment Observations / Comments>

Also this has multiple errors. Maybe you meant this ? :

<?xml version="1.0" encoding="UTF-8"?>
<rows>
  <row>
    <Order>1</Order>
    <Requirements>ABC</Requirements>
    <TestingProcedures foo=" ">blah blah </TestingProcedures>
    <Assessment Observations="/ Comments>blah blah"/>
    <Assessment Observations=" / Comments"/>
  </row>
</rows>

You have multiple errors. Can't really tell what you are trying to do.

OK .xml 101:

XML doesn't permit spaces in element names.

If you don't close the element name you can specify attributes like this.

<foo bar="I am an attribute" lol="Me too"> Here you can specify text, or other elements </foo>

In addition if an element doesn't contain another one , or a text you can use the shorthand notation

<foo attribute="bar"/>

I suggest you read some basic tutorial for this.

like image 123
FailedDev Avatar answered Oct 26 '22 22:10

FailedDev