Package com.microstrategy.utils.xml
Class DOMSupport
- java.lang.Object
-
- com.microstrategy.utils.xml.DOMSupport
-
public abstract class DOMSupport extends java.lang.Object
Deprecated.UseSAXSupport
insteadThe 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.- Since:
- MicroStrategy Web 7.3.1 or earlier
-
-
Constructor Summary
Constructors Constructor Description DOMSupport()
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract org.w3c.dom.Node
getChild(org.w3c.dom.Node contextNode, java.lang.String nodeName)
Deprecated.Returns the child node of the given node with the given node name.abstract org.w3c.dom.NodeList
getChildren(org.w3c.dom.Node contextNode, java.lang.String nodeName)
Deprecated.Returns a list of children of the context node with the given node name.abstract org.w3c.dom.Node
getDescendent(org.w3c.dom.Node contextNode, java.lang.String reducedXPath)
Deprecated.This method executes the given reduced XPath expression, and returns the first node which fits the expression.abstract org.w3c.dom.NodeList
getDescendents(org.w3c.dom.Node contextNode, java.lang.String reducedXPath)
Deprecated.This method executes the given reduced XPath expression, and returns a list of nodes which fit the expression.abstract org.w3c.dom.Document
newDocument()
Deprecated.Returns a new DOM Document, with no elements in it.static DOMSupport
newInstance()
Deprecated.The newInstance method can be used to obtain an instance of a DOMSupport object.abstract org.w3c.dom.Document
parse(java.io.File f)
Deprecated.Parses the given XML File's contents into a DOM Document, without DTD validation.abstract org.w3c.dom.Document
parse(java.io.File f, boolean isValidating)
Deprecated.Parses the given XML File's contents into a DOM Document, with or without DTD validation.abstract org.w3c.dom.Document
parse(java.io.File f, boolean isValidating, org.xml.sax.ErrorHandler errorHandler)
Deprecated.Parses the given XML File's contents into a DOM Document, with or without DTD validation.abstract org.w3c.dom.Document
parse(java.io.File f, boolean isValidating, org.xml.sax.ErrorHandler errorHandler, boolean namespaceAware)
Deprecated.Parses the given XML File's contents into a DOM Document, with or without DTD validation, with or with namespace awareness.abstract org.w3c.dom.Document
parse(java.io.File f, boolean isValidating, org.xml.sax.ErrorHandler errorHandler, boolean namespaceAware, org.xml.sax.EntityResolver entityResolver)
Deprecated.Parses the given XML File's contents into a DOM Document, with or without DTD validation, with or without namespace awareness.abstract org.w3c.dom.Document
parse(java.io.File f, ParserParameters parameters)
Deprecated.Parses the given XML File's contents into a DOM Document based on the given parameters.abstract org.w3c.dom.Document
parse(java.io.InputStream stream)
Deprecated.Parses the given InputStream's into a DOM Document, without DTD validation.abstract org.w3c.dom.Document
parse(java.io.InputStream stream, boolean isValidating)
Deprecated.Parses the given InputStream's into a DOM Document, with or without DTD validation.abstract org.w3c.dom.Document
parse(java.io.InputStream stream, boolean isValidating, org.xml.sax.ErrorHandler errorHandler)
Deprecated.Parses the given InputStream's into a DOM Document, with or without DTD validation.abstract org.w3c.dom.Document
parse(java.io.InputStream stream, boolean isValidating, org.xml.sax.ErrorHandler errorHandler, boolean namespaceAware)
Deprecated.Parses the given InputStream's into a DOM Document, with or without DTD validation.abstract org.w3c.dom.Document
parse(java.io.InputStream stream, boolean isValidating, org.xml.sax.ErrorHandler errorHandler, boolean namespaceAware, org.xml.sax.EntityResolver entityResolver)
Deprecated.Parses the given InputStream's into a DOM Document, with or without DTD validation.abstract org.w3c.dom.Document
parse(java.io.InputStream stream, ParserParameters parameters)
Deprecated.Parses the given InputStream's contents into a DOM Document based on the given parameters.abstract org.w3c.dom.Document
parse(java.lang.String xmlString)
Deprecated.Parses the given XML String into a DOM Document, without DTD validation.abstract org.w3c.dom.Document
parse(java.lang.String xmlString, boolean isValidating)
Deprecated.Parses the given XML String into a DOM Document, with or without DTD validation.abstract org.w3c.dom.Document
parse(java.lang.String xmlString, boolean isValidating, org.xml.sax.ErrorHandler errorHandler)
Deprecated.Parses the given XML String into a DOM Document, with or without DTD validation.abstract org.w3c.dom.Document
parse(java.lang.String xmlString, boolean isValidating, org.xml.sax.ErrorHandler errorHandler, boolean namespaceAware)
Deprecated.Parses the given XML String into a DOM Document, with or without DTD validation.abstract org.w3c.dom.Document
parse(java.lang.String xmlString, boolean isValidating, org.xml.sax.ErrorHandler errorHandler, boolean namespaceAware, org.xml.sax.EntityResolver entityResolver)
Deprecated.Parses the given XML String into a DOM Document, with or without DTD validation.abstract org.w3c.dom.Document
parse(java.lang.String xmlString, ParserParameters parameters)
Deprecated.Parses the given XML String into a DOM Document based on the given parameters.abstract org.w3c.dom.Document
safeParse(java.lang.String xmlString)
Deprecated.Parses the given XML String into a DOM Document, with doctype declaration disabled.abstract java.lang.String
serialize(org.w3c.dom.Node n)
Deprecated.Serializes the given node and its children into an XML String.abstract java.lang.String
serialize(org.w3c.dom.Node n, boolean indent)
Deprecated.abstract java.lang.String
serialize(org.w3c.dom.Node n, SerializerParameters parameters)
Deprecated.Serializes the given node and its children into an XML String.
-
-
-
Method Detail
-
newInstance
public static DOMSupport newInstance()
Deprecated.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.- Returns:
- A DOMSupport instance.
-
parse
public abstract org.w3c.dom.Document parse(java.lang.String xmlString) throws XMLSupportException
Deprecated.Parses the given XML String into a DOM Document, without DTD validation.- Parameters:
xmlString
- The XML String to parse.- Returns:
- A DOM Document representing the XML string.
- Throws:
XMLSupportException
- Signals an error when parsing the XML.
-
safeParse
public abstract org.w3c.dom.Document safeParse(java.lang.String xmlString) throws XMLSupportException
Deprecated.Parses the given XML String into a DOM Document, with doctype declaration disabled.- Parameters:
xmlString
- The XML String to parse.- Returns:
- A DOM Document representing the XML string.
- Throws:
XMLSupportException
- Signals an error when parsing the XML.
-
parse
public abstract org.w3c.dom.Document parse(java.lang.String xmlString, boolean isValidating) throws XMLSupportException
Deprecated.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.- Parameters:
xmlString
- The XML String to parse.isValidating
- true if the parser produced will validate documents as they are parsed; false otherwise- Returns:
- A DOM Document representing the XML string.
- Throws:
XMLSupportException
- Signals an error when parsing the XML.
-
parse
public abstract org.w3c.dom.Document parse(java.lang.String xmlString, boolean isValidating, org.xml.sax.ErrorHandler errorHandler, boolean namespaceAware) throws XMLSupportException
Deprecated.Parses the given XML String into a DOM Document, with or without DTD validation.- Parameters:
xmlString
- The XML String to parse.isValidating
- true if the parser produced will validate documents as they are parsed; false otherwise.errorHandler
- TheErrorHandler
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.- Returns:
- A DOM Document representing the XML string.
- Throws:
XMLSupportException
- Signals an error when parsing the XML.- Since:
- MicroStrategy Web 7.5.1
-
parse
public abstract org.w3c.dom.Document parse(java.lang.String xmlString, boolean isValidating, org.xml.sax.ErrorHandler errorHandler, boolean namespaceAware, org.xml.sax.EntityResolver entityResolver) throws XMLSupportException
Deprecated.Parses the given XML String into a DOM Document, with or without DTD validation.- Parameters:
xmlString
- The XML String to parse.isValidating
- true if the parser produced will validate documents as they are parsed; false otherwise.errorHandler
- TheErrorHandler
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
- TheEntityResolver
to be used to resolve entity references.- Returns:
- A DOM Document representing the XML string.
- Throws:
XMLSupportException
- Signals an error when parsing the XML.- Since:
- MicroStrategy Web 8.0.0
-
parse
public abstract org.w3c.dom.Document parse(java.lang.String xmlString, boolean isValidating, org.xml.sax.ErrorHandler errorHandler) throws XMLSupportException
Deprecated.Parses the given XML String into a DOM Document, with or without DTD validation.- Parameters:
xmlString
- The XML String to parse.isValidating
- true if the parser produced will validate documents as they are parsed; false otherwise.errorHandler
- TheErrorHandler
to be used to report errors present in the XML document to be parsed.- Returns:
- A DOM Document representing the XML string.
- Throws:
XMLSupportException
- Signals an error when parsing the XML.
-
parse
public abstract org.w3c.dom.Document parse(java.lang.String xmlString, ParserParameters parameters) throws XMLSupportException
Deprecated.Parses the given XML String into a DOM Document based on the given parameters.- Parameters:
xmlString
- The XML String to parse.parameters
- a ParserParameters class with the parameter values.- Throws:
XMLSupportException
- Since:
- MicroStrategy Web 9.0.0
-
parse
public abstract org.w3c.dom.Document parse(java.io.InputStream stream) throws XMLSupportException
Deprecated.Parses the given InputStream's into a DOM Document, without DTD validation.- Parameters:
stream
- The input stream representing the xml to parse.- Returns:
- A DOM Document representing the XML string.
- Throws:
XMLSupportException
- Signals an error when parsing the XML.
-
parse
public abstract org.w3c.dom.Document parse(java.io.InputStream stream, boolean isValidating) throws XMLSupportException
Deprecated.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.- Parameters:
stream
- The input stream representing the xml to parse.isValidating
- true if the parser produced will validate documents as they are parsed; false otherwise- Returns:
- A DOM Document representing the XML string.
- Throws:
XMLSupportException
- Signals an error when parsing the XML.
-
parse
public abstract org.w3c.dom.Document parse(java.io.InputStream stream, boolean isValidating, org.xml.sax.ErrorHandler errorHandler) throws XMLSupportException
Deprecated.Parses the given InputStream's into a DOM Document, with or without DTD validation.- Parameters:
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
- TheErrorHandler
to be used to report errors present in the XML document to be parsed.- Returns:
- A DOM Document representing the XML string.
- Throws:
XMLSupportException
- Signals an error when parsing the XML.
-
parse
public abstract org.w3c.dom.Document parse(java.io.InputStream stream, boolean isValidating, org.xml.sax.ErrorHandler errorHandler, boolean namespaceAware) throws XMLSupportException
Deprecated.Parses the given InputStream's into a DOM Document, with or without DTD validation.- Parameters:
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
- TheErrorHandler
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.- Returns:
- A DOM Document representing the XML string.
- Throws:
XMLSupportException
- Signals an error when parsing the XML.- Since:
- MicroStrategy Web 8.0.0
-
parse
public abstract org.w3c.dom.Document parse(java.io.InputStream stream, boolean isValidating, org.xml.sax.ErrorHandler errorHandler, boolean namespaceAware, org.xml.sax.EntityResolver entityResolver) throws XMLSupportException
Deprecated.Parses the given InputStream's into a DOM Document, with or without DTD validation.- Parameters:
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
- TheErrorHandler
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
- TheEntityResolver
to be used to resolve entity references.- Returns:
- A DOM Document representing the XML string.
- Throws:
XMLSupportException
- Signals an error when parsing the XML.- Since:
- MicroStrategy Web 8.0.0
-
parse
public abstract org.w3c.dom.Document parse(java.io.InputStream stream, ParserParameters parameters) throws XMLSupportException
Deprecated.Parses the given InputStream's contents into a DOM Document based on the given parameters.- Parameters:
stream
- The input stream representing the xml to parse.parameters
- a ParserParameters class with the parameter values.- Throws:
XMLSupportException
- Since:
- MicroStrategy Web 9.0.0
-
parse
public abstract org.w3c.dom.Document parse(java.io.File f) throws XMLSupportException
Deprecated.Parses the given XML File's contents into a DOM Document, without DTD validation.- Parameters:
f
- The file to parse.- Returns:
- A DOM Document representing the XML in the file.
- Throws:
XMLSupportException
- Signals an error when parsing the XML or accessing the file.
-
parse
public abstract org.w3c.dom.Document parse(java.io.File f, boolean isValidating) throws XMLSupportException
Deprecated.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.- Parameters:
f
- The file to parse.isValidating
- true if the parser produced will validate documents as they are parsed; false otherwise- Returns:
- A DOM Document representing the XML in the file.
- Throws:
XMLSupportException
- Signals an error when parsing the XML or accessing the file.
-
parse
public abstract org.w3c.dom.Document parse(java.io.File f, boolean isValidating, org.xml.sax.ErrorHandler errorHandler) throws XMLSupportException
Deprecated.Parses the given XML File's contents into a DOM Document, with or without DTD validation.- Parameters:
f
- The file to parse.isValidating
- true if the parser produced will validate documents as they are parsed; false otherwise.errorHandler
- TheErrorHandler
to be used to report errors present in the XML document to be parsed.- Returns:
- A DOM Document representing the XML in the file.
- Throws:
XMLSupportException
- Signals an error when parsing the XML or accessing the file.
-
parse
public abstract org.w3c.dom.Document parse(java.io.File f, boolean isValidating, org.xml.sax.ErrorHandler errorHandler, boolean namespaceAware) throws XMLSupportException
Deprecated.Parses the given XML File's contents into a DOM Document, with or without DTD validation, with or with namespace awareness.- Parameters:
f
- The file to parse.isValidating
- true if the parser produced will validate documents as they are parsed; false otherwise.errorHandler
- TheErrorHandler
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.- Returns:
- A DOM Document representing the XML in the file.
- Throws:
XMLSupportException
- Signals an error when parsing the XML or accessing the file.
-
parse
public abstract org.w3c.dom.Document parse(java.io.File f, boolean isValidating, org.xml.sax.ErrorHandler errorHandler, boolean namespaceAware, org.xml.sax.EntityResolver entityResolver) throws XMLSupportException
Deprecated.Parses the given XML File's contents into a DOM Document, with or without DTD validation, with or without namespace awareness.- Parameters:
f
- The file to parse.isValidating
- true if the parser produced will validate documents as they are parsed; false otherwise.errorHandler
- TheErrorHandler
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
- TheEntityResolver
to be used to resolve entity references.- Returns:
- A DOM Document representing the XML in the file.
- Throws:
XMLSupportException
- Signals an error when parsing the XML or accessing the file.- Since:
- MicroStrategy Web 8.0.0
-
parse
public abstract org.w3c.dom.Document parse(java.io.File f, ParserParameters parameters) throws XMLSupportException
Deprecated.Parses the given XML File's contents into a DOM Document based on the given parameters.- Parameters:
f
- The file to parse.parameters
- a ParserParameters class with the parameter values.- Throws:
XMLSupportException
- Since:
- MicroStrategy Web 9.0.0
-
serialize
public abstract java.lang.String serialize(org.w3c.dom.Node n)
Deprecated.Serializes the given node and its children into an XML String.- Parameters:
n
- An XML Node, which will be serialized into an XML String.- Returns:
- A String representing the given XML tree fragment.
-
serialize
public abstract java.lang.String serialize(org.w3c.dom.Node n, boolean indent)
Deprecated.
-
serialize
public abstract java.lang.String serialize(org.w3c.dom.Node n, SerializerParameters parameters)
Deprecated.Serializes the given node and its children into an XML String.- Parameters:
n
- An XML Node, which will be serialized into an XML String.parameters
- a SerializerParameters class with the parameter values.- Returns:
- A String representing the given XML tree fragment.
- Since:
- MicroStrategy Web 9.0.0
-
newDocument
public abstract org.w3c.dom.Document newDocument() throws XMLSupportRuntimeException
Deprecated.Returns a new DOM Document, with no elements in it.- Returns:
- A new DOM Document.
- Throws:
XMLSupportRuntimeException
- Signals an error when creating the new document. This generally signals a configuration error in the XML parser/XSL processor libraries.
-
getChild
public abstract org.w3c.dom.Node getChild(org.w3c.dom.Node contextNode, java.lang.String nodeName)
Deprecated.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.- Parameters:
contextNode
- The node whose child will be traversed to.nodeName
- The name of the child node- Returns:
- The first node with the given node name, or null if none exists.
- Since:
- MicroStrategy Web 7.5.2
-
getChildren
public abstract org.w3c.dom.NodeList getChildren(org.w3c.dom.Node contextNode, java.lang.String nodeName)
Deprecated.Returns a list of children of the context node with the given node name.- Parameters:
contextNode
- The node to search from.nodeName
- The name of the child nodes to return.- Returns:
- A NodeList containing those nodes which are children of the context node with the given node name.
- Since:
- MicroStrategy Web 7.5.2
-
getDescendents
public abstract org.w3c.dom.NodeList getDescendents(org.w3c.dom.Node contextNode, java.lang.String reducedXPath) throws java.lang.IllegalArgumentException
Deprecated.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:
- Traversal to elements, attributes, or text nodes
- / at beginning of path to start at root of document and ./ to start at current node
- Parameters:
contextNode
- The context node for the reduced XPath expression.reducedXPath
- The reduced XPath expression to execute.- Returns:
- A NodeList containing the nodes fitting the condition.
- Throws:
java.lang.IllegalArgumentException
- Thrown if the reduced XPath expression is invalid.- Since:
- MicroStrategy Web 7.5.2
-
getDescendent
public abstract org.w3c.dom.Node getDescendent(org.w3c.dom.Node contextNode, java.lang.String reducedXPath) throws java.lang.IllegalArgumentException
Deprecated.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.- Parameters:
contextNode
- The context node for the reduced XPath expression.reducedXPath
- The reduced XPath expression to execute.- Returns:
- A Node containing the first node found that fits the condition.
- Throws:
java.lang.IllegalArgumentException
- Thrown if the reduced XPath expression is invalid.- Since:
- MicroStrategy Web 7.5.2
-
-