Checking for valid XML file structure
-
I need in my application to check if the data structure is correct in XML file which I read. How can I do that? Only message if it`s correct or not I need. Thanks
Every DOM object I've ever used has a parse function that will throw an exception or spit out an error if your XML is malformed. Unfortunately, determining well-formedness through exceptions is poor programming form. The only better way I know to do this is with a full parser. As the parser is parsing, it should be able to tell you as soon as it finds a problem without throwing an exception, at which point you know your file failed. A complete run with no exceptions means your XML is good and adheres to any schema you've specified.
-
I need in my application to check if the data structure is correct in XML file which I read. How can I do that? Only message if it`s correct or not I need. Thanks
Write a schema for your structure that you can validate against. Visit BoneSoft.com