|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openxri.util.DOMUtils
public class DOMUtils
Provides simple, standrard utilities for dealing with DOM. Parts of this code are based on code available from OpenSAML. See www.opensaml.org.
Constructor Summary | |
---|---|
DOMUtils()
|
Method Summary | |
---|---|
static java.util.Date |
fromXMLDateTime(java.lang.String sTime)
Converts the specified String in xsd:DateTime format (GMT) to a Java Date object |
static org.apache.xerces.parsers.DOMParser |
getDOMParser()
Returns a DOMParser object that can safely be used in the current thread. |
static org.w3c.dom.Element |
getFirstChildElement(org.w3c.dom.Node n)
Gets the first child Element of the node, skipping any Text nodes such as whitespace. |
static org.w3c.dom.Element |
getFirstChildElement(org.w3c.dom.Node oNode,
java.lang.String sNS,
java.lang.String sTag)
Gets the first child Element matching the NS and tag from the given node * |
static org.w3c.dom.Element |
getNextSiblingElement(org.w3c.dom.Node oNode)
Gets the next sibling Element of the node. |
static java.lang.String |
getText(org.w3c.dom.Node root)
Gets the text string associated with a node |
static boolean |
isElementNamed(org.w3c.dom.Element oElem,
java.lang.String sNS,
java.lang.String sTag)
Checks if an element matches the given namespace and tag |
static java.lang.String |
toString(org.w3c.dom.Document doc)
Converts a Document into a formated XML string. |
static java.lang.String |
toString(org.w3c.dom.Element oElt)
This is a convenience method to pretty format an Element. |
static java.lang.String |
toString(org.w3c.dom.Element oElt,
boolean bIndent,
boolean bOmitXMLDeclaration)
Serializes the specified element. |
static java.lang.String |
toString(org.w3c.dom.Element oElt,
org.apache.xml.serialize.OutputFormat oFormat)
Serializes the specified element. |
static java.lang.String |
toXMLDateTime(java.util.Date oTime)
Converts the Java Date object to a xsd:DateTime String in GMT. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DOMUtils()
Method Detail |
---|
public static org.apache.xerces.parsers.DOMParser getDOMParser()
public static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Node oNode, java.lang.String sNS, java.lang.String sTag)
oNode
- The node to look undersNS
- The namespace URI of the elementsTag
- The tag name of the element to locate
public static org.w3c.dom.Element getNextSiblingElement(org.w3c.dom.Node oNode)
oNode
- The sibling to start searching from
public static boolean isElementNamed(org.w3c.dom.Element oElem, java.lang.String sNS, java.lang.String sTag)
public static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Node n)
n
- The parent in which to search for children
public static java.lang.String toString(org.w3c.dom.Element oElt)
public static java.lang.String toString(org.w3c.dom.Element oElt, boolean bIndent, boolean bOmitXMLDeclaration)
oElt
- - The element to serializebIndent
- - Whether or not to pretty printbOmitXMLDeclaration
- - Whether or not to omit the XML preamblepublic static java.lang.String toString(org.w3c.dom.Element oElt, org.apache.xml.serialize.OutputFormat oFormat)
oElt
- - The element to serializeoFormat
- - The output format to usepublic static java.util.Date fromXMLDateTime(java.lang.String sTime) throws java.text.ParseException
java.text.ParseException
public static java.lang.String toXMLDateTime(java.util.Date oTime)
public static java.lang.String getText(org.w3c.dom.Node root)
root
- Node
object from which text to be extracted.
public static java.lang.String toString(org.w3c.dom.Document doc)
Document
into a formated XML string.
doc
- Document
to be converted into a string.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |