View Single Post
  #2 (permalink)  
Old August 23rd, 2006, 04:17 AM
joefawcett's Avatar
joefawcett joefawcett is offline
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well technically all XML is well formed, otherwise it's not XML.
Most, if not all, parsers have the ability to load a document. At this stage they can tell you if it's an XML document, and usually if not why not. In MSXML for example:
Code:
var bLoaded = XmlDoc.load(<path to doc>;
if (bLoaded)
{
  //document is XML
}
else
{
  //document is not XML, check XmlDoc.parseError for further details.
}
Each parser does it slightly differently so you'll have to state which one you intend to use if you need further help and can't find the documentation.

--

Joe (Microsoft MVP - XML)
Reply With Quote