I’m trying to support my users in creating an xml based on an xsd (xml schema).
So I show possible elements and the user can add it to an xml.
However, i have problems to determine the possible elements or to validate that what the user adds is correct. How do I check complex elements?
Let’s say we have a sequence element. How am I going to check that the user adds an element at the right place?
Let’s say we have a choice element. How am I going to check that an element from the other particle has been added already?
I can validate the xml against the schema in c# but the errors it returns can (maybe) be showed to the user but I can’t use them in my code since the format is inappropriate for that and it just doesn’t return enough details.
Do I need to write my own validator (and implement all the w3c specs)??
Thanks!
You shouldn’t need to implement your own validator.
XmlSchemaValidatorwill actually give you a good amount of information. See the answer to my own similar question here : XML Schemas — List allowed attributes/tags at position in XML