Class Convert
- java.lang.Object
-
- org.xmlunit.util.Convert
-
public final class Convert extends java.lang.Object
Conversion methods.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Convert()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.w3c.dom.Document
toDocument(javax.xml.transform.Source s)
Creates a DOM Document from a TraX Source.static org.w3c.dom.Document
toDocument(javax.xml.transform.Source s, javax.xml.parsers.DocumentBuilderFactory factory)
Creates a DOM Document from a TraX Source.static org.xml.sax.InputSource
toInputSource(javax.xml.transform.Source s)
Creates a SAX InputSource from a TraX Source.static org.xml.sax.InputSource
toInputSource(javax.xml.transform.Source s, javax.xml.transform.TransformerFactory fac)
Creates a SAX InputSource from a TraX Source.static javax.xml.namespace.NamespaceContext
toNamespaceContext(java.util.Map<java.lang.String,java.lang.String> prefix2URI)
Creates a JAXP NamespaceContext from a Map prefix => Namespace URI.static org.w3c.dom.Node
toNode(javax.xml.transform.Source s)
Creates a DOM Node from a TraX Source.static org.w3c.dom.Node
toNode(javax.xml.transform.Source s, javax.xml.parsers.DocumentBuilderFactory factory)
Creates a DOM Node from a TraX Source.private static org.w3c.dom.Document
tryExtractDocFromDOMSource(javax.xml.transform.Source s)
private static org.w3c.dom.Node
tryExtractNodeFromDOMSource(javax.xml.transform.Source s)
-
-
-
Method Detail
-
toInputSource
public static org.xml.sax.InputSource toInputSource(javax.xml.transform.Source s)
Creates a SAX InputSource from a TraX Source.May use an XSLT identity transformation if SAXSource cannot convert it directly.
- Parameters:
s
- the source to convert
-
toInputSource
public static org.xml.sax.InputSource toInputSource(javax.xml.transform.Source s, javax.xml.transform.TransformerFactory fac)
Creates a SAX InputSource from a TraX Source.May use an XSLT identity transformation if SAXSource cannot convert it directly.
- Parameters:
s
- the source to convertfac
- the TransformerFactory to use, will use the defaul factory if the value is null.
-
toDocument
public static org.w3c.dom.Document toDocument(javax.xml.transform.Source s)
Creates a DOM Document from a TraX Source.If the source is a
DOMSource
holding a Document Node, this one will be returned. OtherwisetoInputSource(javax.xml.transform.Source)
and a namespace aware DocumentBuilder (created by the default DocumentBuilderFactory) will be used to read the source. This may involve an XSLT identity transform in toInputSource.
-
toDocument
public static org.w3c.dom.Document toDocument(javax.xml.transform.Source s, javax.xml.parsers.DocumentBuilderFactory factory)
Creates a DOM Document from a TraX Source.If the source is a
DOMSource
holding a Document Node, this one will be returned. OtherwisetoInputSource(javax.xml.transform.Source)
and a namespace aware DocumentBuilder (created by given DocumentBuilderFactory) will be used to read the source. This may involve an XSLT identity transform in toInputSource.
-
tryExtractDocFromDOMSource
private static org.w3c.dom.Document tryExtractDocFromDOMSource(javax.xml.transform.Source s)
-
toNode
public static org.w3c.dom.Node toNode(javax.xml.transform.Source s)
Creates a DOM Node from a TraX Source.If the source is a
DOMSource
its Node will be returned, otherwise this delegates totoDocument(javax.xml.transform.Source)
.
-
toNode
public static org.w3c.dom.Node toNode(javax.xml.transform.Source s, javax.xml.parsers.DocumentBuilderFactory factory)
Creates a DOM Node from a TraX Source.If the source is a
DOMSource
its Node will be returned, otherwise this delegates totoDocument(javax.xml.transform.Source)
.
-
tryExtractNodeFromDOMSource
private static org.w3c.dom.Node tryExtractNodeFromDOMSource(javax.xml.transform.Source s)
-
toNamespaceContext
public static javax.xml.namespace.NamespaceContext toNamespaceContext(java.util.Map<java.lang.String,java.lang.String> prefix2URI)
Creates a JAXP NamespaceContext from a Map prefix => Namespace URI.
-
-