Determining if an XML document is well-formed
After creating an XML document from scratch I always check if it is well-formed. This means it must adhere to a number of rules, including the following:
Every start-tag must have a matching end-tag.
Elements may nest, but may not overlap.
There must be exactly one root element.
Attribute values must be quoted.
An element may not have two attributes with the same name.
This is not an exhaustive list and I do not mean to explain all the rules. There are many, many ways a document can be malformed. But if you need to determine if and XML document is well-formed there is a linux ...