You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Burris, Eddie" <bu...@umkc.edu> on 2002/10/24 01:13:22 UTC
Validating with external Schema
Is there a problem with setting the XML Schema file inside your program
using the external-noNamespaceSchemaLocation property? The following
code is returning an error that suggests it can't find the schema
file???
Eddie
------------------------------------------------------------------------
------------------
factory.setNamespaceAware(true);
try {
SAXParser saxParser = factory.newSAXParser();
XMLReader reader = saxParser.getXMLReader();
reader.setFeature("http://xml.org/sax/features/validation", true);
reader.setFeature("http://apache.org/xml/features/validation/schema",
true);
reader.setProperty(
"http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocat
ion",
"example.xsd");
File xmlFile = new File("example.xml");
DefaultHandler handler = new SAXSchema2();
saxParser.parse(xmlFile, handler);
}