|
|||||||||
| 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 Element |
getChildElementByName(Node parent,
String name)
Returns the first child element of a node which has a given name. |
static Element |
getFirstElementSibling(Node node)
Returns the first subsequent sibling of a given node which is an Element. |
static String |
getTextContent(Element el)
Returns a string representing the plain text content of an element. |
static String |
mapNodeType(short nodeType)
Maps a node type, as returned by to a name. |
static Document |
newDocument()
Returns a new Document instance. |
static Node |
relativizeDOM(Node n,
URI baseURI,
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 Element getChildElementByName(Node parent,
String name)
parent - the node whose children are to be searchedname - the name of the element being searched for
public static String getTextContent(Element el)
el - the element whose text content is wanted
public static Element getFirstElementSibling(Node node)
node - the node whose siblings (including itself) you are
interested in. May be null
public static Node relativizeDOM(Node n,
URI baseURI,
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 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 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 | ||||||||