E
Elhanan
hi .. i have the following:
File f=new File(xmlFile);
Schema s=getScehma(xsdFile);
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
SAXParser saxParser = spf.newSAXParser();
spf.setValidating(true);
// spf.setFeature("http://xml.org/sax/features/validation",
true);
//
spf.setFeature("http://apache.org/xml/features/validation/schema",
true);
saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
saxParser.parse(f, new DefaultHandler());
in xerces this works without specify an external schema, but here it
reads it ok (even thought it's not a valid file).
what i'm aiming for is that to make an xml config file that every xml
parser will fail, if it won't comply to the xsd..
File f=new File(xmlFile);
Schema s=getScehma(xsdFile);
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
SAXParser saxParser = spf.newSAXParser();
spf.setValidating(true);
// spf.setFeature("http://xml.org/sax/features/validation",
true);
//
spf.setFeature("http://apache.org/xml/features/validation/schema",
true);
saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
saxParser.parse(f, new DefaultHandler());
in xerces this works without specify an external schema, but here it
reads it ok (even thought it's not a valid file).
what i'm aiming for is that to make an xml config file that every xml
parser will fail, if it won't comply to the xsd..