Brunods Posted December 6, 2006 Share Posted December 6, 2006 Hello,I'm still trying to get used to XML & XSD (new for me).I've been running some tests and one doubt showed up:I have my XSD file with my schema, and I have my XML file, that MUST follow what my schema says, right?But how can I know when the XML file DOESN'T fit the schema code, this is an error. But how can I catch this?Thanks Link to comment Share on other sites More sharing options...
boen_robot Posted December 6, 2006 Share Posted December 6, 2006 You need to create an application that will validate the XML file against the Schema. Most server side scripting languages provide this ability and if you need it off the web server, there are also desktop applications to do such validation. In any case, validation (today) is not done automatically when the file is parsed. Link to comment Share on other sites More sharing options...
AbstractApproach Posted December 16, 2006 Share Posted December 16, 2006 But how can I know when the XML file DOESN'T fit the schema code, this is an error. But how can I catch this?As robot said,You need to create an application that will validate the XML file against the Schema. Most server side scripting languages provide this ability...What robot refers to is called the DOM, or Document Object Model.Standard steps for using XML: (there are other ways, but this is the common one)1) Load it in a DOM parser2) Make the DOM parser validate it3) access the DOM (not the XML) to get informationPHP5, .Net, and Java have very good DOM implementations.However, something tells me that's not really your goal. If you're like most, you're actually trying to validate two files that you just wrote while learning XML and trying to see if they are correct. You noticed that the w3c does not host a validator (why they do not is beyond me). The first site I've found that claims to do this is http://www.xmlvalidation.com/. I cannot vouch for its suitability, as I haven't used it, but I claims to work.//Matt Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now