|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuk.ac.starlink.util.DOMUtils
public class DOMUtils
Provides convenience methods for handling DOMs.
| Method Summary | |
|---|---|
static org.w3c.dom.Element |
getChildElementByName(org.w3c.dom.Node parent,
java.lang.String name)
Returns the first child element of a node which has a given name. |
static org.w3c.dom.Element |
getFirstElementSibling(org.w3c.dom.Node node)
Returns the first subsequent sibling of a given node which is an Element. |
static java.lang.String |
getTextContent(org.w3c.dom.Element el)
Returns a string representing the plain text content of an element. |
static java.lang.String |
mapNodeType(short nodeType)
Maps a node type, as returned by to a name. |
static org.w3c.dom.Document |
newDocument()
Returns a new Document instance. |
static org.w3c.dom.Node |
relativizeDOM(org.w3c.dom.Node n,
java.net.URI baseURI,
java.lang.String attname)
Traverses the given DOM, relativising all the URIs in the uri attributes of each Element. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static org.w3c.dom.Element getChildElementByName(org.w3c.dom.Node parent,
java.lang.String name)
parent - the node whose children are to be searchedname - the name of the element being searched for
public static java.lang.String getTextContent(org.w3c.dom.Element el)
el - the element whose text content is wanted
public static org.w3c.dom.Element getFirstElementSibling(org.w3c.dom.Node node)
node - the node whose siblings (including itself) you are
interested in. May be null
public static org.w3c.dom.Node relativizeDOM(org.w3c.dom.Node n,
java.net.URI baseURI,
java.lang.String attname)
uri attributes of each Element.
The (uri-attribute) nodes in the input DOM are modified by this
method; if this is a problem, use Node.cloneNode(boolean) first.
n - a node containing the DOM whose URIs are to be
relativized. If this is null, the method immediately returns nullbaseURI - the URI relative to which the DOM is to be
relativised. If this is null, then the input node is
immediately returned unchanged.attname - the attribute name to be used. If null, this
defaults to uri
URI.relativize(java.net.URI)public static java.lang.String mapNodeType(short nodeType)
Node.getNodeType() are
numeric and are therefore inconveniently opaque.
nodeType - a numeric Node type, one of the node type
constants defined in Node
public static org.w3c.dom.Document newDocument()
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||