|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.objectweb.jonas.tools.migration.jboss.Transformer
The Transformer class contains methods for querying one or more input documents and building a new output document. Transformation tasks such as these can also be programmed in XSL and performed by an XSLT engine, however, for certain kinds of transformations it may be useful to perform them in Java by extending the Transformer class.
Nested Class Summary | |
protected static class |
Transformer.Mapper
|
protected static interface |
Transformer.NodeFilter
Interface used to filter nodes when querying an input document. |
Field Summary | |
protected static Transformer.NodeFilter |
ALL
A predefined Transformer.NodeFilter that accepts all nodes. |
protected static java.lang.String |
LINE
A predefined String containing the line seperator for
this system. |
Constructor Summary | |
protected |
Transformer()
Constructs a new Transformer ready to output to an empty document. |
Method Summary | |
protected void |
close()
Adds a text node with the appropriate amount of whitespace and restores the previous current node. |
protected void |
close(boolean indent)
Restores the previous current node. |
protected void |
comment(java.lang.String comment)
Adds a comment to the current node. |
protected void |
get(org.w3c.dom.Node node,
java.lang.String name,
java.util.Collection result,
Transformer.NodeFilter filter)
Queries a node for child elements with a given name and filters the result based on a given Transformer.NodeFilter . |
protected org.w3c.dom.Document |
getDocument()
Returns the output document. |
protected boolean |
isEmpty(java.lang.String str)
|
protected org.w3c.dom.Node |
node(org.w3c.dom.Node node,
java.lang.String path)
Queries a node for a single descedent element at a given path. |
protected java.util.List |
nodes(org.w3c.dom.Node node,
java.lang.String path)
Queries a node for all descendent elements at a given path. |
protected void |
open(java.lang.String name)
Creates a new child element of the current node with the given name and makes the new element the current node. |
protected void |
open(java.lang.String name,
boolean indent)
Creates a new child element of the current node with the given name and makes the new element the current node. |
protected void |
query(org.w3c.dom.Node node,
java.lang.String path,
java.util.Collection result)
Queries the given node for all elements at a given path. |
protected void |
query(org.w3c.dom.Node node,
java.lang.String path,
java.util.Collection result,
Transformer.NodeFilter filter)
Queries the given node for all elements at a given path and filters the result. |
protected void |
rename(java.util.Collection nodes,
java.util.Map substitutions)
|
protected void |
rename(org.w3c.dom.Node node,
java.util.Map substitutions)
|
protected void |
set(java.lang.String name,
java.lang.String value)
Sets an attribute on the current element. |
protected org.w3c.dom.Node |
singleton(java.util.Collection c)
|
protected void |
tag(java.lang.String name,
java.lang.String value)
Creates an element with the given name that contains a single text node with the given value and adds it as a child to the current node. |
protected void |
text(java.lang.String text)
Adds the given text to the current node. |
protected java.lang.String |
value(org.w3c.dom.Node node,
java.lang.String path)
Queries a node for a string value at a given path. |
protected java.util.List |
values(org.w3c.dom.Node node,
java.lang.String path)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final Transformer.NodeFilter ALL
Transformer.NodeFilter
that accepts all nodes.
protected static final java.lang.String LINE
String
containing the line seperator for
this system.
Constructor Detail |
protected Transformer()
Method Detail |
protected org.w3c.dom.Document getDocument()
protected void open(java.lang.String name)
name
- the name of the new elementopen(String, boolean)
protected void open(java.lang.String name, boolean indent)
name
- the name of the new nodeindent
- a flag indicating whether or not to indentprotected void close()
close(boolean)
protected void close(boolean indent)
indent
- a flag indicating whether or not to indentprotected void set(java.lang.String name, java.lang.String value)
name
- the attribute namevalue
- the attribute value
java.lang.IllegalStateException
- if the current node is not an
elementprotected void text(java.lang.String text)
text
- the text to addprotected void comment(java.lang.String comment)
comment
- the text of the commentprotected void tag(java.lang.String name, java.lang.String value)
name
- the name of the elementvalue
- the value of the text nodeprotected void get(org.w3c.dom.Node node, java.lang.String name, java.util.Collection result, Transformer.NodeFilter filter)
Transformer.NodeFilter
.
node
- the node to queryname
- the name of the child elements to getresult
- the collection to add the results tofilter
- the result filterprotected void query(org.w3c.dom.Node node, java.lang.String path, java.util.Collection result)
node
- the node to querypath
- the pathresult
- the collection to add results toprotected void query(org.w3c.dom.Node node, java.lang.String path, java.util.Collection result, Transformer.NodeFilter filter)
node
- the node to queryresult
- the collection to add results tofilter
- the Transformer.NodeFilter
used to filter the resultsprotected java.util.List nodes(org.w3c.dom.Node node, java.lang.String path)
node
- the node to querypath
- the path
protected org.w3c.dom.Node node(org.w3c.dom.Node node, java.lang.String path)
node
- the node to querypath
- the path
java.lang.IllegalStateException
- if more than one node is foundprotected java.lang.String value(org.w3c.dom.Node node, java.lang.String path)
node
- the node to querypath
- the path
java.lang.IllegalStateException
- if the node exists but has no
valueprotected java.util.List values(org.w3c.dom.Node node, java.lang.String path)
protected org.w3c.dom.Node singleton(java.util.Collection c)
protected boolean isEmpty(java.lang.String str)
protected void rename(java.util.Collection nodes, java.util.Map substitutions)
protected void rename(org.w3c.dom.Node node, java.util.Map substitutions)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |