Package org.frankframework.util
Class XmlUtils
java.lang.Object
org.frankframework.util.XmlUtils
Some utilities for working with XML.
- Author:
- Johan Verrips
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final int
static final XMLEventFactory
static final String
static final XMLInputFactory
static final String
static final XMLOutputFactory
static final XMLOutputFactory
static final String
static final int
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
addRootNamespace
(String input, String namespace) static boolean
attributesEqual
(Attribute attribute1, Attribute attribute2) static Document
static Document
buildDomDocument
(Reader in, boolean namespaceAware) static Document
buildDomDocument
(Reader in, boolean namespaceAware, boolean resolveExternalEntities) static Document
Convert an XML string to a Document Creation date: (20-02-2003 8:12:52)static Document
buildDomDocument
(String s, boolean namespaceAware) static Document
buildDomDocument
(String s, boolean namespaceAware, boolean resolveExternalEntities) static Document
buildDomDocument
(URL url) Build a Document from a URLstatic Document
buildDomDocument
(InputSource src, boolean namespaceAware) static Document
buildDomDocument
(InputSource src, boolean namespaceAware, boolean resolveExternalEntities) static Element
Convert an XML string to a Document, then return the root-element.static Element
buildElement
(String s, boolean namespaceAware) Convert an XML string to a Document, then return the root-elementstatic Element
static Node
static Node
Convert an XML string to a Document, then return the root-element as a Nodestatic String
canonicalize
(String input) static String
cdataToText
(String input) static String
cleanseElementName
(String candidateName) static String
convertEndOfLines
(String input) static String
copyOfSelect
(String input, String xpath) static Transformer
createTransformer
(String xsltString) static Transformer
createTransformer
(String xsltString, int xsltVersion) static Transformer
createTransformer
(URL url) static Transformer
createTransformer
(URL url, int xsltVersion) static Transformer
createTransformer
(Source source, int xsltVersion) static String
createXPathEvaluatorSource
(String xPathExpression) Create an XSLT stylesheet that can be used to evaluate the xpath expression passed in.static String
createXPathEvaluatorSource
(String namespaceDefs, String xPathExpression, TransformerPool.OutputType outputMethod) Create an XSLT stylesheet that can be used to evaluate the xpath expression passed in, in the given namespaces.static String
createXPathEvaluatorSource
(String namespaceDefs, String xPathExpression, TransformerPool.OutputType outputMethod, boolean includeXmlDeclaration, boolean stripSpace) Create an XSLT stylesheet that can be used to evaluate the xpath expression passed in, in the given namespaces.static String
createXPathEvaluatorSource
(String namespaceDefs, String xPathExpression, TransformerPool.OutputType outputMethod, boolean includeXmlDeclaration, ParameterList params, boolean stripSpace, boolean ignoreNamespaces, String separator, int xsltVersion) Create an XSLT stylesheet that can be used to evaluate the xpath expression passed in, in the given namespaces.static String
createXPathEvaluatorSource
(Function<String, String> xpathContainerSupplier, String xPathExpression, TransformerPool.OutputType outputMethod, boolean includeXmlDeclaration, ParameterList params, boolean stripSpace, boolean ignoreNamespaces, int xsltVersion) Create an XSLT stylesheet that can be used to evaluate the xpath expression passed in, in the given namespaces.static int
detectXsltVersion
(String xsltString) static int
detectXsltVersion
(URL xsltUrl) static String
encodes a urlstatic Collection<String>
evaluateXPathNodeSet
(String input, String xpathExpr) evaluateXPathNodeSet
(String input, String xpathExpr, String keyElement, String valueElement) static String
evaluateXPathNodeSetFirstElement
(String input, String xpathExpr) static Double
evaluateXPathNumber
(String input, String xpathExpr) static TransformerPool
getAddRootNamespaceTransformerPool
(String namespace, boolean omitXmlDeclaration, boolean indent) static int
static TransformerPool
getChangeRootTransformerPool
(String root, boolean omitXmlDeclaration, boolean indent) static boolean
getChildTagAsBoolean
(Element el, String tag) Method getChildTagAsBoolean.static boolean
getChildTagAsBoolean
(Element el, String tag, boolean defaultValue) Method getChildTagAsBoolean.static long
getChildTagAsLong
(Element el, String tag) Method getChildTagAsLong.static long
getChildTagAsLong
(Element el, String tag, long defaultValue) Method getChildTagAsLong.static String
getChildTagAsString
(Element el, String tag) Method getChildTagAsString.static String
getChildTagAsString
(Element el, String tag, String defaultValue) Method getChildTagAsString.static Collection<Node>
getChildTags
(Element el, String tag) Method getChildTags.static TransformerPool
getCopyOfSelectTransformerPool
(String xpath, boolean omitXmlDeclaration, boolean indent) static TransformerPool
static DocumentBuilderFactory
static DocumentBuilderFactory
getDocumentBuilderFactory
(boolean namespaceAware) static Element
getFirstChildTag
(Element el, String tag) Method getFirstChildTag.static TransformerPool
static TransformerPool
static TransformerPool
static String
getNamespaceClause
(String namespaceDefs) getNamespaceMap
(String namespaceDefs) static TransformerPool
getRemoveUnusedNamespacesTransformerPool
(boolean omitXmlDeclaration, boolean indent) static TransformerPool
getRemoveUnusedNamespacesXslt2TransformerPool
(boolean omitXmlDeclaration, boolean indent) static String
getRootNamespace
(String input) static SAXParserFactory
static SAXParserFactory
getSAXParserFactory
(boolean namespaceAware) static String
static String
getStringValue
(Element el, boolean trimWhitespace) static TransformerFactory
static TransformerFactory
getTransformerFactory
(int xsltVersion) static TransformerFactory
getTransformerFactory
(int xsltVersion, ErrorListener errorListener) static ValidatorHandler
getValidatorHandler
(URL schemaURL) static ValidatorHandler
getValidatorHandler
(Source schemaSource) static XMLReader
getXMLReader
(IScopeProvider scopeProvider) static XMLReader
getXMLReader
(ContentHandler handler) static XPathFactory
static XPathFactory
getXPathFactory
(int xsltVersion) getXsltConfig
(Source source) static SAXSource
inputSourceToSAXSource
(Resource resource) static SAXSource
static SAXSource
inputSourceToSAXSource
(InputSource is, boolean namespaceAware, Resource scopeProvider) static int
interpretXsltVersion
(String xsltVersion) static boolean
static boolean
static boolean
static boolean
isWellFormed
(String input) static boolean
isWellFormed
(String input, String root) static boolean
isWellFormed
(Message input, String root) static boolean
static StartElement
mergeAttributes
(StartElement tag, Iterator<? extends Attribute> attrs, Iterator<? extends Namespace> nsps, XMLEventFactory factory) LikeXMLStreamUtils.mergeAttributes(javax.xml.stream.events.StartElement, java.util.Iterator, javax.xml.stream.XMLEventFactory)
but it can also merge namespacesstatic byte[]
nodeToByteArray
(Node node) static byte[]
nodeToByteArray
(Node node, boolean omitXmlDeclaration) static String
nodeToString
(Node node) static String
nodeToString
(Node node, boolean useIndentation) static String
normalizeAttributeValue
(String input) static String
normalizeWhitespace
(String input) static void
parseNodeSet
(String source, ContentHandler handler) likeparseXml(String source, ContentHandler handler)
, but skips startDocument() and endDocument().static void
parseXml
(String source, ContentHandler handler) static void
parseXml
(Resource resource, ContentHandler handler) static void
parseXml
(InputSource inputSource, ContentHandler handler) static void
parseXml
(InputSource inputSource, ContentHandler handler, ErrorHandler errorHandler) static Date
Parses a string to a Date using XML Schema dateTime data type (GDate)static String
removeNamespaces
(String input) static Message
removeNamespaces
(Message input) static void
setTransformerParameters
(Transformer t, Map<String, Object> parameters) sets all the parameters of the transformer using a Map with parameter values.static String
skipDocTypeDeclaration
(String xmlString) static String
skipXmlDeclaration
(String xmlString) static String
source2String
(Source source) static Source
stringToSource
(String xmlString) static Source
stringToSource
(String xmlString, boolean namespaceAware) Converts a string containing xml-markup to a Source-object, that can be used as the input of a XSLT-transformer.static Source
stringToSourceForSingleUse
(String xmlString) static Source
stringToSourceForSingleUse
(String xmlString, boolean namespaceAware) static String
static String
transformXml
(Transformer t, String s) static String
transformXml
(Transformer t, String s, boolean namespaceAware) static String
transformXml
(Transformer t, Source s)
-
Field Details
-
DEFAULT_XSLT_VERSION
public static final int DEFAULT_XSLT_VERSION -
NAMESPACE_AWARE_BY_DEFAULT_KEY
- See Also:
-
XSLT_STREAMING_BY_DEFAULT_KEY
- See Also:
-
AUTO_RELOAD_KEY
- See Also:
-
XSLT_BUFFERSIZE_KEY
- See Also:
-
XSLT_BUFFERSIZE_DEFAULT
public static final int XSLT_BUFFERSIZE_DEFAULT- See Also:
-
INCLUDE_FIELD_DEFINITION_BY_DEFAULT_KEY
- See Also:
-
XPATH_GETROOTNODENAME
- See Also:
-
EVENT_FACTORY
-
INPUT_FACTORY
-
OUTPUT_FACTORY
-
REPAIR_NAMESPACES_OUTPUT_FACTORY
-
-
Constructor Details
-
XmlUtils
public XmlUtils()
-
-
Method Details
-
parseXmlDateTime
Parses a string to a Date using XML Schema dateTime data type (GDate) -
getDetectXsltVersionTransformerPool
- Throws:
TransformerException
-
getGetXsltConfigTransformerPool
- Throws:
TransformerException
-
getXsltConfig
public static Map<String,String> getXsltConfig(Source source) throws TransformerException, IOException - Throws:
TransformerException
IOException
-
getGetRootNodeNameTransformerPool
- Throws:
ConfigurationException
-
getGetRootNamespaceTransformerPool
- Throws:
ConfigurationException
-
getAddRootNamespaceTransformerPool
public static TransformerPool getAddRootNamespaceTransformerPool(String namespace, boolean omitXmlDeclaration, boolean indent) throws ConfigurationException - Throws:
ConfigurationException
-
getChangeRootTransformerPool
public static TransformerPool getChangeRootTransformerPool(String root, boolean omitXmlDeclaration, boolean indent) throws ConfigurationException - Throws:
ConfigurationException
-
getRemoveUnusedNamespacesTransformerPool
public static TransformerPool getRemoveUnusedNamespacesTransformerPool(boolean omitXmlDeclaration, boolean indent) throws ConfigurationException - Throws:
ConfigurationException
-
getRemoveUnusedNamespacesXslt2TransformerPool
public static TransformerPool getRemoveUnusedNamespacesXslt2TransformerPool(boolean omitXmlDeclaration, boolean indent) throws ConfigurationException - Throws:
ConfigurationException
-
getCopyOfSelectTransformerPool
public static TransformerPool getCopyOfSelectTransformerPool(String xpath, boolean omitXmlDeclaration, boolean indent) throws ConfigurationException - Throws:
ConfigurationException
-
isNamespaceAwareByDefault
public static boolean isNamespaceAwareByDefault() -
isXsltStreamingByDefault
public static boolean isXsltStreamingByDefault() -
isIncludeFieldDefinitionByDefault
public static boolean isIncludeFieldDefinitionByDefault() -
isAutoReload
public static boolean isAutoReload() -
getBufSize
public static int getBufSize() -
parseXml
public static void parseXml(Resource resource, ContentHandler handler) throws IOException, SAXException - Throws:
IOException
SAXException
-
parseXml
- Throws:
IOException
SAXException
-
parseNodeSet
public static void parseNodeSet(String source, ContentHandler handler) throws IOException, SAXException likeparseXml(String source, ContentHandler handler)
, but skips startDocument() and endDocument(). Can be used to parse a string and inject its events in an existing SAX event stream.- Throws:
IOException
SAXException
-
parseXml
public static void parseXml(InputSource inputSource, ContentHandler handler) throws IOException, SAXException - Throws:
IOException
SAXException
-
parseXml
public static void parseXml(InputSource inputSource, ContentHandler handler, ErrorHandler errorHandler) throws IOException, SAXException - Throws:
IOException
SAXException
-
getXMLReader
public static XMLReader getXMLReader(ContentHandler handler) throws ParserConfigurationException, SAXException -
getXMLReader
public static XMLReader getXMLReader(IScopeProvider scopeProvider) throws ParserConfigurationException, SAXException -
buildDomDocument
- Throws:
DomBuilderException
-
buildDomDocument
public static Document buildDomDocument(Reader in, boolean namespaceAware) throws DomBuilderException - Throws:
DomBuilderException
-
buildDomDocument
public static Document buildDomDocument(InputSource src, boolean namespaceAware) throws DomBuilderException - Throws:
DomBuilderException
-
buildDomDocument
public static Document buildDomDocument(InputSource src, boolean namespaceAware, boolean resolveExternalEntities) throws DomBuilderException - Throws:
DomBuilderException
-
buildDomDocument
public static Document buildDomDocument(Reader in, boolean namespaceAware, boolean resolveExternalEntities) throws DomBuilderException - Throws:
DomBuilderException
-
buildDomDocument
Convert an XML string to a Document Creation date: (20-02-2003 8:12:52)- Throws:
DomBuilderException
-
buildDomDocument
public static Document buildDomDocument(String s, boolean namespaceAware) throws DomBuilderException - Throws:
DomBuilderException
-
buildDomDocument
public static Document buildDomDocument(String s, boolean namespaceAware, boolean resolveExternalEntities) throws DomBuilderException - Throws:
DomBuilderException
-
buildDomDocument
Build a Document from a URL- Throws:
DomBuilderException
-
buildElement
Convert an XML string to a Document, then return the root-element- Throws:
DomBuilderException
-
buildNode
Convert an XML string to a Document, then return the root-element as a Node- Throws:
DomBuilderException
-
buildNode
- Throws:
DomBuilderException
-
buildElement
Convert an XML string to a Document, then return the root-element. (namespace aware)- Throws:
DomBuilderException
-
buildElement
- Throws:
DomBuilderException
-
skipXmlDeclaration
-
skipDocTypeDeclaration
-
getNamespaceClause
-
getNamespaceMap
-
createXPathEvaluatorSource
Create an XSLT stylesheet that can be used to evaluate the xpath expression passed in. The stylesheet will result in TEXT output. The stylesheet XSLT version will beDEFAULT_XSLT_VERSION
.- Parameters:
xPathExpression
- The XPath Expression to evaluate- Returns:
- An XSLT stylesheet generated to evaluate the XPath Expression
-
createXPathEvaluatorSource
@Nonnull public static String createXPathEvaluatorSource(@Nullable String namespaceDefs, @Nonnull String xPathExpression, @Nonnull TransformerPool.OutputType outputMethod) Create an XSLT stylesheet that can be used to evaluate the xpath expression passed in, in the given namespaces. The stylesheet output type will be determined by the outputMethod parameter. The stylesheet XSLT version will beDEFAULT_XSLT_VERSION
.- Parameters:
namespaceDefs
- Definitions of the namespaces in which to evaluate the XPath Expression.xPathExpression
- The XPath Expression to evaluateoutputMethod
- Type of output as perTransformerPool.OutputType
.- Returns:
- An XSLT stylesheet generated to evaluate the XPath Expression
-
createXPathEvaluatorSource
@Nonnull public static String createXPathEvaluatorSource(@Nullable String namespaceDefs, @Nonnull String xPathExpression, @Nonnull TransformerPool.OutputType outputMethod, boolean includeXmlDeclaration, boolean stripSpace) Create an XSLT stylesheet that can be used to evaluate the xpath expression passed in, in the given namespaces. The stylesheet output type will be determined by the outputMethod parameter. The stylesheet XSLT version will beDEFAULT_XSLT_VERSION
.- Parameters:
namespaceDefs
- Definitions of the namespaces in which to evaluate the XPath Expression.xPathExpression
- The XPath Expression to evaluateoutputMethod
- Type of output as perTransformerPool.OutputType
. If outputMethod isTransformerPool.OutputType.XML
then the resulting stylesheet will use thecopy-of
method instead ofvalue-of
.includeXmlDeclaration
- If true, and outputMethod isTransformerPool.OutputType.XML
then include XML declaration in the output after the XSLT is applied.stripSpace
- If true then strip spaces in the output.- Returns:
- An XSLT stylesheet generated to evaluate the XPath Expression
-
createXPathEvaluatorSource
@Nonnull public static String createXPathEvaluatorSource(@Nullable String namespaceDefs, @Nonnull String xPathExpression, @Nonnull TransformerPool.OutputType outputMethod, boolean includeXmlDeclaration, @Nullable ParameterList params, boolean stripSpace, boolean ignoreNamespaces, String separator, int xsltVersion) Create an XSLT stylesheet that can be used to evaluate the xpath expression passed in, in the given namespaces. The stylesheet output type will be determined by the outputMethod parameter.- Parameters:
namespaceDefs
- Definitions of the namespaces in which to evaluate the XPath Expression.xPathExpression
- The XPath Expression to evaluateoutputMethod
- Type of output as perTransformerPool.OutputType
. If outputMethod isTransformerPool.OutputType.XML
then the resulting stylesheet will use thecopy-of
method instead ofvalue-of
.includeXmlDeclaration
- If true, and outputMethod isTransformerPool.OutputType.XML
then include XML declaration in the output after the XSLT is applied.params
- AParameterList
to evaluate while generating the stylesheet.stripSpace
- If true then strip spaces in the output.ignoreNamespaces
- If true then namespaces are ignored during the evaluation.separator
- Separator between values if output method isTransformerPool.OutputType.TEXT
.xsltVersion
- Version of XSLT for which to generate the stylesheet. Can be 0, 1, or 2. If 0, thenDEFAULT_XSLT_VERSION
is used.- Returns:
- An XSLT stylesheet generated to evaluate the XPath Expression
-
createXPathEvaluatorSource
@Nonnull public static String createXPathEvaluatorSource(@Nonnull Function<String, String> xpathContainerSupplier, @Nonnull String xPathExpression, @Nonnull TransformerPool.OutputType outputMethod, boolean includeXmlDeclaration, @Nullable ParameterList params, boolean stripSpace, boolean ignoreNamespaces, int xsltVersion) Create an XSLT stylesheet that can be used to evaluate the xpath expression passed in, in the given namespaces. The stylesheet output type will be determined by the outputMethod parameter.- Parameters:
xpathContainerSupplier
- A supplier function to transform the XPath expression to the required XSLT tags for generating the output that is desired.xPathExpression
- The XPath Expression to evaluateoutputMethod
- Type of output as perTransformerPool.OutputType
. If outputMethod isTransformerPool.OutputType.XML
then the resulting stylesheet will use thecopy-of
method instead ofvalue-of
.includeXmlDeclaration
- If true, and outputMethod isTransformerPool.OutputType.XML
then include XML declaration in the output after the XSLT is applied.params
- AParameterList
to evaluate while generating the stylesheet.stripSpace
- If true then strip spaces in the output.ignoreNamespaces
- If true then namespaces are ignored during the evaluation.xsltVersion
- Version of XSLT for which to generate the stylesheet. Can be 0, 1, or 2. If 0, thenDEFAULT_XSLT_VERSION
is used.- Returns:
- An XSLT stylesheet generated to evaluate the XPath Expression
-
stringToSource
public static Source stringToSource(String xmlString, boolean namespaceAware) throws DomBuilderException Converts a string containing xml-markup to a Source-object, that can be used as the input of a XSLT-transformer. The source may be used multiple times.- Throws:
DomBuilderException
-
stringToSource
- Throws:
DomBuilderException
-
stringToSourceForSingleUse
- Throws:
SAXException
-
stringToSourceForSingleUse
public static Source stringToSourceForSingleUse(String xmlString, boolean namespaceAware) throws SAXException - Throws:
SAXException
-
inputSourceToSAXSource
- Throws:
SAXException
IOException
-
inputSourceToSAXSource
- Throws:
SAXException
-
inputSourceToSAXSource
public static SAXSource inputSourceToSAXSource(InputSource is, boolean namespaceAware, Resource scopeProvider) throws SAXException - Throws:
SAXException
-
interpretXsltVersion
-
detectXsltVersion
-
detectXsltVersion
-
createTransformer
public static Transformer createTransformer(String xsltString) throws TransformerConfigurationException -
createTransformer
public static Transformer createTransformer(String xsltString, int xsltVersion) throws TransformerConfigurationException -
createTransformer
-
createTransformer
public static Transformer createTransformer(URL url, int xsltVersion) throws TransformerConfigurationException, IOException -
createTransformer
public static Transformer createTransformer(Source source, int xsltVersion) throws TransformerConfigurationException -
getTransformerFactory
-
getTransformerFactory
-
getTransformerFactory
public static TransformerFactory getTransformerFactory(int xsltVersion, ErrorListener errorListener) -
getDocumentBuilderFactory
-
getDocumentBuilderFactory
-
getSAXParserFactory
-
getSAXParserFactory
-
convertEndOfLines
-
normalizeWhitespace
-
normalizeAttributeValue
-
cleanseElementName
-
encodeURL
encodes a url -
getChildTagAsBoolean
Method getChildTagAsBoolean. Return the boolean-value of the first element with tagtag
in the DOM subtreeel
.To determine true or false, the value of the tag is compared case- insensitive with the values
true
,yes
, oron
. If it matches,true
is returned. If not,false
is returned.If the tag can not be found,
false
is returned.- Parameters:
el
- DOM subtreetag
- Name of tag to find- Returns:
- boolean The value found.
-
getChildTagAsBoolean
Method getChildTagAsBoolean. Return the boolean-value of the first element with tagtag
in the DOM subtreeel
.To determine true or false, the value of the tag is compared case- insensitive with the values
true
,yes
, oron
. If it matches,true
is returned. If not,false
is returned.If the tag can not be found, the default-value is returned.
- Parameters:
el
- DOM subtreetag
- Name of tag to finddefaultValue
- Default-value in case tag can not be found.- Returns:
- boolean The value found.
-
getChildTagAsLong
Method getChildTagAsLong. Return the long integer-value of the first element with tagtag
in the DOM subtreeel
.- Parameters:
el
- DOM subtreetag
- Name of tag to find- Returns:
- long The value found. Returns 0 if no tag can be found, or if the tag doesn't have an integer-value.
-
getChildTagAsLong
Method getChildTagAsLong. Return the long integer-value of the first element with tagtag
in the DOM subtreeel
.- Parameters:
el
- DOM subtreetag
- Name of tag to finddefaultValue
- Default-value in case tag can not be found, or is not numeric.- Returns:
- long The value found.
-
getChildTagAsString
Method getChildTagAsString. Return the value of the first element with tagtag
in the DOM subtreeel
.- Parameters:
el
- DOM subtreetag
- Name of tag to find- Returns:
- String The value found, or null if no matching tag is found.
-
getChildTagAsString
Method getChildTagAsString. Return the value of the first element with tagtag
in the DOM subtreeel
.- Parameters:
el
- DOM subtreetag
- Name of tag to finddefaultValue
- Default-value in case tag can not be found.- Returns:
- String The value found.
-
getChildTags
Method getChildTags. Get all direct children of given element which match the given tag. This method only looks at the direct children of the given node, and doesn't descent deeper into the tree. If a '*' is passed as tag, all elements are returned.- Parameters:
el
- Element where to get children fromtag
- Tag to match. Use '*' to match all tags.- Returns:
- Collection Collection containing all elements found. If
size() returns 0, then no matching elements
were found. All items in the collection can
be safely cast to type
org.w3c.dom.Element
.
-
getFirstChildTag
Method getFirstChildTag. Return the first child-node which is an element with tagName equal to given tag. This method only looks at the direct children of the given node, and doesn't descent deeper into the tree.- Parameters:
el
- Element where to get children fromtag
- Tag to match- Returns:
- Element The element found, or
null
if no match found.
-
getStringValue
-
getStringValue
-
setTransformerParameters
public static void setTransformerParameters(Transformer t, Map<String, Object> parameters) throws IOExceptionsets all the parameters of the transformer using a Map with parameter values.- Throws:
IOException
- If an IOException occurs.
-
transformXml
public static String transformXml(Transformer t, String s) throws TransformerException, IOException, SAXException -
transformXml
public static String transformXml(Transformer t, String s, boolean namespaceAware) throws TransformerException, IOException, SAXException -
transformXml
- Throws:
TransformerException
IOException
-
isWellFormed
-
isWellFormed
-
isWellFormed
-
getVersionInfo
-
source2String
- Throws:
TransformerException
-
removeNamespaces
- Throws:
XmlException
-
removeNamespaces
- Throws:
XmlException
-
getRootNamespace
-
addRootNamespace
-
copyOfSelect
-
canonicalize
- Throws:
IOException
-
nodeToString
- Throws:
TransformerException
-
nodeToString
- Throws:
TransformerException
-
nodeToByteArray
- Throws:
TransformerException
-
nodeToByteArray
public static byte[] nodeToByteArray(Node node, boolean omitXmlDeclaration) throws TransformerException - Throws:
TransformerException
-
cdataToText
-
mergeAttributes
public static StartElement mergeAttributes(StartElement tag, Iterator<? extends Attribute> attrs, Iterator<? extends Namespace> nsps, XMLEventFactory factory) LikeXMLStreamUtils.mergeAttributes(javax.xml.stream.events.StartElement, java.util.Iterator, javax.xml.stream.XMLEventFactory)
but it can also merge namespaces -
attributesEqual
-
evaluateXPathNodeSet
public static Collection<String> evaluateXPathNodeSet(String input, String xpathExpr) throws XmlException - Throws:
XmlException
-
evaluateXPathNodeSetFirstElement
public static String evaluateXPathNodeSetFirstElement(String input, String xpathExpr) throws XmlException - Throws:
XmlException
-
evaluateXPathNumber
- Throws:
XmlException
-
evaluateXPathNodeSet
public static Map<String,String> evaluateXPathNodeSet(String input, String xpathExpr, String keyElement, String valueElement) throws XmlException - Throws:
XmlException
-
toXhtml
- Throws:
IOException
-
getXPathFactory
-
getXPathFactory
-
getValidatorHandler
- Throws:
SAXException
-
getValidatorHandler
- Throws:
SAXException
-