Code example for XMLReader

Methods: setEntityResolver, setFeature

0
		factory.setValidating(false);
 
		SAXParser parser = factory.newSAXParser();
		XMLReader xmlReader = parser.getXMLReader();
		// More details at http://xerces.apache.org/xerces2-j/features.html#namespaces 
		xmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
		// More details at http://xerces.apache.org/xerces2-j/features.html#namespace-prefixes 
		xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
		// More details at http://xerces.apache.org/xerces2-j/features.html#xmlns-uris 
		xmlReader.setFeature("http://xml.org/sax/features/xmlns-uris", true);
		xmlReader.setEntityResolver(pkg.getEntityResolver());
 
		return xmlReader;
	} 
 
	/** 
	 * use SAX parser to parse content of package 
	 * @param pkg a OdfPackage 
	 * @param path a path inside the OdfPackage, eg. to a contained content.xml stream 
	 * @param contentHandler a SAX Content handler to receive SAX Events 
	 * @param errorHandler a SAX Error handler to be called on errors during parsing