public abstract class XmlUtil extends ucar.unidata.xml.XmlUtil
Constructor and Description |
---|
XmlUtil() |
Modifier and Type | Method and Description |
---|---|
static java.util.List<java.lang.String> |
findDescendantNamesWithSeparator(org.w3c.dom.Node parent,
java.lang.String tag,
java.lang.String separator)
Find all of the descendant elements of the given parent Node whose tag
name equals the given tag.
|
private static void |
findDescendantNamesWithSeparator(org.w3c.dom.Node parent,
java.lang.String tag,
java.lang.String descendants,
java.lang.String separator,
java.util.List<java.lang.String> found)
Find all of the descendant elements of the given parent Node whose
tag name equals the given tag.
|
static org.w3c.dom.Element |
getElementAtNamedPath(org.w3c.dom.Node parent,
java.util.List<java.lang.String> nameList)
Find the element described by nameList (path).
|
static org.w3c.dom.Element |
getMakeElementAtNamedPath(org.w3c.dom.Node parent,
java.util.List<java.lang.String> nameList,
java.lang.String tagName,
boolean makeNew)
Find the element described by nameList (path).
|
static org.w3c.dom.Element |
makeElementAtNamedPath(org.w3c.dom.Node parent,
java.util.List<java.lang.String> nameList,
java.lang.String tagName)
Make the element described by nameList (path).
|
static void |
printNode(org.w3c.dom.Node parent)
Print all the attributes of the given node
|
static java.lang.String |
stripNonValidXMLCharacters(java.lang.String in)
This method ensures that the output String has only valid XML unicode
characters as specified by the XML 1.0 standard.
|
addChildren, appendCdata, appendCdataBytes, attr, attr, attrs, attrs, attrs, attrs, attrs, calculateRFC2104HMAC, closeTag, comment, create, create, create, create, create, create, create, create, create, create, create, create, createCDataNode, decodeBase64, encodeBase64, encodeString, ensureAttributes, findAncestor, findChild, findChildRecurseUp, findChildren, findChildrenRecurseUp, findDescendant, findDescendantFromPath, findDescendants, findDescendantsFromPath, findElement, findElement, findRoot, findUrlRefNode, findUrlRefNode, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttributeFromTree, getAttributeFromTree, getAttributeFromTree, getAttributeFromTree, getAttributesFromTree, getAttributesFromTree, getCdata, getChildText, getDocument, getDocument, getDocument, getElement, getElements, getElements, getElements, getFirstChild, getGrandChildren, getGrandChildText, getGrandChildText, getGrandChildValue, getHeader, getListOfElements, getLocalName, getNodeName, getRoot, getRoot, getRoot, hasAttribute, isFullyQualified, isTag, main, makeCDataNode, makeCDataNode, makeDocument, mergeAttributes, openTag, openTag, quote, removeChildren, setAttribute, setAttributes, tag, tag, toHtml, toString, toString, toString, toString, toString, toStringNoChildren, toStringWithHeader, toStringWithHeader, toStringWithHeader
public XmlUtil()
public static void printNode(org.w3c.dom.Node parent)
parent
- Node whose attributes will be printed.public static java.util.List<java.lang.String> findDescendantNamesWithSeparator(org.w3c.dom.Node parent, java.lang.String tag, java.lang.String separator)
parent
- Root of the XML DOM tree to search.tag
- Tag name to match.separator
- String that separates tags into components.private static void findDescendantNamesWithSeparator(org.w3c.dom.Node parent, java.lang.String tag, java.lang.String descendants, java.lang.String separator, java.util.List<java.lang.String> found)
parent
- Root of the XML DOM tree to search.tag
- Tag name to match.descendants
- Descendant elements.separator
- String separating tag components (also in descendants).found
- List of descendants that match the given tag.public static org.w3c.dom.Element getElementAtNamedPath(org.w3c.dom.Node parent, java.util.List<java.lang.String> nameList)
parent
- Node at which the search should begin.nameList
- List of node names to search for (think xpath).Element
described by the given path, or null
if
there was a problem.public static org.w3c.dom.Element makeElementAtNamedPath(org.w3c.dom.Node parent, java.util.List<java.lang.String> nameList, java.lang.String tagName)
parent
- Node at which the search should begin.nameList
- List of node names to search for (think xpath).tagName
- Tag name to locate.Element
described by the given path, or null
if
there was a problem.public static org.w3c.dom.Element getMakeElementAtNamedPath(org.w3c.dom.Node parent, java.util.List<java.lang.String> nameList, java.lang.String tagName, boolean makeNew)
parent
- Node at which the search should begin.nameList
- List of node names to search for (think xpath).tagName
- Tag name to locate.makeNew
- Whether or not a new Element
should be created.Element
described by the given path, or null
if
there was a problem.public static java.lang.String stripNonValidXMLCharacters(java.lang.String in)
For reference, please see the standard. This method will return an empty String if the input is null or empty.
in
- String whose non-valid characters we want to remove.