Package edu.wisc.ssec.mcidasv.util
Class XmlUtil
java.lang.Object
ucar.unidata.xml.XmlUtil
edu.wisc.ssec.mcidasv.util.XmlUtil
A collection of utilities for XML.
-
Field Summary
Fields inherited from class ucar.unidata.xml.XmlUtil
NULL_STRING, TAG_WILDCARD, XML_HEADER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindDescendantNamesWithSeparator(Node parent, String tag, String separator) Find all of the descendant elements of the given parent Node whose tag name equals the given tag.private static voidfindDescendantNamesWithSeparator(Node parent, String tag, String descendants, String separator, List<String> found) Find all of the descendant elements of the given parent Node whose tag name equals the given tag.static ElementgetElementAtNamedPath(Node parent, List<String> nameList) Find the element described by nameList (path).static ElementgetMakeElementAtNamedPath(Node parent, List<String> nameList, String tagName, boolean makeNew) Find the element described by nameList (path).static ElementmakeElementAtNamedPath(Node parent, List<String> nameList, String tagName) Make the element described by nameList (path).static voidPrint all the attributes of the given nodestatic StringThis method ensures that the output String has only valid XML unicode characters as specified by the XML 1.0 standard.Methods inherited from class ucar.unidata.xml.XmlUtil
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
-
Constructor Details
-
XmlUtil
public XmlUtil()
-
-
Method Details
-
printNode
Print all the attributes of the given node- Parameters:
parent- Node whose attributes will be printed.
-
findDescendantNamesWithSeparator
public static List<String> findDescendantNamesWithSeparator(Node parent, String tag, String separator) Find all of the descendant elements of the given parent Node whose tag name equals the given tag.- Parameters:
parent- Root of the XML DOM tree to search.tag- Tag name to match.separator- String that separates tags into components.- Returns:
- List of descendants that match the given tag.
-
findDescendantNamesWithSeparator
private static void findDescendantNamesWithSeparator(Node parent, String tag, String descendants, String separator, List<String> found) Find all of the descendant elements of the given parent Node whose tag name equals the given tag.- Parameters:
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.
-
getElementAtNamedPath
Find the element described by nameList (path).- Parameters:
parent- Node at which the search should begin.nameList- List of node names to search for (think xpath).- Returns:
Elementdescribed by the given path, ornullif there was a problem.
-
makeElementAtNamedPath
Make the element described by nameList (path).- Parameters:
parent- Node at which the search should begin.nameList- List of node names to search for (think xpath).tagName- Tag name to locate.- Returns:
Elementdescribed by the given path, ornullif there was a problem.
-
getMakeElementAtNamedPath
public static Element getMakeElementAtNamedPath(Node parent, List<String> nameList, String tagName, boolean makeNew) Find the element described by nameList (path).- Parameters:
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 newElementshould be created.- Returns:
Elementdescribed by the given path, ornullif there was a problem.
-
stripNonValidXMLCharacters
This method ensures that the output String has only valid XML unicode characters as specified by the XML 1.0 standard.For reference, please see the standard. This method will return an empty String if the input is null or empty.
- Parameters:
in- String whose non-valid characters we want to remove.- Returns:
- The in String, stripped of non-valid characters.
-