de.infinityloop.util.markup
Class XMLTools

java.lang.Object
  extended by de.infinityloop.util.markup.XMLTools

public class XMLTools
extends java.lang.Object

Tools for XML parsing and XSLT application.


Field Summary
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.
 
Constructor Summary
XMLTools()
           
 
Method Summary
static void addCatalog(java.lang.String catalogLocation)
          adds a single catalog to the existing catalog system
static org.w3c.dom.Node appendChildren(org.w3c.dom.Node dest, org.w3c.dom.Node src)
          Appends all children(!)
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, 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 transformationsone 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 validation against a DTD using Xerces.
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 org.xml.sax.InputSource createInputSource(InputProxy ip)
          Creates a StreamSource object from the passed proxy.
static void discardCatalogs()
          removes all registered catalogs from the system
static java.util.List evaluateXPathCustom(de.infinityloop.upcast.util.namespace.NamespaceManager nsContext, 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, org.w3c.dom.Node context, java.lang.String xpath)
          Select nodes (starting at the specified context node) matching the specified XPath expression
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, 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.xml.sax.EntityResolver getGlobalEntityResolver()
          retrieves the global default entity resolver class.
static java.util.Vector getRegisteredCatalogSearchPaths()
          Returns a Vector of all currently programmatically registered Catalog file search paths (does not include Catalogs set by the xml.catalog.files system property!).
static java.lang.String getXSLTProcessorVersionString(java.lang.String processorToUse)
          Get current XSLT processor used + version String
static void initializeCatalogs(java.util.Vector additionalFiles)
          initializes the default catalog handler, with adding the catalog files as in the passed Vector of String objects.
