This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XML schema validation problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML schema validation problem" Watch "XML schema validation problem" New topic
Author

XML schema validation problem

Mickey White
Greenhorn

Joined: Dec 07, 2001
Posts: 1
Hello!
I have great problems to get a xml document validated against a xml schema. First, I tried using Xerces 2.0.0 beta3, but now i use Xerces 1.4.4. To check my implementation, I use the examples of Xerces (personal-schema.xml, personal.xsd).
I have written the following code:
import org.apache.xerces.parsers.DOMParser;
import org.apache.xerces.framework.*;
import java.io.*;
import org.w3c.dom.Document;
import org.xml.sax.*;
public class Test {
public static void main(String[] args) {
try {
DOMParser parser = new DOMParser();
parser.setFeature( "http://xml.org/sax/features/validation", true);
parser.setFeature( "http://xml.org/sax/features/namespaces", true);

parser.setFeature( "http://apache.org/xml/features/validation/schema", true);
parser.setFeature("http://apache.org/xml/features/validation/dynamic",true);
parser.setValidationSchemaFullChecking(true);
// parser.setFeature( "http://apache.org/xml/features/validation/schema-full-checking", true);

ErrorChecker errors = new ErrorChecker();
parser.setErrorHandler(errors);

System.out.println("Parse Dokument");
parser.parse("personal-schema.xml");

}
catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
}
Now, the code cannot be compiled. It says, the method setValidationSchemaFullChecking is not in class DOMParser. You have to know that DOMParser extends the abstract class XMLParser in another package. This method is protected. But it should be possible to call this message!? Whats the problem with that???

Mickey
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML schema validation problem
 
Similar Threads
enhancing performance for validating xml against a xsd using xerces if xsd is large
question abt validation
Where to put DTDs?
XML file validation with the XSD
package problem