|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlumis.util.XmlUtil
@StableMinor(version="6.1", sinceVersion="4.0") public class XmlUtil
Utility file for xml
Field Summary | |
---|---|
static java.lang.String |
XML_HEADER
|
Constructor Summary | |
---|---|
XmlUtil()
|
Method Summary | |
---|---|
static org.w3c.dom.Node |
addNode(org.w3c.dom.Node xmlParentNode,
java.lang.String newNodeName)
|
static org.w3c.dom.Node |
addNode(org.w3c.dom.Node xmlParentNode,
java.lang.String xpathExpressionParentNode,
java.lang.String newNodeName)
|
static org.w3c.dom.Attr |
addNodeAttr(org.w3c.dom.Node xmlParentNode,
java.lang.String attributeName)
|
static org.w3c.dom.Attr |
addNodeAttr(org.w3c.dom.Node xmlParentNode,
java.lang.String attributeName,
java.lang.String value)
|
static org.w3c.dom.Node |
addNodeFromXmlString(org.w3c.dom.Node node,
java.lang.String xmlString)
|
static org.w3c.dom.Element |
addTextNode(org.w3c.dom.Node xmlParentNode,
java.lang.String newNodeName,
java.lang.String newNodeText)
|
static org.w3c.dom.Element |
addTextNode(org.w3c.dom.Node xmlParentNode,
java.lang.String xpathExpressionParentNode,
java.lang.String newNodeName,
java.lang.String newNodeText)
|
static org.w3c.dom.Node[] |
addTextNodes(org.w3c.dom.Node xmlParentNode,
java.lang.String newNodesName,
java.lang.String[] newNodesValue)
|
static org.w3c.dom.Node[] |
addTextNodes(org.w3c.dom.Node xmlParentNode,
java.lang.String xpathExpressionParentNode,
java.lang.String newNodesName,
java.lang.String[] newNodesValue)
|
static boolean |
checkCondition(org.w3c.dom.Node conditionNode,
java.lang.String condition)
|
protected static boolean |
checkCondition(java.lang.String leftValue,
java.lang.String rightValue,
java.lang.String conditionOperator)
|
static boolean |
checkSingleCondition(org.w3c.dom.Node conditionNode,
java.lang.String condition)
|
static byte[] |
convertToUTFBytes(byte[] content)
Deprecated. Since 4.2.0, this method is no longer used and may be removed in the future. |
static org.w3c.dom.Node |
copyNode(org.w3c.dom.Node xmlNodeFrom,
org.w3c.dom.Node xmlNodeTo)
|
static org.w3c.dom.Node |
copyNode(org.w3c.dom.Node xmlNodeFrom,
org.w3c.dom.Node xmlNodeTo,
java.lang.String xpathExpressionTo)
|
static org.w3c.dom.Node |
copyNode(org.w3c.dom.Node xmlNodeFrom,
java.lang.String xpathExpressionFrom,
org.w3c.dom.Node xmlNodeTo)
|
static org.w3c.dom.Node |
copyNode(org.w3c.dom.Node xmlNodeFrom,
java.lang.String xpathExpressionFrom,
org.w3c.dom.Node xmlNodeTo,
java.lang.String xpathExpressionTo)
|
static PortalException |
createPortalException(org.xml.sax.SAXException e)
Creates a PortalException based on the given SAXException. |
static java.lang.String |
encodeXml(java.lang.String pStr)
Encodes a string to be used inside a XML document. |
static org.w3c.dom.Document |
getDocument(java.io.File xmlFile)
|
static org.w3c.dom.Document |
getDocument(javax.servlet.http.HttpServletRequest request)
|
static org.w3c.dom.Document |
getDocument(java.lang.String xmlString)
|
static org.w3c.dom.Document |
getDocumentFromFile(java.lang.String filePath)
|
static org.w3c.dom.Node |
getOrCreateNode(java.lang.String path,
org.w3c.dom.Node parentNode)
|
static java.lang.String |
getTextContent(org.w3c.dom.Node node)
|
static javax.xml.parsers.DocumentBuilder |
getXmlDocumentBuilder()
|
static org.w3c.dom.Document |
getXMLDocumentFromString(java.lang.String xml)
Deprecated. since 4.2.0 replaced by getDocument(String) . |
static java.lang.String |
getXmlEncoding(java.lang.String xmlString)
Returns the XML encoding for the xml with the given String. |
static java.lang.String |
getXmlString(org.w3c.dom.Document document)
|
static java.lang.String |
getXmlString(org.w3c.dom.Element element)
|
static java.lang.String |
getXmlString(org.w3c.dom.Node node)
Returns the xml string representation for a node. |
static org.w3c.dom.Node |
importIntoNewDocument(org.w3c.dom.Node originalNode)
Clones a node, and adopts it into a new document. |
static void |
initializeDocumentBuilderPool(int minSize,
int maxSize,
long timeBetweenEvictionRunsMillis,
int numTestsPerEvictionRun,
int minEvictableIdleTimeMillis)
Internal use only. |
static boolean |
isValidXmlString(java.lang.String xml)
|
static void |
mergeAttributes(org.w3c.dom.Node destinationNode,
org.w3c.dom.Node sourceNode,
boolean replace)
|
static void |
mergeElements(org.w3c.dom.Node destinationNode,
org.w3c.dom.Node sourceNode,
boolean replace)
Merges the children elements from a node to another. |
static boolean |
nodeExists(java.lang.String xpathExpression,
org.w3c.dom.Node sourceNode)
|
static boolean |
readAttributeBoolean(java.lang.String attributeName,
org.w3c.dom.Node node)
|
static boolean |
readAttributeBoolean(java.lang.String attributeName,
org.w3c.dom.Node node,
boolean valueForNull)
|
static int |
readAttributeInt(java.lang.String attributeName,
org.w3c.dom.Node node,
int valueForNull)
Returns the attribute integer value in the given node. |
static java.lang.String |
readAttributeOrNodeString(org.w3c.dom.Node node,
java.lang.String fieldName)
|
static java.lang.String |
readAttributeOrNodeString(org.w3c.dom.Node node,
java.lang.String fieldName,
java.lang.String valueForNull)
|
static java.lang.String |
readAttributeString(java.lang.String attributeName,
org.w3c.dom.Node node)
|
static java.lang.String |
readAttributeString(java.lang.String attributeName,
org.w3c.dom.Node node,
java.lang.String valueForNull)
|
static boolean |
readNodeBoolean(java.lang.String xpathExpression,
org.w3c.dom.Node sourceNode,
boolean valueForNull)
|
static int |
readNodeInt(java.lang.String xpathExpression,
org.w3c.dom.Node sourceNode,
int valueForNull)
|
static java.lang.Integer |
readNodeInteger(java.lang.String xpathExpression,
org.w3c.dom.Node sourceNode,
java.lang.Integer valueForNull)
|
static java.lang.String[] |
readNodesString(java.lang.String xpathExpression,
org.w3c.dom.Node sourceNode)
|
static java.lang.String |
readNodeString(java.lang.String xpathExpression,
org.w3c.dom.Node sourceNode)
|
static java.lang.String |
readNodeString(java.lang.String xpathExpression,
org.w3c.dom.Node sourceNode,
java.lang.String valueForNull)
|
static void |
replaceChildNode(org.w3c.dom.Node parentNode,
org.w3c.dom.Node newChildNode)
|
static void |
replaceChildNode(java.lang.String childNodeName,
org.w3c.dom.Node node,
java.lang.String xmlString)
|
static org.w3c.dom.Node[] |
selectAncestorNodes(java.lang.String ancestorNameQuery,
org.w3c.dom.Node childNode)
|
static org.w3c.dom.Node[] |
selectNodes(java.lang.String childNameQuery,
org.w3c.dom.Node parentNode)
|
static org.w3c.dom.Node |
selectSingleAncestorNode(java.lang.String ancestorNameQuery,
org.w3c.dom.Node childNode)
|
static org.w3c.dom.Node |
selectSingleNode(java.lang.String childNameQuery,
org.w3c.dom.Node parentNode)
|
protected static org.w3c.dom.Node |
selectSingleNodeRecursiveByName(java.lang.String nodeName,
org.w3c.dom.Node parentNode)
|
static void |
setTextContent(org.w3c.dom.Node parentNode,
java.lang.String textValue)
|
static org.w3c.dom.Node |
writeNodeString(java.lang.String xpathExpression,
org.w3c.dom.Node sourceNode,
java.lang.String nodeValue)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String XML_HEADER
Constructor Detail |
---|
public XmlUtil()
Method Detail |
---|
public static void initializeDocumentBuilderPool(int minSize, int maxSize, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, int minEvictableIdleTimeMillis)
This method may be incompatible in future versions.
minSize
- minimum pool size.maxSize
- maximum pool size.timeBetweenEvictionRunsMillis
- the number of milliseconds to sleep between runs of the idle
object evictor thread. When non-positive, no idle object
evictor thread will be run.numTestsPerEvictionRun
- the number of objects to examine during each run of the idle
object evictor thread (if any).minEvictableIdleTimeMillis
- The minimum amount of time an object may sit idle in the pool
before it is eligable for eviction by the idle object evictor
(if any).public static javax.xml.parsers.DocumentBuilder getXmlDocumentBuilder() throws PortalException
PortalException
public static org.w3c.dom.Document getDocument(java.io.File xmlFile) throws PortalException
PortalException
public static org.w3c.dom.Document getDocument(javax.servlet.http.HttpServletRequest request) throws java.lang.Exception
java.lang.Exception
public static org.w3c.dom.Document getDocument(java.lang.String xmlString) throws PortalException
PortalException
public static PortalException createPortalException(org.xml.sax.SAXException e)
e
- the SAXException
public static java.lang.String getXmlString(org.w3c.dom.Node node) throws PortalException
node
- the node. Must be of type Document
or Element
.
PortalException
public static java.lang.String getXmlString(org.w3c.dom.Element element) throws PortalException
PortalException
public static java.lang.String getXmlString(org.w3c.dom.Document document) throws java.lang.Exception
java.lang.Exception
public static boolean readNodeBoolean(java.lang.String xpathExpression, org.w3c.dom.Node sourceNode, boolean valueForNull) throws PortalException
PortalException
public static boolean readAttributeBoolean(java.lang.String attributeName, org.w3c.dom.Node node) throws PortalException
PortalException
public static boolean readAttributeBoolean(java.lang.String attributeName, org.w3c.dom.Node node, boolean valueForNull) throws PortalException
PortalException
public static int readNodeInt(java.lang.String xpathExpression, org.w3c.dom.Node sourceNode, int valueForNull) throws PortalException
PortalException
public static java.lang.Integer readNodeInteger(java.lang.String xpathExpression, org.w3c.dom.Node sourceNode, java.lang.Integer valueForNull) throws PortalException
PortalException
public static java.lang.String readAttributeString(java.lang.String attributeName, org.w3c.dom.Node node) throws PortalException
PortalException
public static int readAttributeInt(java.lang.String attributeName, org.w3c.dom.Node node, int valueForNull) throws PortalException
attributeName
- node
- valueForNull
-
PortalException
public static java.lang.String readAttributeString(java.lang.String attributeName, org.w3c.dom.Node node, java.lang.String valueForNull) throws PortalException
PortalException
public static java.lang.String getTextContent(org.w3c.dom.Node node)
public static void setTextContent(org.w3c.dom.Node parentNode, java.lang.String textValue)
public static java.lang.String readNodeString(java.lang.String xpathExpression, org.w3c.dom.Node sourceNode) throws PortalException
PortalException
public static java.lang.String readNodeString(java.lang.String xpathExpression, org.w3c.dom.Node sourceNode, java.lang.String valueForNull) throws PortalException
PortalException
public static java.lang.String[] readNodesString(java.lang.String xpathExpression, org.w3c.dom.Node sourceNode) throws PortalException
PortalException
public static boolean nodeExists(java.lang.String xpathExpression, org.w3c.dom.Node sourceNode) throws PortalException
PortalException
public static org.w3c.dom.Element addTextNode(org.w3c.dom.Node xmlParentNode, java.lang.String newNodeName, java.lang.String newNodeText) throws PortalException
PortalException
public static org.w3c.dom.Element addTextNode(org.w3c.dom.Node xmlParentNode, java.lang.String xpathExpressionParentNode, java.lang.String newNodeName, java.lang.String newNodeText) throws PortalException
PortalException
public static org.w3c.dom.Node[] addTextNodes(org.w3c.dom.Node xmlParentNode, java.lang.String newNodesName, java.lang.String[] newNodesValue) throws PortalException
PortalException
public static org.w3c.dom.Node[] addTextNodes(org.w3c.dom.Node xmlParentNode, java.lang.String xpathExpressionParentNode, java.lang.String newNodesName, java.lang.String[] newNodesValue) throws java.lang.Exception
java.lang.Exception
public static org.w3c.dom.Node addNode(org.w3c.dom.Node xmlParentNode, java.lang.String newNodeName)
public static org.w3c.dom.Node addNode(org.w3c.dom.Node xmlParentNode, java.lang.String xpathExpressionParentNode, java.lang.String newNodeName) throws PortalException
PortalException
public static org.w3c.dom.Attr addNodeAttr(org.w3c.dom.Node xmlParentNode, java.lang.String attributeName)
public static org.w3c.dom.Attr addNodeAttr(org.w3c.dom.Node xmlParentNode, java.lang.String attributeName, java.lang.String value)
public static org.w3c.dom.Node copyNode(org.w3c.dom.Node xmlNodeFrom, org.w3c.dom.Node xmlNodeTo)
public static org.w3c.dom.Node copyNode(org.w3c.dom.Node xmlNodeFrom, java.lang.String xpathExpressionFrom, org.w3c.dom.Node xmlNodeTo) throws java.lang.Exception
java.lang.Exception
public static org.w3c.dom.Node copyNode(org.w3c.dom.Node xmlNodeFrom, org.w3c.dom.Node xmlNodeTo, java.lang.String xpathExpressionTo) throws java.lang.Exception
java.lang.Exception
public static org.w3c.dom.Node copyNode(org.w3c.dom.Node xmlNodeFrom, java.lang.String xpathExpressionFrom, org.w3c.dom.Node xmlNodeTo, java.lang.String xpathExpressionTo) throws java.lang.Exception
java.lang.Exception
public static org.w3c.dom.Document getDocumentFromFile(java.lang.String filePath) throws java.lang.Exception
java.lang.Exception
public static org.w3c.dom.Node selectSingleAncestorNode(java.lang.String ancestorNameQuery, org.w3c.dom.Node childNode) throws java.lang.Exception
java.lang.Exception
public static org.w3c.dom.Node[] selectAncestorNodes(java.lang.String ancestorNameQuery, org.w3c.dom.Node childNode) throws java.lang.Exception
java.lang.Exception
public static org.w3c.dom.Node importIntoNewDocument(org.w3c.dom.Node originalNode) throws PortalException
originalNode
-
PortalException
public static org.w3c.dom.Node selectSingleNode(java.lang.String childNameQuery, org.w3c.dom.Node parentNode) throws PortalException
PortalException
public static org.w3c.dom.Node[] selectNodes(java.lang.String childNameQuery, org.w3c.dom.Node parentNode) throws PortalException
PortalException
public static boolean checkCondition(org.w3c.dom.Node conditionNode, java.lang.String condition) throws java.lang.Exception
java.lang.Exception
public static boolean checkSingleCondition(org.w3c.dom.Node conditionNode, java.lang.String condition) throws java.lang.Exception
java.lang.Exception
protected static boolean checkCondition(java.lang.String leftValue, java.lang.String rightValue, java.lang.String conditionOperator)
protected static org.w3c.dom.Node selectSingleNodeRecursiveByName(java.lang.String nodeName, org.w3c.dom.Node parentNode) throws java.lang.Exception
java.lang.Exception
@Deprecated public static org.w3c.dom.Document getXMLDocumentFromString(java.lang.String xml) throws PortalException
getDocument(String)
.
PortalException
@Deprecated public static byte[] convertToUTFBytes(byte[] content)
public static org.w3c.dom.Node getOrCreateNode(java.lang.String path, org.w3c.dom.Node parentNode) throws PortalException
PortalException
public static org.w3c.dom.Node writeNodeString(java.lang.String xpathExpression, org.w3c.dom.Node sourceNode, java.lang.String nodeValue) throws PortalException
PortalException
public static java.lang.String readAttributeOrNodeString(org.w3c.dom.Node node, java.lang.String fieldName) throws PortalException
PortalException
public static java.lang.String readAttributeOrNodeString(org.w3c.dom.Node node, java.lang.String fieldName, java.lang.String valueForNull) throws PortalException
PortalException
public static void replaceChildNode(org.w3c.dom.Node parentNode, org.w3c.dom.Node newChildNode) throws java.lang.Exception
java.lang.Exception
public static void replaceChildNode(java.lang.String childNodeName, org.w3c.dom.Node node, java.lang.String xmlString) throws PortalException
PortalException
public static org.w3c.dom.Node addNodeFromXmlString(org.w3c.dom.Node node, java.lang.String xmlString) throws PortalException
PortalException
public static void mergeAttributes(org.w3c.dom.Node destinationNode, org.w3c.dom.Node sourceNode, boolean replace) throws PortalException
PortalException
public static void mergeElements(org.w3c.dom.Node destinationNode, org.w3c.dom.Node sourceNode, boolean replace) throws PortalException
destinationNode
- the destination node, where the elements will be
appended or replaced.sourceNode
- the source node, where the elements will be copied from.replace
- if true, elements with the same name will be replaced;
if false they will not be copied if an element in the destinationNode
with the same name already exists.
PortalException
public static java.lang.String encodeXml(java.lang.String pStr)
public static java.lang.String getXmlEncoding(java.lang.String xmlString)
The encoding is read from the XML declaration.
xmlString
- the xml.
public static boolean isValidXmlString(java.lang.String xml)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |