|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fi.iki.hsivonen.xml.DOMUtils
public class DOMUtils
A collection of utility methods for working with the DOM.
Constructor Summary | |
---|---|
DOMUtils()
|
Method Summary | |
---|---|
static Element |
findBody(Document doc)
|
static Element |
findElement(Node node,
String namespace,
String localName)
Finds the first occurrence of an element in the subtree rooted at node |
static Element |
getElementById(Node node,
String id)
Finds an element of that has an attribute called id which
has the given value and is not in a namespace. |
static void |
importChildrenBefore(Node from,
Node to,
Node ref)
|
static boolean |
isWhiteSpace(Node node)
Checks whether a node is a text or CDATA node consisting of white space only. |
static String |
language(Node node)
|
static Locale |
languageAsLocale(Node node)
|
static Document |
loadFromUrl(String url)
|
static void |
main(String[] args)
|
static DomConsumer |
newDomConsumer()
|
static DocumentBuilder |
newNonvalidatingDocumentBuilder()
Instantiates a DocumentBuilder which is non-validating,
is namespaces aware, expands entities using the local
DTDCatalog , doesn't make arbitrary network connections,
coalesces CDATA sections and ignores comments. |
static void |
serialize(Document doc,
OutputStream out)
|
static String |
textContent(Node node)
Returns the white space-normalized text content of the subtree rooted at node . |
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 final Element findElement(Node node, String namespace, String localName)
node
node
- the root of the subtree to searchnamespace
- the namespace URI of the element being seachedlocalName
- the local name of the element being seached
null
if not foundpublic static final Element getElementById(Node node, String id)
id
which
has the given value and is not in a namespace. The IDness of the
attribute is based on the attribute name--not on the DTD.
node
- the root of the subtree to searchid
- the value of the id attribute
public static final String textContent(Node node)
node
.
node
- the subtree
public static final DocumentBuilder newNonvalidatingDocumentBuilder()
DocumentBuilder
which is non-validating,
is namespaces aware, expands entities using the local
DTDCatalog
, doesn't make arbitrary network connections,
coalesces CDATA sections and ignores comments.
DocumentBuilder
public static final boolean isWhiteSpace(Node node)
node
- the node to examine
true
if it is a white space node and
false
otherwisepublic static final String language(Node node)
public static final Locale languageAsLocale(Node node)
public static final Element findBody(Document doc)
public static final void importChildrenBefore(Node from, Node to, Node ref)
public static DomConsumer newDomConsumer()
public static void serialize(Document doc, OutputStream out) throws IOException
IOException
public static Document loadFromUrl(String url) throws SAXException, IOException
SAXException
IOException
public static void main(String[] args) throws SAXException, IOException
SAXException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |