public class XmlStructure extends Object
Constructor and Description |
---|
XmlStructure(org.dom4j.Element subTreeRoot)
Constructor.
|
XmlStructure(File f,
String encoding)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static List<org.dom4j.Element> |
getAllChildrenAlongPath(org.dom4j.Element current,
String... path)
This function recursively calls it self, and retrieves all the leaf children from all sibling branches along the
path.
|
org.dom4j.Element |
getChild(String name)
Function for retrieving a single specific branch.
|
List<org.dom4j.Element> |
getChildren(String name)
For receiving a list of specific branches.
|
String |
getLeafValue(String... path)
Retrieves the content of a branch deep in tree structure.
|
String[] |
getLeafValues(String... path)
Retrieves the content of a the leafs deep in the tree structure.
|
org.dom4j.Element |
getRoot()
Function to retrieving the root of this branch in the XML tree.
|
org.dom4j.Element |
getSubChild(String... name)
For retrieving the first children along a path.
|
String |
getSubChildValue(String... name)
Retrieves the content of a branch deep in tree structure.
|
String |
getXML()
Retrieves the XML code for this entire branch.
|
static org.dom4j.Element |
makeElementFromString(String content)
Creates an dom4j.Element from a String.
|
void |
overWrite(org.dom4j.Element overwriter)
This function initialise the process of overwriting a part of the tree.
|
void |
overWriteOnly(org.dom4j.Element branch,
String value,
String... path)
Overwrites the leaf at the end of the path from the branch.
|
void |
overWriteOnlyInt(org.dom4j.Element branch,
int position,
char value,
String... path)
Specific overwrite function for overwriting a specific character in a string.
|
static String |
pathAndContentToXML(String content,
String... path)
This function creates the XML code for the path.
|
public XmlStructure(File f, String encoding)
f
- The XML fileencoding
- the encoding to use to read the filepublic XmlStructure(org.dom4j.Element subTreeRoot)
subTreeRoot
- The root of the tree for this instancepublic org.dom4j.Element getRoot()
public org.dom4j.Element getChild(String name)
name
- The name of the branchpublic List<org.dom4j.Element> getChildren(String name)
name
- The name of the children to be found.public org.dom4j.Element getSubChild(String... name)
name
- The path to the child.public String getSubChildValue(String... name)
name
- Specifies the path in the tree (e.g. in HTML: GetSubChildValue("HTML", "HEAD", "TITLE") to get the
title of a HTML document)public String getLeafValue(String... path)
path
- Specifies the path in the tree (e.g. in HTML: GetSubChildValue("HTML", "HEAD", "TITLE") to get the
title of a HTML document)public String[] getLeafValues(String... path)
path
- Specifies the path in the tree (e.g. in HTML: GetSubChildValue("HTML", "HEAD", "TITLE") to get the
title of a HTML document)public void overWrite(org.dom4j.Element overwriter)
This is used for the Settings attributes in the deploy.
overwriter
- The settings instance for the current elementpublic void overWriteOnly(org.dom4j.Element branch, String value, String... path)
branch
- The branch where to begin.value
- The value to overwrite the leaf with.path
- The path from the branch to the leaf.public void overWriteOnlyInt(org.dom4j.Element branch, int position, char value, String... path)
branch
- The initial branch of the XML tree.position
- The position in the String where the character are to be changed.value
- The new value of the character to change.path
- The path to the leaf of the string to change.public static org.dom4j.Element makeElementFromString(String content)
content
- The content of a String.public static String pathAndContentToXML(String content, String... path)
content
- The content at the leaf of the branch.path
- The path to the branch.public static List<org.dom4j.Element> getAllChildrenAlongPath(org.dom4j.Element current, String... path)
current
- The current element to retrieve children along the path.path
- The path to the leafs.Copyright © 2005–2015 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.