public class XMLTools
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
kProfilePassAll
Profile constant for passing all characters unchanged.
|
static int |
kProfileXML10
Profile constant for passing only characters that are valid XML 1.0.
|
static LogSource |
logger |
Constructor and Description |
---|
XMLTools() |
Modifier and Type | Method and Description |
---|---|
static org.w3c.dom.Node |
appendChildren(org.w3c.dom.Node dest,
org.w3c.dom.Node src)
Appends all children(!)
|
static java.lang.String |
calcNodeLocationInfo(org.w3c.dom.Node n)
Returns approximate XPath indicating where the passed node is in the document tree.
|
static void |
chainSaxon6(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy inXML,
OutputProxy outXML,
java.util.ArrayList transformations)
chains several transformationsone one after another.
|
static void |
chainSaxon9B(de.infinityloop.util.markup.XMLProcessingConfiguration config,
org.w3c.dom.Document inDOM,
OutputProxy outXML,
java.util.ArrayList transformations)
chains several transformationsone one after another.
|
static void |
chainSaxon9B(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy inXML,
OutputProxy outXML,
java.util.ArrayList transformations)
chains several transformationsone one after another.
|
static void |
chainSaxon9BWithIntermediates(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy inXML,
OutputProxy outXML,
java.util.ArrayList transformations,
java.lang.String intermediateDir)
chains several transformations one after another.
|
static void |
chainXalan(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy inXML,
OutputProxy outXML,
java.util.ArrayList transformations)
chains several transformationsone one after another.
|
static void |
chainXalanWithIntermediates(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy inXML,
OutputProxy outXML,
java.util.ArrayList transformations,
java.lang.String intermediateDir)
chains several transformationsone one after another.
|
static void |
checkWellformedness(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy theFile)
Perform a check for well-formedness on the specified file.
|
static java.lang.String |
collectTextNodesContent(org.w3c.dom.DocumentFragment df)
Collect text-only contents on this DocumentFragment, possibly with filter on element names
|
static java.lang.String |
collectTextNodesContent(org.w3c.dom.Node curNode,
de.infinityloop.upcast.util.namespace.QualifiedNameList elementFilter)
Collect text-only contents on this Node, possibly with filter on element names.
|
static java.lang.String |
collectTextNodesContentAndEmpties(org.w3c.dom.Node curNode,
de.infinityloop.upcast.util.namespace.QualifiedNameList emptyElementFilter)
Collect text-only contents on this Node, with special handling for the specified elements if they are empty, which are serialized to the special form "<
|
static java.lang.String |
collectTextNodesContentWithImageIndicator(org.w3c.dom.Node curNode,
de.infinityloop.upcast.util.namespace.QualifiedNameList elementFilter)
Collect text-only contents on this Node, additionally inserting a Unicode OBJECT character U+FFFC where there is an image element.
|
static java.util.List<de.infinityloop.util.markup.TraversalEvent> |
collectTraversalEvents(org.w3c.dom.Node rootNode,
boolean includeRootNode)
Collect ordered list of tree TraversalEvent_s, starting at the specified node (in/excluding at per flag)
|
static void |
configureDocumentBuilder(org.apache.xerces.jaxp.DocumentBuilderImpl docBuilder,
de.infinityloop.util.markup.XMLProcessingConfiguration config)
Configure a DocumentBuilder based on the passed XML processing configuration object.
|
static void |
configureDocumentBuilderFactory(org.apache.xerces.jaxp.DocumentBuilderFactoryImpl parser,
de.infinityloop.util.markup.XMLProcessingConfiguration config)
Configure a DocumentBuilderFactory based on the passed XML processing configuration object.
|
static org.xml.sax.InputSource |
createInputSource(InputProxy ip)
Creates a StreamSource object from the passed proxy.
|
static java.util.List |
evaluateXPathCustom(de.infinityloop.util.markup.XMLProcessingConfiguration processingConfig,
de.infinityloop.upcast.util.namespace.NamespaceManager nsContext,
de.infinityloop.upcast.core.UpcastDocument ud,
org.jaxen.XPath expression,
org.w3c.dom.Node context)
Select nodes (starting at the specified context node) matching the specified XPath expression
|
static java.util.List |
evaluateXPathDOM(de.infinityloop.upcast.util.namespace.NamespaceManager nsContext,
de.infinityloop.upcast.core.UpcastDocument ud,
org.w3c.dom.Node context,
java.lang.String xpath)
Select nodes (starting at the specified context node) matching the specified XPath expression
|
static java.util.List |
evaluateXPathDOM(de.infinityloop.util.markup.XMLProcessingConfiguration processingConfig,
de.infinityloop.upcast.util.namespace.NamespaceManager nsContext,
de.infinityloop.upcast.core.UpcastDocument ud,
org.w3c.dom.Node context,
java.lang.String xpath) |
static void |
executeSaxon6(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy inXML,
InputProxy inXSL,
java.util.Map parameters,
OutputProxy outXML)
Run a single transformation in Saxon 6.
|
static void |
executeSaxon9B(de.infinityloop.util.markup.XMLProcessingConfiguration config,
org.w3c.dom.Document inDOM,
InputProxy inXSL,
java.util.Map parameters,
OutputProxy outXML)
Run a single transformation in Saxon 9B with the passed DOM tree as source.
|
static void |
executeSaxon9B(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy inXML,
InputProxy inXSL,
java.util.Map parameters,
OutputProxy outXML)
Run a single transformation in Saxon 9B.
|
static void |
executeXalan(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy inXML,
InputProxy inXSL,
java.util.Map parameters,
OutputProxy outXML)
Run a single transformation in Saxon.
|
static org.w3c.dom.Text |
findFirstTextNodeStartingWith(org.w3c.dom.Node curNode,
java.lang.String prefix,
de.infinityloop.upcast.util.namespace.QualifiedNameList elementFilter)
Finds the first (probably depth-first child-) TextNode and checks if it starts with the specified string.
|
static org.w3c.dom.Element |
findNamedAncestor(de.infinityloop.upcast.util.namespace.QualifiedName ancestorName,
org.w3c.dom.Element elem)
Finds the first named ancestor element of the element passed.
|
static org.w3c.dom.Element |
findNamedAncestorOrSelf(de.infinityloop.upcast.util.namespace.QualifiedName ancestorName,
org.w3c.dom.Element elem)
Finds the first named ancestor-or-self element of the element passed.
|
static org.w3c.dom.Text |
findNextTextNode(org.w3c.dom.Node curNode)
Finds the next (=following::) text, starting at the passed node, in document order.
|
static org.w3c.dom.Text |
findNextTextNode(org.w3c.dom.Node curNode,
boolean start) |
static java.lang.String |
getXSLTProcessorVersionString(java.lang.String processorToUse)
Get current XSLT processor used + version String
|
static boolean |
hasVisualContent(org.w3c.dom.Node node,
boolean removeEmpties,
boolean includeHidden)
Looks down the child tree if there is any non-inline elements.
|
static void |
insertUpcastFragmentFromSource(de.infinityloop.upcast.core.UpcastDocument ud,
de.infinityloop.util.markup.UpcastDOMCreatorHandler.BuildingMode where,
org.w3c.dom.Node target,
InputProxy source,
de.infinityloop.upcast.util.namespace.NamespaceManager destNSM)
Inserts the parsed XML source as DOM nodes relative to the specified target node using the specified nsmanager to add or retrieve
mapping names for existing namespaces.
|
static boolean |
isDescendantOf(org.w3c.dom.Node n,
org.w3c.dom.Node ancestor)
Returns whether the node n is a descendant of node ancestor (=true) or not (=false)
|
static java.lang.String |
makePCDATA_XML(java.lang.String pcdata)
Turns the passed PCDATA content into a string for writing to UTF-8 XML file, using entities where necessary.
|
static java.lang.String |
makePCDATAAttr_XML(java.lang.String pcdata)
Turns the passed PCDATA content into a string for writing to UTF8 XML file, using entities where necessary.
|
static java.lang.String |
makeValidXML_ID(java.lang.String src)
Transform a passed string in such a way that the result conforms to the rules for an
XML 1.0 'Name' (as used e.g. for element names or xml:id).
|
static java.lang.String |
makeValidXMLName(java.lang.String src)
Transform a passed string in such a way that the result conforms to the rules for an
XML 1.0 'Name' (as used e.g. for element names or xml:id).
|
static boolean |
matchNode(org.w3c.dom.Node inNode,
de.infinityloop.upcast.util.namespace.QualifiedNameList elementFilter)
Tests if the passed node is filtered by the elementFilter QualifiedNameList.
|
static void |
moveAttributes(org.w3c.dom.Element from,
org.w3c.dom.Element to)
Moves all attributes of the first node to the second node.
|
static void |
moveChildren(org.w3c.dom.Node from,
org.w3c.dom.Node to)
Moves all children of the first node to the second node.
|
static org.w3c.dom.Document |
parseDOM(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy ip)
DOM-parses the passed file and returns a constructed DOM.
|
static void |
parseSAX(de.infinityloop.util.markup.XMLProcessingConfiguration config,
org.w3c.dom.Document inTree,
java.lang.String baseURL)
Parses not from XML, but from a DOM tree, into SAX events.
|
static void |
parseSAX(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy ip)
SAX-parses the passed file, driving any specified handlers in the configuration
|
static void |
parseSAXTagSoup(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy ip)
SAX-parses the passed file using the TagSoup parser, driving any specified handlers in the configuration
|
static void |
removeChildren(org.w3c.dom.Node node)
Removes all children of the specified node
|
static void |
removeNodeOnly(org.w3c.dom.Node node)
Removes (only) the specified node from the tree, but not its children.
|
static void |
removeNodeWithSubtree(org.w3c.dom.Node node)
Removes the specified node (including its subtree) from the tree.
|
static void |
serializeDOM(org.w3c.dom.Document src,
OutputProxy dest)
serializes a DOM tree to the specified OutputProxy.
|
static void |
serializeInternalDOM(org.w3c.dom.Document src,
OutputProxy dest)
serializes an internal upCast DOM tree to the specified OutputProxy.
|
static void |
serializeNode(org.w3c.dom.Node n,
boolean children,
java.io.Writer w)
serializes an internal upCast DOM node to the specified OutputProxy.
|
static java.lang.String |
serializeNodeToString(org.w3c.dom.Node n,
boolean children)
Serializes a subtree of the DOM to a string for debugging output.
|
static java.lang.String |
stripInvalidCharacters(int profile,
java.lang.String src)
Completely strips characters from the passed string based on the passed profile ID.
|
static void |
validateAgainstDTD(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy theFile)
Perform validation against a DTD using Xerces.
|
static void |
validateAgainstRelaxNG(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy theFile,
InputProxy schemaFile,
boolean compactSyntax)
Perform validation against a Relax NG Schema using Jing.
|
static void |
validateAgainstXMLSchema(de.infinityloop.util.markup.XMLProcessingConfiguration config,
InputProxy theFile)
Perform validation against an XML Schema using Xerces.
|
public static final int kProfilePassAll
public static final int kProfileXML10
public static LogSource logger
public static void parseSAX(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy ip) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
public static void parseSAXTagSoup(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy ip) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
public static void parseSAX(de.infinityloop.util.markup.XMLProcessingConfiguration config, org.w3c.dom.Document inTree, java.lang.String baseURL) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
public static void configureDocumentBuilderFactory(org.apache.xerces.jaxp.DocumentBuilderFactoryImpl parser, de.infinityloop.util.markup.XMLProcessingConfiguration config) throws javax.xml.parsers.ParserConfigurationException
parser
- config
- org.xml.sax.SAXNotSupportedException
org.xml.sax.SAXNotRecognizedException
javax.xml.parsers.ParserConfigurationException
public static void configureDocumentBuilder(org.apache.xerces.jaxp.DocumentBuilderImpl docBuilder, de.infinityloop.util.markup.XMLProcessingConfiguration config)
docBuilder
- config
- org.xml.sax.SAXNotSupportedException
org.xml.sax.SAXNotRecognizedException
public static org.w3c.dom.Document parseDOM(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy ip) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
public static void insertUpcastFragmentFromSource(de.infinityloop.upcast.core.UpcastDocument ud, de.infinityloop.util.markup.UpcastDOMCreatorHandler.BuildingMode where, org.w3c.dom.Node target, InputProxy source, de.infinityloop.upcast.util.namespace.NamespaceManager destNSM) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
target
- source
- destNSM
- org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
public static void executeSaxon9B(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy inXML, InputProxy inXSL, java.util.Map parameters, OutputProxy outXML) throws java.lang.Exception
config
- the processing environment configurationinXML
- inXSL
- parameters
- outXML
- java.lang.Exception
public static void executeSaxon9B(de.infinityloop.util.markup.XMLProcessingConfiguration config, org.w3c.dom.Document inDOM, InputProxy inXSL, java.util.Map parameters, OutputProxy outXML) throws java.lang.Exception
config
- the processing environment configurationinDOM
- inXSL
- parameters
- outXML
- java.lang.Exception
public static void executeSaxon6(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy inXML, InputProxy inXSL, java.util.Map parameters, OutputProxy outXML) throws java.lang.Exception
config
- the processing environment configurationinXML
- inXSL
- parameters
- outXML
- java.lang.Exception
public static void executeXalan(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy inXML, InputProxy inXSL, java.util.Map parameters, OutputProxy outXML) throws java.lang.Exception
config
- the processing environment configurationinXML
- inXSL
- parameters
- outXML
- java.lang.Exception
public static void chainXalan(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy inXML, OutputProxy outXML, java.util.ArrayList transformations) throws java.lang.Exception
config
- the configuration to use for initial and possibly final parsing/processing/serializinginXML
- source XMLoutXML
- destination filetransformations
- ArrayList of TransformationChainElement objectsjava.lang.Exception
public static void chainSaxon9BWithIntermediates(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy inXML, OutputProxy outXML, java.util.ArrayList transformations, java.lang.String intermediateDir) throws java.lang.Exception
config
- an XMLProcessingConfiguration
instanceinXML
- the source XML fileoutXML
- the result filetransformations
- an ordered array of TransformationChainElement
sintermediateDir
- directory where intermediate files should be written; when null, transformations are internally chainedjava.lang.Exception
public static void chainXalanWithIntermediates(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy inXML, OutputProxy outXML, java.util.ArrayList transformations, java.lang.String intermediateDir) throws java.lang.Exception
transformations
elementsconfig
- the configuration to use for initial and possibly final parsing/processing/serializinginXML
- source XMLoutXML
- destination filetransformations
- ArrayList of TransformationChainElement objectsintermediateDir
- directory where intermediate files should be written; when null, transformations are internally chainedjava.lang.Exception
public static void chainSaxon9B(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy inXML, OutputProxy outXML, java.util.ArrayList transformations) throws java.lang.Exception
config
- the configuration to use for initial and possibly final parsing/processing/serializinginXML
- source XMLoutXML
- destination filetransformations
- ArrayList of TransformationChainElement objectsjava.lang.Exception
public static void chainSaxon9B(de.infinityloop.util.markup.XMLProcessingConfiguration config, org.w3c.dom.Document inDOM, OutputProxy outXML, java.util.ArrayList transformations) throws java.lang.Exception
config
- the configuration to use for initial and possibly final parsing/processing/serializinginXML
- source XMLoutXML
- destination filetransformations
- ArrayList of TransformationChainElement objectsjava.lang.Exception
public static void chainSaxon6(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy inXML, OutputProxy outXML, java.util.ArrayList transformations) throws java.lang.Exception
config
- the configuration to use for initial and possibly final parsing/processing/serializinginXML
- source XMLoutXML
- destination filetransformations
- ArrayList of TransformationChainElement objectsjava.lang.Exception
public static void serializeInternalDOM(org.w3c.dom.Document src, OutputProxy dest) throws java.lang.Exception
src
- the Document to serializedest
- the destination to serialize tojava.lang.Exception
public static java.lang.String serializeNodeToString(org.w3c.dom.Node n, boolean children)
n
- the start nodechildren
- include children?public static void serializeNode(org.w3c.dom.Node n, boolean children, java.io.Writer w) throws java.lang.Exception
n
- the node to (start) serializechildren
- when true, all the nodes descendants are also serializedw
- the Writer to serialize tojava.lang.Exception
public static void serializeDOM(org.w3c.dom.Document src, OutputProxy dest) throws java.lang.Exception
java.lang.Exception
public static java.lang.String collectTextNodesContent(org.w3c.dom.DocumentFragment df)
public static boolean matchNode(org.w3c.dom.Node inNode, de.infinityloop.upcast.util.namespace.QualifiedNameList elementFilter)
!matchNode( n, filter)
.
To filter for text nodes, use the literal local name #text
(in the null namespace).inNode
- the node to testelementFilter
- the element filter or null, in which case this method returns false.public static java.lang.String collectTextNodesContent(org.w3c.dom.Node curNode, de.infinityloop.upcast.util.namespace.QualifiedNameList elementFilter)
public static java.lang.String collectTextNodesContentWithImageIndicator(org.w3c.dom.Node curNode, de.infinityloop.upcast.util.namespace.QualifiedNameList elementFilter)
public static java.util.List<de.infinityloop.util.markup.TraversalEvent> collectTraversalEvents(org.w3c.dom.Node rootNode, boolean includeRootNode)
public static java.lang.String collectTextNodesContentAndEmpties(org.w3c.dom.Node curNode, de.infinityloop.upcast.util.namespace.QualifiedNameList emptyElementFilter)
public static java.lang.String calcNodeLocationInfo(org.w3c.dom.Node n)
n
- the nodepublic static org.w3c.dom.Text findFirstTextNodeStartingWith(org.w3c.dom.Node curNode, java.lang.String prefix, de.infinityloop.upcast.util.namespace.QualifiedNameList elementFilter)
curNode
- the node to start the search with. This node is already considered itselfprefix
- the prefix string to match againstelementFilter
- a list of element names that should be skipped when searching for an appropriate text nodepublic static org.w3c.dom.Text findNextTextNode(org.w3c.dom.Node curNode)
public static org.w3c.dom.Text findNextTextNode(org.w3c.dom.Node curNode, boolean start)
public static java.util.List evaluateXPathDOM(de.infinityloop.upcast.util.namespace.NamespaceManager nsContext, de.infinityloop.upcast.core.UpcastDocument ud, org.w3c.dom.Node context, java.lang.String xpath)
context
- the context nodexpath
- the xpath expressionpublic static java.util.List evaluateXPathDOM(de.infinityloop.util.markup.XMLProcessingConfiguration processingConfig, de.infinityloop.upcast.util.namespace.NamespaceManager nsContext, de.infinityloop.upcast.core.UpcastDocument ud, org.w3c.dom.Node context, java.lang.String xpath)
public static java.util.List evaluateXPathCustom(de.infinityloop.util.markup.XMLProcessingConfiguration processingConfig, de.infinityloop.upcast.util.namespace.NamespaceManager nsContext, de.infinityloop.upcast.core.UpcastDocument ud, org.jaxen.XPath expression, org.w3c.dom.Node context) throws java.lang.Exception
context
- the context nodejava.lang.Exception
public static java.lang.String makePCDATAAttr_XML(java.lang.String pcdata)
public static java.lang.String makePCDATA_XML(java.lang.String pcdata)
public static java.lang.String getXSLTProcessorVersionString(java.lang.String processorToUse)
processorToUse
- identifies the processor for which the version string should be built: "xalan" (the default when null) or "saxon".public static org.w3c.dom.Element findNamedAncestor(de.infinityloop.upcast.util.namespace.QualifiedName ancestorName, org.w3c.dom.Element elem)
ancestorName
- the name of the ancestor element to look forelem
- the start elementpublic static org.w3c.dom.Element findNamedAncestorOrSelf(de.infinityloop.upcast.util.namespace.QualifiedName ancestorName, org.w3c.dom.Element elem)
ancestorName
- the name of the ancestor-or-self element to look forelem
- the start elementpublic static void removeNodeWithSubtree(org.w3c.dom.Node node) throws java.lang.Exception
node
- the node to be deleted from the treejava.lang.Exception
public static void removeChildren(org.w3c.dom.Node node) throws java.lang.Exception
node
- the node to delete the children fromjava.lang.Exception
public static void removeNodeOnly(org.w3c.dom.Node node) throws java.lang.Exception
node
- the node to remove from the treejava.lang.Exception
public static void moveChildren(org.w3c.dom.Node from, org.w3c.dom.Node to) throws java.lang.Exception
from
- the node from which the children should be movedto
- the node to which the children are movedjava.lang.Exception
public static void moveAttributes(org.w3c.dom.Element from, org.w3c.dom.Element to) throws java.lang.Exception
from
- the node from which the attributes should be movedto
- the node to which the attributes are movedjava.lang.Exception
public static org.xml.sax.InputSource createInputSource(InputProxy ip)
ip
- the source InputProxypublic static boolean isDescendantOf(org.w3c.dom.Node n, org.w3c.dom.Node ancestor)
n
- the node to testancestor
- the node where we test if n is a descendeant ofpublic static final java.lang.String makeValidXML_ID(java.lang.String src)
makeValidXMLName()
, but additionally allows the colon character ':
' .
Important Note: This method does not guarantee that for different source
strings the output will be different as well! For example, both 1elem
and _1elem
will be converted
to _1elem
: The first will be modified by prepending a '_', while the second is already a valid
XML Name and therefore passed unchanged.
src
- the source stringName
production.public static java.lang.String makeValidXMLName(java.lang.String src)
:
'
will not be allowed by this function, as it has special meaning in XML Namespaces. Therefore, consider
the passed string as only the local name of an element.
Important Note: This method does not guarantee that for different source
strings the output will be different as well! For example, both 1elem
and _1elem
will be converted
to _1elem
: The first will be modified by prepending a '_', while the second is already a valid
XML Name and therefore passed unchanged.
src
- the source stringName
production.public static java.lang.String stripInvalidCharacters(int profile, java.lang.String src)
profile
- the profile ID: kProfilePassAll (0): no filtering, kProfileXML (1): filtering according to XML 1.0src
- the string to examine and processpublic static org.w3c.dom.Node appendChildren(org.w3c.dom.Node dest, org.w3c.dom.Node src)
dest
- the node to append to as childrensrc
- the node whose children should be appendedpublic static void checkWellformedness(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy theFile) throws org.xml.sax.SAXException
ErrorHandler
on the config
instance to receive notification on well-formedness errors.config
- an XMLProcessingConfiguration
instancetheFile
- the input file to check for well-formednessorg.xml.sax.SAXException
public static void validateAgainstDTD(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy theFile) throws org.xml.sax.SAXException
config
- an XMLProcessingConfiguration
instancetheFile
- the input file to validateorg.xml.sax.SAXException
public static void validateAgainstXMLSchema(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy theFile) throws org.xml.sax.SAXException
config
- an XMLProcessingConfiguration
instancetheFile
- the input file to validateorg.xml.sax.SAXException
public static void validateAgainstRelaxNG(de.infinityloop.util.markup.XMLProcessingConfiguration config, InputProxy theFile, InputProxy schemaFile, boolean compactSyntax) throws org.xml.sax.SAXException
config
- an XMLProcessingConfiguration
instancetheFile
- the input file to validateschemaFile
- the relax ng schema filecompactSyntax
- true when the schema file is in compact RelaxNG syntax, false otherwiseorg.xml.sax.SAXException
public static boolean hasVisualContent(org.w3c.dom.Node node, boolean removeEmpties, boolean includeHidden)
node
- the node where it will be determined if it has visually rendered contentremoveEmpties
- if true, the function works as expected. If this is false (i.e. we don't want
empty elements to be reported), this returns true except for character nodes (leaves).