static void insertFragmentFromSource(de.infinityloop.util.markup.DOMCreatorHandler.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 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 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 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 void setGlobalEntityResolver(org.xml.sax.EntityResolver er)
          sets a global default entity resolver class.
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kProfilePassAll

public static final int kProfilePassAll
Profile constant for passing all characters unchanged.

See Also:
Constant Field Values

kProfileXML10

public static final int kProfileXML10
Profile constant for passing only characters that are valid XML 1.0.

See Also:
Constant Field Values
Constructor Detail

XMLTools

public XMLTools()
Method Detail

setGlobalEntityResolver

public static void setGlobalEntityResolver(org.xml.sax.EntityResolver er)
sets a global default entity resolver class. Set to null to clear.


getGlobalEntityResolver

public static org.xml.sax.EntityResolver getGlobalEntityResolver()
retrieves the global default entity resolver class.


initializeCatalogs

public static void initializeCatalogs(java.util.Vector additionalFiles)
initializes the default catalog handler, with adding the catalog files as in the passed Vector of String objects.


addCatalog

public static void addCatalog(java.lang.String catalogLocation)
adds a single catalog to the existing catalog system


discardCatalogs

public static void discardCatalogs()
removes all registered catalogs from the system


parseSAX

public static void parseSAX(de.infinityloop.util.markup.XMLProcessingConfiguration config,
                            InputProxy ip)
                     throws org.xml.sax.SAXException,
                            javax.xml.parsers.ParserConfigurationException
SAX-parses the passed file, driving any specified handlers in the configuration

Throws:
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

parseSAX

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
Parses not from XML, but from a DOM tree, into SAX events. TODO: baseURL is currently not used/passed to the parser?!

Throws:
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

parseDOM

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
DOM-parses the passed file and returns a constructed DOM.

Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException

insertFragmentFromSource

public static void insertFragmentFromSource(de.infinityloop.util.markup.DOMCreatorHandler.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
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.

Parameters:
target -
source -
destNSM -
Throws:
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

executeSaxon9B

public static void executeSaxon9B(de.infinityloop.util.markup.XMLProcessingConfiguration config,
                                  InputProxy inXML,
                                  InputProxy inXSL,
                                  java.util.Map parameters,
                                  OutputProxy outXML)
                           throws java.lang.Exception
Run a single transformation in Saxon 9B.

Parameters:
config - the processing environment configuration
inXML -
inXSL -
parameters -
outXML -
Throws:
java.lang.Exception
Since:
7.0.0

executeSaxon6

public static void executeSaxon6(de.infinityloop.util.markup.XMLProcessingConfiguration config,
                                 InputProxy inXML,
                                 InputProxy inXSL,
                                 java.util.Map parameters,
                                 OutputProxy outXML)
                          throws java.lang.Exception
Run a single transformation in Saxon 6.

Parameters:
config - the processing environment configuration
inXML -
inXSL -
parameters -
outXML -
Throws:
java.lang.Exception
Since:
7.0.0

executeXalan

public static void executeXalan(de.infinityloop.util.markup.XMLProcessingConfiguration config,
                                InputProxy inXML,
                                InputProxy inXSL,
                                java.util.Map parameters,
                                OutputProxy outXML)
                         throws java.lang.Exception
Run a single transformation in Saxon.

Parameters:
config - the processing environment configuration
inXML -
inXSL -
parameters -
outXML -
Throws:
java.lang.Exception
Since:
7.0.0

chainXalan

public static void chainXalan(de.infinityloop.util.markup.XMLProcessingConfiguration config,
                              InputProxy inXML,
                              OutputProxy outXML,
                              java.util.ArrayList transformations)
                       throws java.lang.Exception
chains several transformationsone one after another. The transformations variable is an ArrayList of TransformationChainElement objects. Transformations are performed in the order specified by the elements.

Parameters:
config - the configuration to use for initial and possibly final parsing/processing/serializing
inXML - source XML
outXML - destination file
transformations - ArrayList of TransformationChainElement objects
Throws:
java.lang.Exception

chainSaxon9BWithIntermediates

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
chains several transformationsone one after another. The transformations Vector is a Vector of Pair()s holding (InputProxy xslSource, Vector params) tuples. Transformations are performed in the order specified by the Vector elements.

Parameters:
features - These features are set for the initial reading of the XML source
properties - These properties are set for the initial reading of the XML source
intermediateDir - directory where intermediate files should be written; when null, transformations are internally chained
Throws:
java.lang.Exception

chainXalanWithIntermediates

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
chains several transformationsone one after another. The transformations Vector is a Vector of Pair()s holding (InputProxy xslSource, Vector params) tuples. Transformations are performed in the order specified by the Vector elements.

Parameters:
features - These features are set for the initial reading of the XML source
properties - These properties are set for the initial reading of the XML source
intermediateDir - directory where intermediate files should be written; when null, transformations are internally chained
Throws:
java.lang.Exception

chainSaxon9B

public static void chainSaxon9B(de.infinityloop.util.markup.XMLProcessingConfiguration config,
                                InputProxy inXML,
                                OutputProxy outXML,
                                java.util.ArrayList transformations)
                         throws java.lang.Exception
chains several transformationsone one after another. The transformations variable is an ArrayList of TransformationChainElement objects. Transformations are performed in the order specified by the elements.

Parameters:
config - the configuration to use for initial and possibly final parsing/processing/serializing
inXML - source XML
outXML - destination file
transformations - ArrayList of TransformationChainElement objects
Throws:
java.lang.Exception

chainSaxon6

public static void chainSaxon6(de.infinityloop.util.markup.XMLProcessingConfiguration config,
                               InputProxy inXML,
                               OutputProxy outXML,
                               java.util.ArrayList transformations)
                        throws java.lang.Exception
chains several transformationsone one after another. The transformations variable is an ArrayList of TransformationChainElement objects. Transformations are performed in the order specified by the elements.

Parameters:
config - the configuration to use for initial and possibly final parsing/processing/serializing
inXML - source XML
outXML - destination file
transformations - ArrayList of TransformationChainElement objects
Throws:
java.lang.Exception

serializeInternalDOM

public static void serializeInternalDOM(org.w3c.dom.Document src,
                                        OutputProxy dest)
                                 throws java.lang.Exception
serializes an internal upCast DOM tree to the specified OutputProxy.

Parameters:
src - the Document to serialize
dest - the destination to serialize to
Throws:
java.lang.Exception

serializeNodeToString

public static java.lang.String serializeNodeToString(org.w3c.dom.Node n,
                                                     boolean children)
Serializes a subtree of the DOM to a string for debugging output.

Parameters:
n - the start node
children - include children?
Returns:
a string with XML representation

serializeNode

public static void serializeNode(org.w3c.dom.Node n,
                                 boolean children,
                                 java.io.Writer w)
                          throws java.lang.Exception
serializes an internal upCast DOM node to the specified OutputProxy.

Parameters:
n - the node to (start) serialize
children - when true, all the nodes descendants are also serialized
w - the Writer to serialize to
Throws:
java.lang.Exception

serializeDOM

public static void serializeDOM(org.w3c.dom.Document src,
                                OutputProxy dest)
                         throws java.lang.Exception
serializes a DOM tree to the specified OutputProxy.

Throws:
java.lang.Exception

collectTextNodesContent

public static java.lang.String collectTextNodesContent(org.w3c.dom.DocumentFragment df)
Collect text-only contents on this DocumentFragment, possibly with filter on element names


matchNode

public 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. Note that usually you need to apply inverse logic, that is this method tests if the node would ne filtered, so to get all passing nodes, use !matchNode( n, filter). To filter for text nodes, use the literal local name #text (in the null namespace).

Parameters:
inNode - the node to test
elementFilter - the element filter or null, in which case this method returns false.
Returns:
true

collectTextNodesContent

public 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. An element filter entry has the form: elemName [ '@'name'='val ]* so both an element name and one or more attribute values can be queried


findFirstTextNodeStartingWith

public 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. If it does, that text node is returned, otherwise we return null.

Parameters:
curNode - the node to start the search with. This node is already considered itself
prefix - the prefix string to match against
elementFilter - a list of element names that should be skipped when searching for an appropriate text node
Returns:
the matching text node (if any), null otherwise

evaluateXPathDOM

public static java.util.List evaluateXPathDOM(de.infinityloop.upcast.util.namespace.NamespaceManager nsContext,
                                              org.w3c.dom.Node context,
                                              java.lang.String xpath)
Select nodes (starting at the specified context node) matching the specified XPath expression

Parameters:
context - the context node
xpath - the xpath expression
Returns:
a list of matched nodes

evaluateXPathCustom

public static java.util.List evaluateXPathCustom(de.infinityloop.upcast.util.namespace.NamespaceManager nsContext,
                                                 org.jaxen.XPath expression,
                                                 org.w3c.dom.Node context)
                                          throws java.lang.Exception
Select nodes (starting at the specified context node) matching the specified XPath expression

Parameters:
context - the context node
Returns:
a list of matched nodes
Throws:
java.lang.Exception

getRegisteredCatalogSearchPaths

public static java.util.Vector getRegisteredCatalogSearchPaths()
Returns a Vector of all currently programmatically registered Catalog file search paths (does not include Catalogs set by the xml.catalog.files system property!).


makePCDATAAttr_XML

public 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. Use this for all Attribute values only (does NOT write elements).


makePCDATA_XML

public 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. Use this for plain text only.


getXSLTProcessorVersionString

public static java.lang.String getXSLTProcessorVersionString(java.lang.String processorToUse)
Get current XSLT processor used + version String

Parameters:
processorToUse - identifies the processor for which the version string should be built: "xalan" (the default when null) or "saxon".

findNamedAncestor

public 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. If that isn't found, null is returned.

Parameters:
ancestorName - the name of the ancestor element to look for
elem - the start element
Returns:
the desired ancestor Element or null, if it could not be found

findNamedAncestorOrSelf

public 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. If that isn't found, null is returned.

Parameters:
ancestorName - the name of the ancestor-or-self element to look for
elem - the start element
Returns:
the desired ancestor Element or null, if it could not be found

removeNodeWithSubtree

public static void removeNodeWithSubtree(org.w3c.dom.Node node)
                                  throws java.lang.Exception
Removes the specified node (including its subtree) from the tree.

Parameters:
node - the node to be deleted from the tree
Throws:
java.lang.Exception

removeChildren

public static void removeChildren(org.w3c.dom.Node node)
                           throws java.lang.Exception
Removes all children of the specified node

Parameters:
node - the node to delete the children from
Throws:
java.lang.Exception

removeNodeOnly

public static void removeNodeOnly(org.w3c.dom.Node node)
                           throws java.lang.Exception
Removes (only) the specified node from the tree, but not its children. They are moved to the deleted node's former place instead.

Parameters:
node - the node to remove from the tree
Throws:
java.lang.Exception

moveChildren

public static void moveChildren(org.w3c.dom.Node from,
                                org.w3c.dom.Node to)
                         throws java.lang.Exception
Moves all children of the first node to the second node.

Parameters:
from - the node from which the children should be moved
to - the node to which the children are moved
Throws:
java.lang.Exception

createInputSource

public static org.xml.sax.InputSource createInputSource(InputProxy ip)
Creates a StreamSource object from the passed proxy. Depending on the InputProxy's content, a StreamSource with Reader or InputStream parameter is created.

Parameters:
ip - the source InputProxy
Returns:
a new StreamSource object
Throws:
java.lang.Exception

makeValidXML_ID

public static final 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). Invalid characters are replaced by '-' if within the name, and prepended by an additional '_' when at the beginning. This is essentially the same method as 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.

Parameters:
src - the source string
Returns:
a string that matches the XML 1.0 Name production.

makeValidXMLName

public 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). Invalid characters are replaced by '-' if within the name, and prepended by an additional '_' when at the beginning. Also note that a starting colon ':' 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.

