net.firstpartners.nounit.utility
Class XmlUtil
java.lang.Object
|
+--net.firstpartners.nounit.utility.XmlUtil
- public class XmlUtil
- extends java.lang.Object
General XML Utility Functions
Method Summary |
static org.jdom.Element |
findNode(org.jdom.Document inDocumentToSearch,
java.lang.String uniqueIdentifierName,
java.lang.String uniqueIdentifierToFind)
Search for Nodes within Jdom Document
|
static java.util.HashSet |
getAllNodes(org.jdom.Document inXmlDocument)
gets all elements in the XML Document Being Passed in
|
static java.util.HashMap |
getNodeIndex(org.jdom.Document inXmlDocument,
java.lang.String uniqueAttribute)
indexes the nodes in the document that is passed in , via a HashMap mapping
mapping is in the format as String , handle to of node
Strings are used as they are better lookup in the hashmap. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XmlUtil
public XmlUtil()
getNodeIndex
public static java.util.HashMap getNodeIndex(org.jdom.Document inXmlDocument,
java.lang.String uniqueAttribute)
- indexes the nodes in the document that is passed in , via a HashMap mapping
mapping is in the format as String , handle to of node
Strings are used as they are better lookup in the hashmap.
- Parameters:
inXmlDocument
- to generated the hashmap fromuniqueAttribute
- to do the index on (i.e. key in HashMap). Examples
of uniqueAttributes are id's or names.- Returns:
- HashMap containing mappings
getAllNodes
public static java.util.HashSet getAllNodes(org.jdom.Document inXmlDocument)
- gets all elements in the XML Document Being Passed in
- Parameters:
inXmlDocument
- to generated the hashmap from- Returns:
- nodeList containing nodes
findNode
public static org.jdom.Element findNode(org.jdom.Document inDocumentToSearch,
java.lang.String uniqueIdentifierName,
java.lang.String uniqueIdentifierToFind)
- Search for Nodes within Jdom Document
- Parameters:
inDocumentToSearch
- XML-JDOM DocumentuniqueIdentifierName
- we can use to index the document (unique
attribute like id or name present on the node we are searching for)uniqueIdentifierToFind
- in the indexed document