XML Validation

Poster Content
nk4um Moderator
Posts: 901
January 18, 2013 16:41

Hi Gary - you've discovered the "edge of the XML universe". This is not to do with ROC or NK, instead its that the world of "XML processing" has an explicit assumption that the processing context is the entire document.

There's also an assumption (I guess from the SGML days before XML) that the document schema is unique and often is actually tied directly to the document (eg DTD, or XSD declaration - make my teeth itch).

In the compositional relative ROC universe this can be very frustrating.

Due to the global document context assumption, you won't find an off the shelf XML validation technology that can cope with validating fragments of a document embedded inside a compositional structure. This has never been part of the design scope of standard tools (because of the explicit assumption they all adopt).

However all is not lost. Schematron is the most flexible extrinsic validation technology - and its use of XPath with assertion is a very nice approach. It also allows the path to be easily extended to apply the same sub-path to validate a compositional fragment. Have you tried this? It also has the added advantage of being much easier for developers to write and maintain.

P.

PS Thanks for alerting me to the URL exception in Jing - this is another bugbear. The XML (and RDF) toolset only know the basic set of URL schemes and (since they're validators) get nasty when its something local. They don't provide easy extension either - so we'll probably have to go in and hand override the class that thats doing this to get it to play nicely. Can you please send me the full stack trace so we can find which class is getting upset.

Like · Post Reply
nk4um User
Posts: 92
January 18, 2013 14:54XML Validation

I have tried using validateXSD and now jingValidate and got them both working with a simple single XML to validation file check. However, I do composition of resources and thus one resource may contain other resources. So, ideally, I would like to have the ability to have multiple XSD's that can be included or in the case of relax-NG, have a externalRef working. The documentation on Jing was very light, but hinted that externalRef would be able to reference into the ROC address space. However I have been unable to get it to work.

I get the exception - java.net.MalformedURLException unknown protocol: res

Is there any solution to this, or do I have to explicitly have a single file for every resource and if I change one, just remember to change all the other validation files that reference that resource.

My next step is to step out of the NetKernel world and create a separate java utility to do my validation, but thought I would see if NK can handle this first.

Like · Post Reply