3.4.4 Generating the preparsed object
Parse the Pre-Parse XML document and generate the PreparsedObject instance that is the preparsed object.
To generate the preparsed object (PreparsedObject instance), use the following methods:
-
newInstance method of the com.cosminexus.jaxp.preparsedxml.PreparsedObjectFactory class
-
newPreparsedObject method of the com.cosminexus.jaxp.preparsedxml.PreparsedObject class
For details about the methods, see 3.4.7 Classes used in preparing the high-speed parse support function.
An example of code for generating the preparsed object is as follows:
// Prepare the Pre-Parse XML document File xml = new File("learning1.xml"); // Prepare the entity resolver MyEntityResolver entityResolver = new MyEntityResolver(); // Prepare the error handler MyErrorHandler errorHandler = new MyErrorHandler(); // Generate PreparsedObjectFactory PreparsedObjectFactory pof = PreparsedObjectFactory.newInstance(); // Enable the namespace pof.setNamespaceAware(true); // Set up the entity resolver pof.setEntityResolver(entityResolver); // Set up the error handler pof.setErrorHandler(errorHandler); // Generate the preparsed object PreparsedObject pobj = pof.newPreparsedObject(xml);