|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.infinityloop.util.markup.XMLTools
public class XMLTools
Tools for XML parsing and XSLT application.
Constructor Summary | |
---|---|
XMLTools()
initialize |
Method Summary | |
---|---|
static void |
addCatalog(java.lang.String catalogLocation)
adds a single catalog to the existing catalog system |
static void |
chainSAXONWithParamsCatalog(InputProxy inXML,
OutputProxy outXML,
java.util.Vector transformations,
javax.xml.transform.ErrorListener myErrorListener,
Pair[] features,
Pair[] properties)
chains several transformationsone one after another. |
static void |
chainSAXONWithParamsCatalog(InputProxy inXML,
OutputProxy outXML,
java.util.Vector transformations,
javax.xml.transform.ErrorListener myErrorListener,
Pair[] features,
Pair[] properties,
java.lang.String intermediateDir)
chains several transformationsone one after another. |
static void |
chainXALANWithParamsCatalog(InputProxy inXML,
OutputProxy outXML,
java.util.Vector transformations,
javax.xml.transform.ErrorListener myErrorListener)
chains several transformationsone after another. |
static org.w3c.dom.Document |
chainXALANWithParamsCatalog(InputProxy inXML,
java.util.Vector transformations,
javax.xml.transform.ErrorListener myErrorListener)
chains several transformationsone after another. |
static java.lang.String |
collectTextNodesContent(org.w3c.dom.DocumentFragment df,
java.lang.String[] elementFilter)
Collect text-only contents on this DocumentFragment, possibly with filter on element names |
static java.lang.String |
collectTextNodesContent(org.w3c.dom.Node curNode,
java.lang.String[] elementFilter)
Collect text-only contents on this Node, possibly with filter on element names |
static void |
discardCatalogs()
removes all registered catalogs from the system |
static int |
executeSAXONWithParamsCatalog(org.w3c.dom.Document inDOM,
java.lang.String srcSystemID,
InputProxy inXSL,
OutputProxy outXML,
java.util.Vector params,
javax.xml.transform.ErrorListener myErrorListener)
Runs Saxon with specified parameters for the stylesheet and the EntityResolver provided by the Catalog file system, and writes to a stream. |
static int |
executeSAXONWithParamsCatalog(InputProxy inXML,
InputProxy inXSL,
OutputProxy outXML,
java.util.Vector params,
javax.xml.transform.ErrorListener myErrorListener)
Runs Saxon with specified parameters for the stylesheet and the EntityResolver provided by the Catalog file system. |
static int |
executeSAXONWithParamsCatalog(InputProxy inXML,
InputProxy inXSL,
OutputProxy outXML,
java.util.Vector params,
javax.xml.transform.ErrorListener myErrorListener,
Pair[] features,
Pair[] properties)
Runs Saxon with specified parameters for the stylesheet and the EntityResolver provided by the Catalog file system. |
static int |
executeXALAN(InputProxy inXML,
InputProxy inXSL,
OutputProxy outXML)
Runs Xalan |
static int |
executeXALANWithParams(InputProxy inXML,
InputProxy inXSL,
OutputProxy outXML,
java.util.Vector params)
Runs Xalan with specified parameters for the stylesheet. |
static int |
executeXALANWithParamsCatalog(org.w3c.dom.Document inDOM,
java.lang.String srcSystemID,
InputProxy inXSL,
OutputProxy outXML,
java.util.Vector params,
javax.xml.transform.ErrorListener myErrorListener)
Runs Xalan with specified parameters for the stylesheet and the EntityResolver provided by the Catalog file system, and writes to a stream. |
static org.w3c.dom.Document |
executeXALANWithParamsCatalog(org.w3c.dom.Document inDOM,
java.lang.String srcSystemID,
InputProxy inXSL,
java.util.Vector params,
javax.xml.transform.ErrorListener myErrorListener)
Runs Xalan with specified parameters for the stylesheet and the EntityResolver provided by the Catalog file system, and returns a DOM Document tree. |
static int |
executeXALANWithParamsCatalog(InputProxy inXML,
InputProxy inXSL,
OutputProxy outXML,
java.util.Vector params,
javax.xml.transform.ErrorListener myErrorListener)
Runs Xalan with specified parameters for the stylesheet and the EntityResolver provided by the Catalog file system. |
static org.w3c.dom.Document |
executeXALANWithParamsCatalog(InputProxy inXML,
InputProxy inXSL,
java.util.Vector params,
javax.xml.transform.ErrorListener myErrorListener)
Runs Xalan with specified parameters for the stylesheet and the EntityResolver provided by the Catalog file system, and returns a DOM Document tree. |
static org.w3c.dom.Text |
findFirstTextNodeStartingWith(org.w3c.dom.Node curNode,
java.lang.String prefix,
java.lang.String[] elementFilter)
Finds the first (probably depth-first child-) TextNode and checks if it starts with the specified string. |
static org.w3c.dom.Element |
findNamedAncestor(java.lang.String ancestorName,
org.w3c.dom.Element elem)
Finds the first named ancestor 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 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 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(DiskFile file)
DOM-parses the passed file |
static org.w3c.dom.Document |
parseDOM(java.io.InputStream is,
java.lang.String systemIdentifier)
|
static org.w3c.dom.Document |
parseDOM(java.io.Reader rd,
java.lang.String systemIdentifier)
|
static void |
parseSAX(org.xml.sax.helpers.DefaultHandler handler,
DiskFile file)
SAX-parses the passed file |
static void |
parseSAX(org.xml.sax.helpers.DefaultHandler handler,
org.w3c.dom.Document inTree,
java.lang.String systemIdentifier,
Pair[] features,
Pair[] properties)
Parses as above, with features and properties to be set as parameter. |
static void |
parseSAX(org.xml.sax.helpers.DefaultHandler handler,
java.io.InputStream is,
java.lang.String systemIdentifier)
|
static void |
parseSAX(org.xml.sax.helpers.DefaultHandler handler,
java.io.InputStream is,
java.lang.String systemIdentifier,
Pair[] features,
Pair[] properties)
Parses as above, with features and properties to be set as parameter. |
static void |
parseSAX(org.xml.sax.helpers.DefaultHandler handler,
java.io.Reader rd,
java.lang.String systemIdentifier)
|
static void |
parseSAX(org.xml.sax.helpers.DefaultHandler handler,
java.io.Reader rd,
java.lang.String systemIdentifier,
Pair[] features,
Pair[] properties)
Parses as above, with features and properties to be set as parameter. |
static void |
removeNode(org.w3c.dom.Node node)
Removes (only) the specified node from the tree, but not its children. |
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 void |
setGlobalEntityResolver(org.xml.sax.EntityResolver er)
sets a global default entity resolver class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLTools()
Method Detail |
---|
public static void setGlobalEntityResolver(org.xml.sax.EntityResolver er)
public static org.xml.sax.EntityResolver getGlobalEntityResolver()
public static void initializeCatalogs(java.util.Vector additionalFiles)
public static void addCatalog(java.lang.String catalogLocation)
public static void discardCatalogs()
public static void parseSAX(org.xml.sax.helpers.DefaultHandler handler, DiskFile file) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
public static void parseSAX(org.xml.sax.helpers.DefaultHandler handler, java.io.InputStream is, java.lang.String systemIdentifier) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
public static void parseSAX(org.xml.sax.helpers.DefaultHandler handler, java.io.Reader rd, java.lang.String systemIdentifier) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
public static void parseSAX(org.xml.sax.helpers.DefaultHandler handler, java.io.Reader rd, java.lang.String systemIdentifier, Pair[] features, Pair[] properties) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
public static void parseSAX(org.xml.sax.helpers.DefaultHandler handler, java.io.InputStream is, java.lang.String systemIdentifier, Pair[] features, Pair[] properties) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
public static void parseSAX(org.xml.sax.helpers.DefaultHandler handler, org.w3c.dom.Document inTree, java.lang.String systemIdentifier, Pair[] features, Pair[] properties) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
public static org.w3c.dom.Document parseDOM(DiskFile file) 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 org.w3c.dom.Document parseDOM(java.io.InputStream is, java.lang.String systemIdentifier) 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 org.w3c.dom.Document parseDOM(java.io.Reader rd, java.lang.String systemIdentifier) 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 java.lang.String makePCDATA_XML(java.lang.String pcdata)
public static int executeXALAN(InputProxy inXML, InputProxy inXSL, OutputProxy outXML) throws java.lang.Exception
java.lang.Exception
public static int executeXALANWithParams(InputProxy inXML, InputProxy inXSL, OutputProxy outXML, java.util.Vector params) throws java.lang.Exception
java.lang.Exception
public static int executeXALANWithParamsCatalog(InputProxy inXML, InputProxy inXSL, OutputProxy outXML, java.util.Vector params, javax.xml.transform.ErrorListener myErrorListener) throws java.lang.Exception
java.lang.Exception
public static int executeSAXONWithParamsCatalog(InputProxy inXML, InputProxy inXSL, OutputProxy outXML, java.util.Vector params, javax.xml.transform.ErrorListener myErrorListener) throws java.lang.Exception
java.lang.Exception
public static int executeSAXONWithParamsCatalog(InputProxy inXML, InputProxy inXSL, OutputProxy outXML, java.util.Vector params, javax.xml.transform.ErrorListener myErrorListener, Pair[] features, Pair[] properties) throws java.lang.Exception
java.lang.Exception
public static org.w3c.dom.Document executeXALANWithParamsCatalog(InputProxy inXML, InputProxy inXSL, java.util.Vector params, javax.xml.transform.ErrorListener myErrorListener) throws java.lang.Exception
java.lang.Exception
public static org.w3c.dom.Document executeXALANWithParamsCatalog(org.w3c.dom.Document inDOM, java.lang.String srcSystemID, InputProxy inXSL, java.util.Vector params, javax.xml.transform.ErrorListener myErrorListener) throws java.lang.Exception
java.lang.Exception
public static int executeXALANWithParamsCatalog(org.w3c.dom.Document inDOM, java.lang.String srcSystemID, InputProxy inXSL, OutputProxy outXML, java.util.Vector params, javax.xml.transform.ErrorListener myErrorListener) throws java.lang.Exception
java.lang.Exception
public static int executeSAXONWithParamsCatalog(org.w3c.dom.Document inDOM, java.lang.String srcSystemID, InputProxy inXSL, OutputProxy outXML, java.util.Vector params, javax.xml.transform.ErrorListener myErrorListener) throws java.lang.Exception
java.lang.Exception
public static void chainXALANWithParamsCatalog(InputProxy inXML, OutputProxy outXML, java.util.Vector transformations, javax.xml.transform.ErrorListener myErrorListener) throws java.lang.Exception
java.lang.Exception
public static void chainSAXONWithParamsCatalog(InputProxy inXML, OutputProxy outXML, java.util.Vector transformations, javax.xml.transform.ErrorListener myErrorListener, Pair[] features, Pair[] properties, java.lang.String intermediateDir) throws java.lang.Exception
features
- These features are set for the initial reading of the XML sourceproperties
- These properties are set for the initial reading of the XML sourceintermediateDir
- directory where intermediate files should be written; when null, transformations are internally chained
java.lang.Exception
public static void chainSAXONWithParamsCatalog(InputProxy inXML, OutputProxy outXML, java.util.Vector transformations, javax.xml.transform.ErrorListener myErrorListener, Pair[] features, Pair[] properties) throws java.lang.Exception
features
- These features are set for the initial reading of the XML sourceproperties
- These properties are set for the initial reading of the XML source
java.lang.Exception
public static org.w3c.dom.Document chainXALANWithParamsCatalog(InputProxy inXML, java.util.Vector transformations, javax.xml.transform.ErrorListener myErrorListener) throws java.lang.Exception
java.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 to
java.lang.Exception
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 to
java.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, java.lang.String[] elementFilter)
public static java.lang.String collectTextNodesContent(org.w3c.dom.Node curNode, java.lang.String[] elementFilter)
public static org.w3c.dom.Text findFirstTextNodeStartingWith(org.w3c.dom.Node curNode, java.lang.String prefix, java.lang.String[] 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 node
public static java.util.Vector getRegisteredCatalogSearchPaths()
public static java.lang.String makePCDATAAttr_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(java.lang.String ancestorName, org.w3c.dom.Element elem)
ancestorName
- the name of the ancestor element to look forelem
- the start element
public static void removeNode(org.w3c.dom.Node node) throws java.lang.Exception
node
- the node to remove from the tree
java.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 moved
java.lang.Exception
public 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 string
Name
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 string
Name
production.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |