| java.lang.Object org.objectweb.jonas.tools.migration.jboss.Transformer
All known Subclasses: org.objectweb.jonas.tools.migration.jboss.Migrate,
Transformer | public class Transformer (Code) | | 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.
author: Rafael H. Schloming <rhs@mit.edu> |
Inner Class :protected interface NodeFilter | |
Field Summary | |
final protected static NodeFilter | ALL A predefined
NodeFilter that accepts all nodes. | final protected static 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(String comment) Adds a comment to the current node. | protected void | get(Node node, String name, Collection result, NodeFilter filter) Queries a node for child elements with a given name and filters
the result based on a given
NodeFilter . | protected Document | getDocument() Returns the output document. | protected boolean | isEmpty(String str) | protected Node | node(Node node, String path) Queries a node for a single descedent element at a given path. | protected List | nodes(Node node, String path) Queries a node for all descendent elements at a given path. | protected void | open(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(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(Node node, String path, Collection result) Queries the given node for all elements at a given path. | protected void | query(Node node, String path, Collection result, NodeFilter filter) Queries the given node for all elements at a given path and
filters the result. | protected void | rename(Collection nodes, Map substitutions) | protected void | rename(Node node, Map substitutions) | protected void | set(String name, String value) Sets an attribute on the current element. | protected Node | singleton(Collection c) | protected void | tag(String name, 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(String text) Adds the given text to the current node. | protected String | value(Node node, String path) Queries a node for a string value at a given path. | protected List | values(Node node, String path) |
ALL | final protected static NodeFilter ALL(Code) | | A predefined
NodeFilter that accepts all nodes.
|
LINE | final protected static String LINE(Code) | | A predefined
String containing the line seperator for
this system.
|
Transformer | protected Transformer()(Code) | | Constructs a new Transformer ready to output to an empty document.
|
close | protected void close()(Code) | | Adds a text node with the appropriate amount of whitespace and
restores the previous current node.
See Also: Transformer.close(boolean) |
close | protected void close(boolean indent)(Code) | | Restores the previous current node. If indent is
true an appropriate amount of indenting whitespace is added
before restoring the previous current node.
Parameters: indent - a flag indicating whether or not to indent |
comment | protected void comment(String comment)(Code) | | Adds a comment to the current node.
Parameters: comment - the text of the comment |
get | protected void get(Node node, String name, Collection result, NodeFilter filter)(Code) | | Queries a node for child elements with a given name and filters
the result based on a given
NodeFilter .
Parameters: node - the node to query Parameters: name - the name of the child elements to get Parameters: result - the collection to add the results to Parameters: filter - the result filter |
getDocument | protected Document getDocument()(Code) | | Returns the output document.
the output document |
node | protected Node node(Node node, String path)(Code) | | Queries a node for a single descedent element at a given path.
Parameters: node - the node to query Parameters: path - the path the node or null if none is found throws: IllegalStateException - if more than one node is found |
nodes | protected List nodes(Node node, String path)(Code) | | Queries a node for all descendent elements at a given path.
Parameters: node - the node to query Parameters: path - the path the resulting list of nodes |
open | protected void open(String name)(Code) | | Creates a new child element of the current node with the given
name and makes the new element the current node. A text node is
added with an appropriate amount of indenting whitespace before
the new element is added.
Parameters: name - the name of the new element See Also: Transformer.open(String,boolean) |
open | protected void open(String name, boolean indent)(Code) | | Creates a new child element of the current node with the given
name and makes the new element the current node. If indent is
true then a text node with the appropriate amount of whitespace
is added before the new element is created.
Parameters: name - the name of the new node Parameters: indent - a flag indicating whether or not to indent |
query | protected void query(Node node, String path, Collection result)(Code) | | Queries the given node for all elements at a given path.
Parameters: node - the node to query Parameters: path - the path Parameters: result - the collection to add results to |
query | protected void query(Node node, String path, Collection result, NodeFilter filter)(Code) | | Queries the given node for all elements at a given path and
filters the result.
Parameters: node - the node to query Parameters: the - path Parameters: result - the collection to add results to Parameters: filter - the NodeFilter used to filter the results |
set | protected void set(String name, String value)(Code) | | Sets an attribute on the current element.
Parameters: name - the attribute name Parameters: value - the attribute value throws: IllegalStateException - if the current node is not anelement |
tag | protected void tag(String name, String value)(Code) | | 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.
Parameters: name - the name of the element Parameters: value - the value of the text node |
text | protected void text(String text)(Code) | | Adds the given text to the current node.
Parameters: text - the text to add |
value | protected String value(Node node, String path)(Code) | | Queries a node for a string value at a given path.
Parameters: node - the node to query Parameters: path - the path the value or null if there is none throws: IllegalStateException - if the node exists but has novalue |
|
|