Reputation: 181
I'm getting a lot of parsing errors from python related to my xml file. I read elsewhere on stackoverflow that I should validate the xml file first.
I can't understand why this xml will not validate:
<xml><hive name="myprojectname">
XML validator says this
Error: Can not find declaration of element 'xml'.
Error Position: <xml><hive name="myprojectname">
Upvotes: 1
Views: 1143
Reputation: 3404
This:
<xml><hive name="myprojectname">
doesn't validate in http://www.validome.org/xml/validate/, because first you have to check "Well-Formedness only" option there.
Second, it have to follow XML rules, http://en.wikipedia.org/wiki/XML#Well-formedness_and_error-handling. So this should look:
<xml><hive name="myprojectname"/></xml>
Upvotes: 2
Reputation: 943150
The validator you are using appears to be a DTD based validator. Unless you tell it to check for well formedness only (in which case it won't check if your elements and attributes are correct, just that you open/close elements in a sane order, quote your attribute values, etc) then you must start the XML document with a Doctype so that it can find the DTD.
Upvotes: 1