org.apache.commons.jxpath.xml
Class DocumentContainer
java.lang.Object
|
+--org.apache.commons.jxpath.xml.DocumentContainer
- All Implemented Interfaces:
- Container
- public class DocumentContainer
- extends java.lang.Object
- implements Container
An XML document container reads and parses XML only when it is
accessed. JXPath traverses Containers transparently -
you use the same paths to access objects in containers as you
do to access those objects directly. You can create
XMLDocumentContainers for various XML documents that may or
may not be accessed by XPaths. If they are, they will be automatically
read, parsed and traversed. If they are not - they won't be
read at all.
- Version:
- $Revision: 1.6 $ $Date: 2003/03/11 00:59:34 $
- Author:
- Dmitri Plotnikov
Constructor Summary |
DocumentContainer(java.net.URL xmlURL)
Use this constructor if the desired model is DOM. |
DocumentContainer(java.net.URL xmlURL,
java.lang.String model)
|
Method Summary |
java.lang.Object |
getValue()
Reads XML, caches it internally and returns the Document. |
static void |
registerXMLParser(java.lang.String model,
XMLParser parser)
Add an XML parser. |
void |
setValue(java.lang.Object value)
Throws an UnsupportedOperationException |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MODEL_DOM
public static final java.lang.String MODEL_DOM
MODEL_JDOM
public static final java.lang.String MODEL_JDOM
DocumentContainer
public DocumentContainer(java.net.URL xmlURL)
- Use this constructor if the desired model is DOM.
- Parameters:
URL
- is a URL for an XML file.
Use getClass().getResource(resourceName) to load XML from a
resource file.
DocumentContainer
public DocumentContainer(java.net.URL xmlURL,
java.lang.String model)
- Parameters:
URL
- is a URL for an XML file. Use getClass().getResource
(resourceName) to load XML from a resource file.model
- is one of the MODEL_* constants defined in this class. It
determines which parser should be used to load the XML.
registerXMLParser
public static void registerXMLParser(java.lang.String model,
XMLParser parser)
- Add an XML parser. Parsers for the models "DOM" and "JDOM" are
pre-registered.
getValue
public java.lang.Object getValue()
- Reads XML, caches it internally and returns the Document.
- Specified by:
getValue
in interface Container
setValue
public void setValue(java.lang.Object value)
- Throws an UnsupportedOperationException
- Specified by:
setValue
in interface Container
Copyright © 2001-2003 Apache Software Foundation. All Rights Reserved.