xml - how to use xerces in java? -
this code validation of xml problem having in line 2 while importing org.apache.xerces...i downloaded xerces.jar , added external jar class run configuration,can tell me if doing write if yes why error if no should do.
import java.io.file; import org.apache.xerces.parsers.domparser; public class schematest { public static void main (string[] args) { file docfile = new file("c:\\users\\ahussain\\desktop\\xml_validation\\memory.xml"); try { domparser parser = new domparser(); parser.setfeature("http://xml.org/sax/features/validation", true); parser.setproperty("http://apache.org/xml/properties/schema/external- nonamespaceschemalocation","memory.xsd"); errorchecker errors = new errorchecker(); parser.seterrorhandler(errors); parser.parse("memory.xml"); } catch (exception e) { system.out.print("problem parsing file."); } } }
instead of adding run configuration add jar classpath,
project - buildpath - configure build path - libraries - add jar.
Comments
Post a Comment