Reputation: 3722
I'm new to xml. I'm trying to parse an xml file to extract data from, but it shows the error below message when I call doc=minidom.parse('D:\\CONFIGRATION.xml')
...
xml.parsers.expat.ExpatError:not well-formed (invalid token): line 474, column 15
473 <Extras>
474 <extra Type>
475 jpg
476 </extra Type>
477 <extra Type>
478 psd
479 </extra Type>
480 </Extras>
Can anyone please help me? What is a well-formed XML document?
Thanks in advance
Upvotes: 2
Views: 1652
Reputation: 385780
You ask what "well-formed" means. It means that the XML conforms to the standard. Not being "well-formed" means you've used illegal syntax. In your specific case you have a tag that looks like:
<@extra Type>
You can't have a space in your tag name. You have other problems as well -- you can't start a tag with @, and your closing tags are also wrong. The slash needs to immediately follow the <
The official specification for well-formed XML is on the W3C website. your xml against the specification. If you want more detailed information about your document you can use one of many xml validation services. Use your favorite search engine to search for "xml validation".
Upvotes: 2
Reputation: 146179
"Well-formed XML" means the document conforms to the W3C standards. The error message means your document does not meet those standards for some reason. For instance, those <EXTRA TYPE>
tags are illegal because they contain spaces.
Read an overview like this one at Developer.com.
Upvotes: 2
Reputation: 73702
Check to see if your document has any errors on line 474, column 15. There is probably a clue at or near that point.
Also, did you misspell CONFIGURATION? You are missing a 'U'.
Upvotes: 0