|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectinfo.aduna.xml.NodeUtil
public class NodeUtil
Defines some util methods on DOM nodes.
| Constructor Summary | |
|---|---|
NodeUtil()
|
|
| Method Summary | |
|---|---|
static Element |
getChildElement(Node node,
int index)
Returns the n-th child element. |
static Element |
getChildElement(Node node,
String name)
Returns the first child element with the given name. |
static List<Element> |
getChildElements(Node node)
Get all child elements of the given node. |
static List<Element> |
getChildElements(Node node,
String name)
Get all childELEMENTS with name 'name' from the given node. |
static List<Node> |
getChildNodes(Node node,
String name)
|
static List<Element> |
getDescendingElements(Node node,
String name)
Get all descending elements from the given node with the given name. |
static List<Node> |
getDescendingNodes(Node node,
String name)
Get all descending nodes from the given node with the given name. |
static Element |
getLastChildElement(Node node)
Returns the last child element of the specified node. |
static String |
getText(Node node)
Get all text-content of a node. |
static String |
getText(Node node,
boolean spaces)
|
static void |
getText(Node node,
StringBuilder buffer,
boolean spaces)
Add all text-content of a node to a stringBuilder. |
static String |
toLegalXMLString(String s)
|
static void |
writeAttribute(Attr attribute,
PrintStream output)
|
static void |
writeCDATA(CDATASection cdata,
PrintStream output)
|
static void |
writeChildren(Node node,
PrintStream output)
|
static void |
writeComment(Comment comment,
PrintStream output)
|
static void |
writeDocument(Document document,
PrintStream output)
|
static void |
writeDocumentFragment(DocumentFragment documentFragment,
PrintStream output)
|
static void |
writeDocumentType(DocumentType documentType,
PrintStream output)
|
static void |
writeElement(Element element,
PrintStream output)
|
static void |
writeEntity(Entity entity,
PrintStream output)
|
static void |
writeEntityReference(EntityReference entityReference,
PrintStream output)
|
static void |
writeNotation(Notation notation,
PrintStream output)
|
static void |
writeProcessingInstruction(ProcessingInstruction instr,
PrintStream output)
|
static void |
writeText(Text text,
PrintStream output)
|
static void |
writeXML(Node node,
OutputStream output)
Write the contents of a DOM (sub)tree to a stream. |
static void |
writeXMLNode(Node node,
PrintStream output)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NodeUtil()
| Method Detail |
|---|
public static List<Element> getChildElements(Node node)
node - the node to get the childelements from.
public static List<Element> getDescendingElements(Node node,
String name)
node - the parent nodename - the tagname of the elements that are returned
public static List<Node> getDescendingNodes(Node node,
String name)
node - the node to get the descending nodes from.name - the name of the nodes that are returned
public static List<Node> getChildNodes(Node node,
String name)
public static List<Element> getChildElements(Node node,
String name)
node - the node to get the childelements from.
public static Element getChildElement(Node node,
String name)
public static Element getChildElement(Node node,
int index)
IllegalArgumentException - when index < 0public static Element getLastChildElement(Node node)
public static String getText(Node node)
node - the node to get the text from.
public static String getText(Node node,
boolean spaces)
public static void getText(Node node,
StringBuilder buffer,
boolean spaces)
node - the node to get the text from.buffer - a stringbuilder to add the text to.spaces - indicates whether to put spaces between the TEXT nodes, before
concatenating their content. This is useful if you want to know
where words begin and end in your original text.public static String toLegalXMLString(String s)
public static void writeXML(Node node,
OutputStream output)
public static void writeXMLNode(Node node,
PrintStream output)
public static void writeDocument(Document document,
PrintStream output)
public static void writeDocumentType(DocumentType documentType,
PrintStream output)
public static void writeDocumentFragment(DocumentFragment documentFragment,
PrintStream output)
public static void writeElement(Element element,
PrintStream output)
public static void writeAttribute(Attr attribute,
PrintStream output)
public static void writeText(Text text,
PrintStream output)
public static void writeCDATA(CDATASection cdata,
PrintStream output)
public static void writeEntity(Entity entity,
PrintStream output)
public static void writeEntityReference(EntityReference entityReference,
PrintStream output)
public static void writeProcessingInstruction(ProcessingInstruction instr,
PrintStream output)
public static void writeComment(Comment comment,
PrintStream output)
public static void writeNotation(Notation notation,
PrintStream output)
public static void writeChildren(Node node,
PrintStream output)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||