Re: [xml] Validating XML file against XSD Schema



Would someone please let me know how I can validate an XML file against its
XSD Schema file.  If there are validation errors I would then like to
extract the human readable error description.

You can find an example implementation here:
http://wiki.njh.eu/XML-Schema_validation_with_libxml2

It's up to you how you supply the schema URI to libxml (i.e. a noNamespaceSchemaLocation/shemaLocation attribute of the root element or some other mechanism). Because XSD is a specification separate from XML, libxml won't extract the URI for you.

Good luck!
Piotr



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]