• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML schema validation problem

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic