java.lang.Object | |
↳ | com.microstrategy.utils.xml.DOMSupport |
The DOMSupport class is used to abstract away parser-specific and JAXP-supported DOM-related operations. It can be used to parse XML, serialize DOM trees, execute XPath calls, and create new DOM Documents.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DOMSupport() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract Node |
getChild(Node contextNode, String nodeName)
Returns the child node of the given node with the given node name.
| ||||||||||
abstract NodeList |
getChildren(Node contextNode, String nodeName)
Returns a list of children of the context node with the given node name.
| ||||||||||
abstract Node |
getDescendent(Node contextNode, String reducedXPath)
This method executes the given reduced XPath expression, and returns the first node which fits
the expression.
| ||||||||||
abstract NodeList |
getDescendents(Node contextNode, String reducedXPath)
This method executes the given reduced XPath expression, and returns a list of nodes
which fit the expression.
| ||||||||||
abstract Document |
newDocument()
Returns a new DOM Document, with no elements in it.
| ||||||||||
static DOMSupport |
newInstance()
The newInstance method can be used to obtain an instance of a DOMSupport object.
| ||||||||||
abstract Document |
parse(File f, boolean isValidating, ErrorHandler errorHandler, boolean namespaceAware, EntityResolver entityResolver)
Parses the given XML File's contents into a DOM Document, with or without DTD validation, with or without namespace awareness.
| ||||||||||
abstract Document |
parse(String xmlString, boolean isValidating)
Parses the given XML String into a DOM Document, with or without DTD validation.
| ||||||||||
abstract Document |
parse(InputStream stream, boolean isValidating, ErrorHandler errorHandler)
Parses the given InputStream's into a DOM Document, with or without DTD validation.
| ||||||||||
abstract Document |
parse(InputStream stream, ParserParameters parameters)
Parses the given InputStream's contents into a DOM Document based on the given parameters.
| ||||||||||
abstract Document |
parse(String xmlString, boolean isValidating, ErrorHandler errorHandler, boolean namespaceAware)
Parses the given XML String into a DOM Document, with or without DTD validation.
| ||||||||||
abstract Document |
parse(String xmlString)
Parses the given XML String into a DOM Document, without DTD validation.
| ||||||||||
abstract Document |
parse(File f)
Parses the given XML File's contents into a DOM Document, without DTD validation.
| ||||||||||
abstract Document |
parse(InputStream stream, boolean isValidating, ErrorHandler errorHandler, boolean namespaceAware, EntityResolver entityResolver)
Parses the given InputStream's into a DOM Document, with or without DTD validation.
| ||||||||||
abstract Document |
parse(String xmlString, ParserParameters parameters)
Parses the given XML String into a DOM Document based on the given parameters.
| ||||||||||
abstract Document |
parse(File f, ParserParameters parameters)
Parses the given XML File's contents into a DOM Document based on the given parameters.
| ||||||||||
abstract Document |
parse(String xmlString, boolean isValidating, ErrorHandler errorHandler, boolean namespaceAware, EntityResolver entityResolver)
Parses the given XML String into a DOM Document, with or without DTD validation.
| ||||||||||
abstract Document |
parse(String xmlString, boolean isValidating, ErrorHandler errorHandler)
Parses the given XML String into a DOM Document, with or without DTD validation.
| ||||||||||
abstract Document |
parse(File f, boolean isValidating, ErrorHandler errorHandler, boolean namespaceAware)
Parses the given XML File's contents into a DOM Document, with or without DTD validation, with or with namespace awareness.
| ||||||||||
abstract Document |
parse(InputStream stream)
Parses the given InputStream's into a DOM Document, without DTD validation.
| ||||||||||
abstract Document |
parse(InputStream stream, boolean isValidating)
Parses the given InputStream's into a DOM Document, with or without DTD validation.
| ||||||||||
abstract Document |
parse(File f, boolean isValidating)
Parses the given XML File's contents into a DOM Document, with or without DTD validation.
| ||||||||||
abstract Document |
parse(File f, boolean isValidating, ErrorHandler errorHandler)
Parses the given XML File's contents into a DOM Document, with or without DTD validation.
| ||||||||||
abstract Document |
parse(InputStream stream, boolean isValidating, ErrorHandler errorHandler, boolean namespaceAware)
Parses the given InputStream's into a DOM Document, with or without DTD validation.
| ||||||||||
abstract String | serialize(Node n, boolean indent) | ||||||||||
abstract String |
serialize(Node n)
Serializes the given node and its children into an XML String.
| ||||||||||
abstract String |
serialize(Node n, SerializerParameters parameters)
Serializes the given node and its children into an XML String.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Returns the child node of the given node with the given node name. This uses DOM traversal, and as such it should be significantly faster than selectSingleNode.
contextNode | The node whose child will be traversed to. |
---|---|
nodeName | The name of the child node |
Returns a list of children of the context node with the given node name.
contextNode | The node to search from. |
---|---|
nodeName | The name of the child nodes to return. |
This method executes the given reduced XPath expression, and returns the first node which fits the expression. This method does not support conditions or recursive traversal of the tree. Note that this method uses DOM traversal to implement this functionality.
contextNode | The context node for the reduced XPath expression. |
---|---|
reducedXPath | The reduced XPath expression to execute. |
IllegalArgumentException | Thrown if the reduced XPath expression is invalid. |
---|
This method executes the given reduced XPath expression, and returns a list of nodes which fit the expression. This method does not support conditions or recursive traversal of the tree. Note that this method uses DOM traversal to implement this functionality.
A reduced XPath expression only supports parts of the XPath specification, in particular:
contextNode | The context node for the reduced XPath expression. |
---|---|
reducedXPath | The reduced XPath expression to execute. |
IllegalArgumentException | Thrown if the reduced XPath expression is invalid. |
---|
Returns a new DOM Document, with no elements in it.
XMLSupportRuntimeException | Signals an error when creating the new document. This generally signals a configuration error in the XML parser/XSL processor libraries. |
---|
The newInstance method can be used to obtain an instance of a DOMSupport object. This instance can then be used to call any of the methods on this object.
Parses the given XML File's contents into a DOM Document, with or without DTD validation, with or without namespace awareness.
f | The file to parse. |
---|---|
isValidating | true if the parser produced will validate documents as they are parsed; false otherwise. |
errorHandler | The org.xml.sax.ErrorHandler to be used to report errors present in the XML document to be parsed. |
namespaceAware | Whether the DocumentBuilderFactory is initialized with a specific namespace awareness. |
entityResolver | The org.xml.sax.EntityResolver to be used to resolve entity references. |
XMLSupportException | Signals an error when parsing the XML or accessing the file. |
---|
Parses the given XML String into a DOM Document, with or without DTD validation. If with DTD validation, the error will be handled by default error handler.
xmlString | The XML String to parse. |
---|---|
isValidating | true if the parser produced will validate documents as they are parsed; false otherwise |
XMLSupportException | Signals an error when parsing the XML. |
---|
Parses the given InputStream's into a DOM Document, with or without DTD validation.
stream | The input stream representing the xml to parse. |
---|---|
isValidating | true if the parser produced will validate documents as they are parsed; false otherwise. |
errorHandler | The org.xml.sax.ErrorHandler to be used to report errors present in the XML document to be parsed. |
XMLSupportException | Signals an error when parsing the XML. |
---|
Parses the given InputStream's contents into a DOM Document based on the given parameters.
stream | The input stream representing the xml to parse. |
---|---|
parameters | a ParserParameters class with the parameter values. |
XMLSupportException |
---|
Parses the given XML String into a DOM Document, with or without DTD validation.
xmlString | The XML String to parse. |
---|---|
isValidating | true if the parser produced will validate documents as they are parsed; false otherwise. |
errorHandler | The org.xml.sax.ErrorHandler to be used to report errors present in the XML document to be parsed. |
namespaceAware | Whether the DocumentBuilderFactory is initialized with a specific namespace awareness. |
XMLSupportException | Signals an error when parsing the XML. |
---|
Parses the given XML String into a DOM Document, without DTD validation.
xmlString | The XML String to parse. |
---|
XMLSupportException | Signals an error when parsing the XML. |
---|
Parses the given XML File's contents into a DOM Document, without DTD validation.
f | The file to parse. |
---|
XMLSupportException | Signals an error when parsing the XML or accessing the file. |
---|
Parses the given InputStream's into a DOM Document, with or without DTD validation.
stream | The input stream representing the xml to parse. |
---|---|
isValidating | true if the parser produced will validate documents as they are parsed; false otherwise. |
errorHandler | The org.xml.sax.ErrorHandler to be used to report errors present in the XML document to be parsed. |
namespaceAware | Whether the DocumentBuilderFactory is initialized with a specific namespace awareness. |
entityResolver | The org.xml.sax.EntityResolver to be used to resolve entity references. |
XMLSupportException | Signals an error when parsing the XML. |
---|
Parses the given XML String into a DOM Document based on the given parameters.
xmlString | The XML String to parse. |
---|---|
parameters | a ParserParameters class with the parameter values. |
XMLSupportException |
---|
Parses the given XML File's contents into a DOM Document based on the given parameters.
f | The file to parse. |
---|---|
parameters | a ParserParameters class with the parameter values. |
XMLSupportException |
---|
Parses the given XML String into a DOM Document, with or without DTD validation.
xmlString | The XML String to parse. |
---|---|
isValidating | true if the parser produced will validate documents as they are parsed; false otherwise. |
errorHandler | The org.xml.sax.ErrorHandler to be used to report errors present in the XML document to be parsed. |
namespaceAware | Whether the DocumentBuilderFactory is initialized with a specific namespace awareness. |
entityResolver | The org.xml.sax.EntityResolver to be used to resolve entity references. |
XMLSupportException | Signals an error when parsing the XML. |
---|
Parses the given XML String into a DOM Document, with or without DTD validation.
xmlString | The XML String to parse. |
---|---|
isValidating | true if the parser produced will validate documents as they are parsed; false otherwise. |
errorHandler | The org.xml.sax.ErrorHandler to be used to report errors present in the XML document to be parsed. |
XMLSupportException | Signals an error when parsing the XML. |
---|
Parses the given XML File's contents into a DOM Document, with or without DTD validation, with or with namespace awareness.
f | The file to parse. |
---|---|
isValidating | true if the parser produced will validate documents as they are parsed; false otherwise. |
errorHandler | The org.xml.sax.ErrorHandler to be used to report errors present in the XML document to be parsed. |
namespaceAware | Whether the DocumentBuilderFactory is initialized with a specific namespace awareness. |
XMLSupportException | Signals an error when parsing the XML or accessing the file. |
---|
Parses the given InputStream's into a DOM Document, without DTD validation.
stream | The input stream representing the xml to parse. |
---|
XMLSupportException | Signals an error when parsing the XML. |
---|
Parses the given InputStream's into a DOM Document, with or without DTD validation. If with DTD validation, the error will be handled by default error handler.
stream | The input stream representing the xml to parse. |
---|---|
isValidating | true if the parser produced will validate documents as they are parsed; false otherwise |
XMLSupportException | Signals an error when parsing the XML. |
---|
Parses the given XML File's contents into a DOM Document, with or without DTD validation. If with DTD validation, the error will be handled by default error handler.
f | The file to parse. |
---|---|
isValidating | true if the parser produced will validate documents as they are parsed; false otherwise |
XMLSupportException | Signals an error when parsing the XML or accessing the file. |
---|
Parses the given XML File's contents into a DOM Document, with or without DTD validation.
f | The file to parse. |
---|---|
isValidating | true if the parser produced will validate documents as they are parsed; false otherwise. |
errorHandler | The org.xml.sax.ErrorHandler to be used to report errors present in the XML document to be parsed. |
XMLSupportException | Signals an error when parsing the XML or accessing the file. |
---|
Parses the given InputStream's into a DOM Document, with or without DTD validation.
stream | The input stream representing the xml to parse. |
---|---|
isValidating | true if the parser produced will validate documents as they are parsed; false otherwise. |
errorHandler | The org.xml.sax.ErrorHandler to be used to report errors present in the XML document to be parsed. |
namespaceAware | Whether the DocumentBuilderFactory is initialized with a specific namespace awareness. |
XMLSupportException | Signals an error when parsing the XML. |
---|
Serializes the given node and its children into an XML String.
n | An XML Node, which will be serialized into an XML String. |
---|
Serializes the given node and its children into an XML String.
n | An XML Node, which will be serialized into an XML String. |
---|---|
parameters | a SerializerParameters class with the parameter values. |