Parameters:
src - the source string
Returns:
a string that matches the XML 1.0 Name production.

stripInvalidCharacters

public static java.lang.String stripInvalidCharacters(int profile,
                                                      java.lang.String src)
Completely strips characters from the passed string based on the passed profile ID.

Parameters:
profile - the profile ID: kProfilePassAll (0): no filtering, kProfileXML (1): filtering according to XML 1.0
src - the string to examine and process
Returns:
src with all illegal characters stripped

appendChildren

public static org.w3c.dom.Node appendChildren(org.w3c.dom.Node dest,
                                              org.w3c.dom.Node src)
Appends all children(!) of src to the node dest as children.

Parameters:
dest - the node to append to as children
src - the node whose children should be appended
Returns:
dest

checkWellformedness

public static void checkWellformedness(de.infinityloop.util.markup.XMLProcessingConfiguration config,
                                       InputProxy theFile)
                                throws org.xml.sax.SAXException
Perform validation against a DTD using Xerces. You supply a SAX handler which acts as an error handler, i.e. it is there where you receive the detailed validation error messages.

Parameters:
config -
in -
Throws:
org.xml.sax.SAXException

validateAgainstDTD

public static void validateAgainstDTD(de.infinityloop.util.markup.XMLProcessingConfiguration config,
                                      InputProxy theFile)
                               throws org.xml.sax.SAXException
Perform validation against a DTD using Xerces. You supply a SAX handler which acts as an error handler, i.e. it is there where you receive the detailed validation error messages.

Parameters:
config -
in -
Throws:
org.xml.sax.SAXException

validateAgainstXMLSchema

public static void validateAgainstXMLSchema(de.infinityloop.util.markup.XMLProcessingConfiguration config,
                                            InputProxy theFile)
                                     throws org.xml.sax.SAXException
Perform validation against an XML Schema using Xerces. You supply a SAX handler which acts as an error handler, i.e. it is there where you receive the detailed validation error messages.

Parameters:
config -
in -
Throws:
org.xml.sax.SAXException

validateAgainstRelaxNG

public static void validateAgainstRelaxNG(de.infinityloop.util.markup.XMLProcessingConfiguration config,
                                          InputProxy theFile,
                                          InputProxy schemaFile,
                                          boolean compactSyntax)
                                   throws org.xml.sax.SAXException
Perform validation against a Relax NG Schema using Jing. You supply a SAX handler which acts as an error handler, i.e. it is there where you receive the detailed validation error messages.

Parameters:
config -
theFile - the file to validate
schemaFile - the relax ng schema file
in -
Throws:
org.xml.sax.SAXException