Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
868
Xalan: The org.apache.xml.dtm.DTMManager Class
Direct Known Subclasses:org.apache.xml.dtm.ref.DTMManagerDefault, org.apache.xpath.XPathContext
This is
a abstract class. A DTMManager instance can be used to create DTM and
DTMIterator objects, and manage the DTM objects in the system.
The
system property that determines which Factory implementation to create is named
"org.apache.xml.utils.DTMFactory". This property names a concrete
subclass of the DTMFactory abstract class. If the property is not defined, a
platform default is be used.
An
instance of this class must be safe to use across thread instances. It is
expected that a client will create a single instance of a DTMManager to use
across multiple threads. This will allow sharing of DTMs across multiple
processes.
Note:
this class is incomplete right now. It will be pretty much modeled after
javax.xml.transform.TransformerFactory in terms of its factory support. So I
have given example of how to create it.
Method Overviews
All
methods in this class are abstract. So depending upon the system property of
Factory class, a concrete instance will get created and that will support all
methods. Please look into newInstance() method to know the look up procedure.
Example of creating a DTM Manager using newInstance(XMLStringFactory xsf)
throws DTMConfigurationException:
Obtain
a new instance of a DTMManager. This static method creates a new factory
instance This method uses the following ordered lookup procedure to determine
the DTMManager implementation class to load:
Use the
org.apache.xml.dtm.DTMManager system property.
Use the
JAVA_HOME(the parent directory where jdk is installed)/lib/xalan.properties for
a property file that contains the name of the implementation class keyed on the
same value as the system property defined above.
Use the
Services API (as detailed in the JAR specification), if available, to determine
the classname. The Services API will look for a classname in the file
META-INF/services/org.apache.xml.dtm.DTMManager in jars available to the
runtime.
Use the
default DTMManager classname, which is
org.apache.xml.dtm.ref.DTMManagerDefault.
Once an
application has obtained a reference to a DTMManager it can use the factory to
configure and obtain parser instances.
Note: If it fails to
load a concrete factory class, then it will throw NPE.
XMLStringFactoryDefault stringFactory
= new XMLStringFactoryDefault();
This
method creates a DTM representing an empty DocumentFragment object.
DTM dtm =
dtmManager.createDocumentFragment();
Note: This class is
still incomplete. The DTM API is still Subject To Change. This wouldn't
affect most users, but might require updating some extensions.