joeslide wrote:
Assume an app has a set of input rules in an xml doc named rules.xml. A
user generates another xml doc (or fragment) named data.xml. What are
some ways I can validate data.xml with rules.xml without relying on a
external script to do the validation. I suppose you could use an
internal script (XHTML with Javascript), but can it be done with a DTD
Spec and XPath?
You need a validating parser and use that to validate data.xml against
rules.xml (assuming rules.xml is a schema in a schema language the
parser supports).
For W3C XML schemas an instance document (e.g. data.xml) can indicate
schemas with the xsi:schemaLocation attribute (or
xsi:noNamespaceSchemaLocation).
Some parsers have command line interfaces, some are integrated into XML
editors, some have APIs to be used from various programming languages.
If you do the validation from the command line or with an XML editor
then you don't need script respectively your own program to perform the
validation.
--
Martin Honnen
http://JavaScript.FAQTs.com/