public final class CmsSetupXmlHelper
extends java.lang.Object
For more info about xpath see:
限定符和类型 | 方法和说明 |
---|---|
static java.lang.String |
getValue(org.dom4j.Document document,
java.lang.String xPath)
Returns the value in the given xpath of the given xml file.
|
static int |
setValue(org.dom4j.Document document,
java.lang.String xPath,
java.lang.String value)
Sets the given value in all nodes identified by the given xpath of the given xml file.
|
static int |
setValue(org.dom4j.Document document,
java.lang.String xPath,
java.lang.String value,
java.lang.String nodeToInsert)
Sets the given value in all nodes identified by the given xpath of the given xml file.
|
public static java.lang.String getValue(org.dom4j.Document document, java.lang.String xPath)
document
- the xml documentxPath
- the xpath to read (should select a single node or attribute)null
if no matching nodepublic static int setValue(org.dom4j.Document document, java.lang.String xPath, java.lang.String value)
If value is null
, all nodes identified by the given xpath will be deleted.
If the node identified by the given xpath does not exists, the missing nodes will be created
(if value
not null
).
document
- the xml documentxPath
- the xpath to setvalue
- the value to set (can be null
for deletion)public static int setValue(org.dom4j.Document document, java.lang.String xPath, java.lang.String value, java.lang.String nodeToInsert)
If value is null
, all nodes identified by the given xpath will be deleted.
If the node identified by the given xpath does not exists, the missing nodes will be created
(if value
not null
).
document
- the xml documentxPath
- the xpath to setvalue
- the value to set (can be null
for deletion)nodeToInsert
- optional, if given it will be inserted after xPath with the given value