Hi Tony

----- Original Message -----
> I've just converted a project I'm working on from JDOM. dom4j seems to
work
> very nicely.

Great, glad to hear it..


> Now, I'd like sometimes to have the receiver of a document validate it
using
> a schema known to him, rather than named in the document itself.
>
> Is there a neater way of doing this than parsing the doc without
validation,
> adding the schema reference, converting it back to XML and then reparsing
it
> with validation on? For instance, is there a parser that will do its
> validation on a dom4j Document?

I've had similar problems in the past.

Sun's got a nice library called MSV (Multi Schema Validator) which can do
validation across multiple schema languages, DTD, XML Schema, RelaxNG, Trex,
Relax etc.

Right now there's not a validator which works directly on a dom4j document,
but the next best thing is to fire in the SAX events into an MSV Verifier.

There's an example of this working in src/samples/validate/MSVDemo.java.

I've not tried using the latest EA2 release of MSV yet (its on my stack),
I'm hoping the example should still work with it though.

Hopefully one day we might be able to write a more optimal dom4j Verifier
that uses MSV and doesn't require that we serialize the document to SAX
events. MSV looks a nice piece of work so a dom4j Verifier shouldn't be too
hard to do.

James






_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to