Now, open your XML document in any text editing tool and scroll down to the cost node of the second product. Save your work and reload Internet Explorer. You should see an error message that looks like the one pictured in Figure 1. Furthermore, it provides a nice visual of the offending line, a little arrow pointing to the spot at which the parser thinks the problem arose. Even though the problem is really with the start tag, the arrow points to the end tag.
Because Internet Explorer uses a non-validating parser by default remember, this means it only cares about well-formedness rules , it runs into problems at the end tag. You now have to backtrack to find out why that particular end tag caused such a problem. Open your XML document in an editor once more, and fix the problem we introduced above.
Save your work and reload your browser. You should see an error message similar to the one shown in Figure 1. At first glance, this error message seems a bit more obscure than the previous one. However, look closely and what do you see? Firefox is a popular open-source browser, and at the time this book went to print the latest version was 1. You can download a free copy from the Mozilla website. Okay, so both Internet Explorer and Firefox will check your XML for well-formedness, but you need to know for future reference how to check that an XML file is valid i.
Testing our application
How do you do that? There are various well-known online validating XML parsers. All you have to do is visit the appropriate page, upload your document, and the parser will validate it. Here is the most popular online parser. Sometimes, it may be impractical to use a Website to validate your XML because of issues relating to connectivity, privacy, or security.
This checks for well-formedness if the document has no DTD, and for well-formedness and validity if a DTD is specified.