Hi Chris
The MSV method you're looking at probably takes a W3C Node interface rather
than an org.dom4j.Node interface.
There's a sample program in the dom4j/src/validate/JARVDemo.java that
demonstrates how to use MSV with dom4j. The trick is to use a
VerifierHandler and a dom4j SAXWriter to pipe SAX events into MSV. e.g.
adding these few methods instead of the "return verifier.verify(doc);" line
VerifierHandler handler = verifier.getVerifierHandler();
SAXWriter writer = new SAXWriter( handler );
writer.write( document );
James
----- Original Message -----
From: "Christopher M. Golden" <[EMAIL PROTECTED]>
To: "DOM4J User's Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, February 15, 2002 10:54 PM
Subject: [dom4j-user] Problems validating with schema
I know that this mostly fits under Sun's multi-schema, but I figure that you
guys probably can help me... I'm trying to write a basic function that
validates a DOM4J Document object by a W3C Schema file. I'm using the
following code for the function:
private boolean validateDoc(Document doc, File fSchema) {
VerifierFactory factory = new
com.sun.msv.verifier.jarv.TheFactoryImpl();
Schema schema = factory.compileSchema(fSchema);
Verifier verifier = schema.newVerifier();
// See if the document is valid by this Schema
return verifier.verify(doc);
}
I get a "Cannot resolve symbol" error during compilation. It's complaining
about my call of "return verifier.verify(doc);" I looked in the API and it
claims that verify just needs a Node, and I show Document as implementing
Node. Any ideas on how I can get this to work? I might implement an
ErrorHandler for it later, but I just wanted to be able to verify my
documents for now...
Chris
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user
_________________________________________________________
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