java.lang.Object
org.apache.commons.jxpath.xml.XMLParser2
org.apache.commons.jxpath.xml.DocumentContainer
- All Implemented Interfaces:
- org.apache.commons.jxpath.Container, XMLParser
- public class DocumentContainer
- extends XMLParser2
- implements org.apache.commons.jxpath.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.9 $ $Date: 2004/02/29 14:17:37 $
| Fields inherited from class org.apache.commons.jxpath.xml.XMLParser2 |
|
| Methods inherited from class org.apache.commons.jxpath.xml.XMLParser2 |
isCoalescing, isExpandEntityReferences, isIgnoringComments, isIgnoringElementContentWhitespace, isNamespaceAware, isValidating, setCoalescing, setExpandEntityReferences, setIgnoringComments, setIgnoringElementContentWhitespace, setNamespaceAware, setValidating |
| 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
- See Also:
- Constant Field Values
MODEL_JDOM
public static final java.lang.String MODEL_JDOM
- See Also:
- Constant Field Values
document
private java.lang.Object document
xmlURL
private java.net.URL xmlURL
model
private java.lang.String model
parserClasses
private static java.util.HashMap parserClasses
parsers
private static java.util.HashMap parsers
DocumentContainer
public DocumentContainer(java.net.URL xmlURL)
- Use this constructor if the desired model is DOM.
DocumentContainer
public DocumentContainer(java.net.URL xmlURL,
java.lang.String model)
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.
registerXMLParser
public static void registerXMLParser(java.lang.String model,
java.lang.String parserClassName)
- Add a class of a custom 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 org.apache.commons.jxpath.Container
parseXML
public java.lang.Object parseXML(java.io.InputStream stream)
- Parses XML using the parser for the specified model.
- Specified by:
parseXML in interface XMLParser- Specified by:
parseXML in class XMLParser2
setValue
public void setValue(java.lang.Object value)
- Throws an UnsupportedOperationException
- Specified by:
setValue in interface org.apache.commons.jxpath.Container
getParser
private static final XMLParser getParser(java.lang.String model)
- Maps a model type to a parser.