|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.pega.pegarules.pub.util.XMLUtils
public class XMLUtils
Utilities for dealing with XML NOTE: XMLEncode is available in JDK 1.4 (java.beans.XMLEncoder)
Field Summary | |
---|---|
static java.lang.String |
COPYRIGHT
|
static java.lang.String |
VERSION
|
Constructor Summary | |
---|---|
XMLUtils()
|
Method Summary | |
---|---|
static java.lang.StringBuffer |
encode(java.lang.String string)
Deprecated. |
static java.lang.StringBuffer |
encode(java.lang.StringBuffer in)
Encode the xml special characters "<",">","'",""","&". |
static java.lang.String |
encodeString(java.lang.String in)
Encode the xml special characters "<",">","'",""","&". |
static java.util.List |
getAllAttributes(org.w3c.dom.Element aNode)
Return all attributes of the given element node. |
static java.util.List |
getAllChildElements(org.w3c.dom.Element aNode)
Return all child elements of the given element node. |
static java.lang.String |
getAttributeValue(org.w3c.dom.Element aNode,
java.lang.String aAttrName)
Return the string value of the named attribute. |
static java.lang.String |
getAttributeValue(org.w3c.dom.Element aNode,
java.lang.String aNamespaceURI,
java.lang.String aLocalName)
Return the string value of the fully-qualified attribute. |
static org.w3c.dom.Element |
getChildElement(org.w3c.dom.Element aParent,
java.lang.String aName)
Perform a depth-first traversal of the parent element, and return the first child element with a matching tag name. |
static java.lang.String |
getElementNodeValue(org.w3c.dom.Element aNode)
Return a concatenated string of the text node children of the given element node. |
static org.w3c.dom.Element |
getFirstChildElement(org.w3c.dom.Element aNode)
Return the first child element node of the given element node. |
static org.w3c.dom.Element |
getNamedChildElement(org.w3c.dom.Element aNode,
java.lang.String aElemName)
Return the first child element node with a matching unqualified name. |
static org.w3c.dom.Element |
getNamedChildElement(org.w3c.dom.Element aNode,
java.lang.String aNamespaceURI,
java.lang.String aLocalName)
Return the first child element node with a matching qualified name. |
static java.util.List |
getNamedChildElements(org.w3c.dom.Element aNode,
java.lang.String aElemName)
Return all child element nodes with a matching unqualified name. |
static java.util.List |
getNamedChildElements(org.w3c.dom.Element aNode,
java.lang.String aNamespaceURI,
java.lang.String aLocalName)
Return all child element nodes with a matching qualified name. |
static org.w3c.dom.Element |
getNamedSiblingElement(org.w3c.dom.Element aNode,
java.lang.String aElemName)
Return the first sibling element node with a matching unqualified name. |
static org.w3c.dom.Element |
getNamedSiblingElement(org.w3c.dom.Element aNode,
java.lang.String aNamespaceURI,
java.lang.String aLocalName)
Return the first sibling element node with a matching qualified name. |
static org.w3c.dom.Element |
getNextSiblingElement(org.w3c.dom.Element aNode)
Return the immediate sibling element node of the given element node. |
static javax.xml.namespace.QName |
getTypeQName(org.w3c.dom.Element aNode)
Return the resolved qualified name of the type referred to by the 'xsi:type' attribute of the given element node. |
static boolean |
isNil(org.w3c.dom.Element aNode)
Return the boolean value of the named attribute. |
static java.lang.String |
resolveNamespaceURI(org.w3c.dom.Element aNode,
java.lang.String aPrefix)
Return the namespace URI associated with the given prefix. |
static java.lang.String |
resolveNSPrefix(org.w3c.dom.Element aNode,
java.lang.String aNamespaceURI)
Return the prefix associated with the given namespace URI. |
static javax.xml.namespace.QName |
resolveQNameRef(org.w3c.dom.Element aNode,
java.lang.String aRefVal)
Return the resolved qualified name of the specified value, which may contain a prefix that refers to a namespace mapping in one of the node's ancestors. |
static void |
simpleAddElement(java.lang.StringBuffer xml,
java.lang.String tag,
long data)
Given a stringbuffer of xml data, append a new tag named tag data of data. |
static void |
simpleAddElement(java.lang.StringBuffer xml,
java.lang.String tag,
java.lang.String data)
Given a stringbuffer of xml data, append a new tag named tag data of data. |
static void |
simpleAddElement(java.lang.StringBuffer xml,
java.lang.String tag,
java.lang.StringBuffer data)
Given a stringbuffer of xml data, append a new tag named tag data of data. |
static void |
simpleEmbedElements(java.lang.StringBuffer xml,
java.lang.String tag,
java.lang.String data)
Given a stringbuffer of xml data, append a new tag named tag data of data. |
static void |
simpleEmbedElements(java.lang.StringBuffer xml,
java.lang.String tag,
java.lang.StringBuffer data)
Given a stringbuffer of xml data, append a new tag named tag data of data. |
static java.lang.String |
simpleStripHeader(java.lang.String xml)
Remove the XML header. |
static java.lang.String |
simpleStripRoot(java.lang.String xml)
Strips root element from a string of xml. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String COPYRIGHT
public static final java.lang.String VERSION
Constructor Detail |
---|
public XMLUtils()
Method Detail |
---|
public static java.lang.String resolveNamespaceURI(org.w3c.dom.Element aNode, java.lang.String aPrefix)
aNode
- the element node that the search will start fromaPrefix
- the prefix shortcut for the namespace URI
public static java.lang.String resolveNSPrefix(org.w3c.dom.Element aNode, java.lang.String aNamespaceURI)
aNode
- the element node that the search will start fromaNamespaceURI
- the namespace URI for the prefix
public static javax.xml.namespace.QName resolveQNameRef(org.w3c.dom.Element aNode, java.lang.String aRefVal)
aNode
- the element node that the search will start fromaRefVal
- the value to be resolved
public static javax.xml.namespace.QName getTypeQName(org.w3c.dom.Element aNode)
aNode
- the element node that may contain
the 'xsi:type' attribute
public static java.lang.String getAttributeValue(org.w3c.dom.Element aNode, java.lang.String aAttrName)
aNode
- the element that contains the attributeaAttrName
- the unqualified attribute name
public static boolean isNil(org.w3c.dom.Element aNode)
aNode
- the element that contains the attribute
public static java.lang.String getAttributeValue(org.w3c.dom.Element aNode, java.lang.String aNamespaceURI, java.lang.String aLocalName)
aNode
- the element node that contains the attributeaNamespaceURI
- the namespace qualifier of the attribute nameaLocalName
- the local part of the attribute name
public static java.lang.String getElementNodeValue(org.w3c.dom.Element aNode)
aNode
- the element node
public static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Element aNode)
aNode
- the parent element node
public static org.w3c.dom.Element getNextSiblingElement(org.w3c.dom.Element aNode)
aNode
- the element node
public static org.w3c.dom.Element getNamedChildElement(org.w3c.dom.Element aNode, java.lang.String aElemName)
aNode
- the parent element nodeaElemName
- the unqualified child element name
public static org.w3c.dom.Element getNamedChildElement(org.w3c.dom.Element aNode, java.lang.String aNamespaceURI, java.lang.String aLocalName)
aNode
- the parent element nodeaNamespaceURI
- the namespace qualifier of the child element nameaLocalName
- the local part of the child element name
public static org.w3c.dom.Element getNamedSiblingElement(org.w3c.dom.Element aNode, java.lang.String aElemName)
aNode
- the starting element nodeaElemName
- the unqualified sibling element name
public static org.w3c.dom.Element getNamedSiblingElement(org.w3c.dom.Element aNode, java.lang.String aNamespaceURI, java.lang.String aLocalName)
aNode
- the starting element nodeaNamespaceURI
- the namespace qualifier of the sibling element nameaLocalName
- the local part of the sibling element name
public static java.util.List getNamedChildElements(org.w3c.dom.Element aNode, java.lang.String aElemName)
aNode
- the parent element nodeaElemName
- the unqualified child element name
public static java.util.List getNamedChildElements(org.w3c.dom.Element aNode, java.lang.String aNamespaceURI, java.lang.String aLocalName)
aNode
- the parent element nodeaNamespaceURI
- the namespace qualifier of the child element nameaLocalName
- the local part of the child element name
public static java.util.List getAllAttributes(org.w3c.dom.Element aNode)
aNode
- the element node
public static java.util.List getAllChildElements(org.w3c.dom.Element aNode)
aNode
- the parent element node
public static org.w3c.dom.Element getChildElement(org.w3c.dom.Element aParent, java.lang.String aName)
aParent
- the parent element nodeaName
- the element tag name to search for
public static java.lang.String encodeString(java.lang.String in)
in
- string to encode
public static java.lang.StringBuffer encode(java.lang.String string)
string
- to encode
public static java.lang.StringBuffer encode(java.lang.StringBuffer in)
in
- buffer to encode
public static void simpleAddElement(java.lang.StringBuffer xml, java.lang.String tag, java.lang.StringBuffer data)
Data will be encoded.
xml
- tag
- data
- public static void simpleAddElement(java.lang.StringBuffer xml, java.lang.String tag, java.lang.String data)
Data will be encoded.
xml
- tag
- data
- public static void simpleAddElement(java.lang.StringBuffer xml, java.lang.String tag, long data)
xml
- tag
- data
- public static void simpleEmbedElements(java.lang.StringBuffer xml, java.lang.String tag, java.lang.StringBuffer data)
Data will *not* be encoded.
xml
- tag
- data
- public static void simpleEmbedElements(java.lang.StringBuffer xml, java.lang.String tag, java.lang.String data)
Data will *not* be encoded.
xml
- tag
- data
- public static java.lang.String simpleStripHeader(java.lang.String xml)
Useful if this XML is to be encapsulated by other tags...
xml
-
public static java.lang.String simpleStripRoot(java.lang.String xml)
ex: in:out:
xml
- XML to strip
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |