public class XMLTreeReplacer extends Object
XMLTreeReplacer.NodePath
element represent one path in the XML treeXMLTreeReplacer.Node
element represent one element in the XML tree. A node can specify one or several attribute change for this element<root desc="example"> <element name="first"> <element name="second"/> <element name="third"/> </element> </root>And the NodePath:
NodePath path = new NodePath(); path.addNode("root"); path.addNode("element"); Node node = path.addNode("element", 1); node.setAttribute("name", "changed");Then the result of the
replace(java.io.File, java.io.File, org.mdiutil.xml.tree.XMLTreeReplacer.NodePath...)
with the NodePath will be:
<root desc="example"> <element name="first"> <element name="second"/> <element name="changed"/> </element> </root>
Modifier and Type | Class and Description |
---|---|
static class |
XMLTreeReplacer.Node
A node in an XML document.
|
static class |
XMLTreeReplacer.NodePath
A path in an XML document.
|
Constructor and Description |
---|
XMLTreeReplacer() |
Modifier and Type | Method and Description |
---|---|
int |
getTab()
Return the tabulation for the XML file for each child node
|
boolean |
replace(File inputFile,
File outputFile,
XMLTreeReplacer.NodePath... paths)
Replace the attributes of some nodes in a XML document.
|
boolean |
replace(URL inputURL,
URL outputURL,
XMLTreeReplacer.NodePath... paths)
Replace the attributes of some nodes in a XML document.
|
boolean |
replace(XMLNode root,
File outputFile,
XMLTreeReplacer.NodePath... paths)
Replace the attributes of some nodes in a XML document.
|
boolean |
replace(XMLNode root,
URL outputURL,
XMLTreeReplacer.NodePath... paths)
Replace the attributes of some nodes in a XML document.
|
XMLNode |
replace(XMLNode root,
XMLTreeReplacer.NodePath... paths)
Replace the attributes of some nodes in a XML document.
|
void |
setTab(int tab)
Set the tabulation for the XML file for each child node
|
public void setTab(int tab)
tab
- the tabulationpublic int getTab()
public boolean replace(XMLNode root, File outputFile, XMLTreeReplacer.NodePath... paths) throws IOException
root
- the root of the XML documentoutputFile
- the ouput filepaths
- the list of paths to changeIOException
public boolean replace(File inputFile, File outputFile, XMLTreeReplacer.NodePath... paths) throws IOException
inputFile
- the input XML documentoutputFile
- the ouput filepaths
- the list of paths to changeIOException
public boolean replace(URL inputURL, URL outputURL, XMLTreeReplacer.NodePath... paths) throws IOException
inputURL
- the input XML documentoutputURL
- the ouput URLpaths
- the list of paths to changeIOException
public boolean replace(XMLNode root, URL outputURL, XMLTreeReplacer.NodePath... paths) throws IOException
root
- the root of the XML documentoutputURL
- the ouput URLpaths
- the list of paths to changeIOException
public XMLNode replace(XMLNode root, XMLTreeReplacer.NodePath... paths) throws IOException
root
- the root of the XML documentpaths
- the list of paths to changeIOException