Constructor and Description |
---|
XMLToolT() |
Modifier and Type | Method and Description |
---|---|
static org.w3c.dom.Node |
findNode(org.w3c.dom.Node srcNode,
java.lang.String strXmlPath,
java.lang.String... str1dSeparators)
Searches the given node in order to find out the target node, according
to the given text path (and separators) of the target node.
|
static org.w3c.dom.Node |
findNode(org.w3c.dom.Node srcNode,
XMLPath path)
Searches the given node in order to find out the target node, according
to the given path.
|
private static org.w3c.dom.Node |
findNode(org.w3c.dom.Node srcNode,
XMLPath path,
int intCurrentDepth)
The method which actually finds the target node.
|
static org.w3c.dom.Document |
loadFromFile(java.io.File file)
Loads document from the given XML file.
|
static org.w3c.dom.Document |
loadFromFile(java.lang.String strFileName)
Loads document from an XML file according to the given file name.
|
private static java.lang.String |
mkspan(int intSpanCount)
Makes a text span.
|
static java.lang.String |
node2s(org.w3c.dom.Node node)
Generates a text presentation of a node, just for human reading, not
standard XML.
|
private static java.lang.String |
node2s(org.w3c.dom.Node node,
int intCurrentDepth)
The method which actually generates the text presentation of the given
node.
|
static boolean |
saveToFile(org.w3c.dom.Node node,
java.io.File file)
Saves the given node into the given XML file.
|
static boolean |
saveToFile(org.w3c.dom.Node node,
java.lang.String strFileName)
Saves the given node into an XML file according to the given file name.
|
public static org.w3c.dom.Document loadFromFile(java.lang.String strFileName) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException
strFileName
- - The given file name of the XML file to load.javax.xml.parsers.ParserConfigurationException
- .org.xml.sax.SAXException
- .java.io.IOException
- .public static org.w3c.dom.Document loadFromFile(java.io.File file) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException
file
- - The given XML file to load.javax.xml.parsers.ParserConfigurationException
- .org.xml.sax.SAXException
- .java.io.IOException
- .public static org.w3c.dom.Node findNode(org.w3c.dom.Node srcNode, java.lang.String strXmlPath, java.lang.String... str1dSeparators)
srcNode
- - The given node to be searched.strXmlPath
- - A text presentation of the path of the target node. str1dSeparators
- - Path separators:public static org.w3c.dom.Node findNode(org.w3c.dom.Node srcNode, XMLPath path)
srcNode
- - The given node to be searched.path
- - Path of the target node.public static java.lang.String node2s(org.w3c.dom.Node node)
node
- - The given node to be presented as text.public static boolean saveToFile(org.w3c.dom.Node node, java.lang.String strFileName) throws javax.xml.transform.TransformerException
node
- - The given node to be saved.strFileName
- - The given file name of the XML file to save.javax.xml.transform.TransformerException
- .public static boolean saveToFile(org.w3c.dom.Node node, java.io.File file) throws javax.xml.transform.TransformerException
node
- - The given node to be saved.file
- - The given XML file to save.javax.xml.transform.TransformerException
- .private static org.w3c.dom.Node findNode(org.w3c.dom.Node srcNode, XMLPath path, int intCurrentDepth)
srcNode
- - The given node to be searched.path
- - Path of the target node.intCurrentDepth
- - Current depth index in the path stages.private static java.lang.String mkspan(int intSpanCount)
intSpanCount
- - Span count.private static java.lang.String node2s(org.w3c.dom.Node node, int intCurrentDepth)
node
- - The given node to be presented as text.intCurrentDepth
- - Span depth index.