| Method from org.dom4j.rule.Stylesheet Detail: |
public void addRule(Rule rule) {
ruleManager.addRule(rule);
}
Add a rule to this stylesheet. |
public void applyTemplates(Object input) throws Exception {
applyTemplates(input, this.modeName);
}
If input is a Node, this will processes all of the
children of that node. If input is a List of
Nodess, these nodes will be iterated and all children of
each node will be processed. |
public void applyTemplates(Object input,
XPath xpath) throws Exception {
applyTemplates(input, xpath, this.modeName);
}
Processes the result of the xpath expression. The xpath expression is
evaluated against the provided input object. |
public void applyTemplates(Object input,
XPath xpath) throws Exception {
applyTemplates(input, xpath, this.modeName);
} Deprecated! Use - Stylesheet#applyTemplates(Object, XPath) instead.
Processes the result of the xpath expression. The xpath expression is
evaluated against the provided input object. |
public void applyTemplates(Object input,
String mode) throws Exception {
Mode mod = ruleManager.getMode(mode);
if (input instanceof Element) {
// iterate through all children
Element element = (Element) input;
for (int i = 0, size = element.nodeCount(); i < size; i++) {
Node node = element.node(i);
mod.fireRule(node);
}
} else if (input instanceof Document) {
// iterate through all children
Document document = (Document) input;
for (int i = 0, size = document.nodeCount(); i < size; i++) {
Node node = document.node(i);
mod.fireRule(node);
}
} else if (input instanceof List) {
List list = (List) input;
for (int i = 0, size = list.size(); i < size; i++) {
Object object = list.get(i);
if (object instanceof Element) {
applyTemplates((Element) object, mode);
} else if (object instanceof Document) {
applyTemplates((Document) object, mode);
}
}
}
}
Processes the input object in the given mode. If input is a
Node, this will processes all of the children of that
node. If input is a List of Nodess, these
nodes will be iterated and all children of each node will be processed. |
public void applyTemplates(Object input,
XPath xpath,
String mode) throws Exception {
Mode mod = ruleManager.getMode(mode);
List list = xpath.selectNodes(input);
Iterator it = list.iterator();
while (it.hasNext()) {
Node current = (Node) it.next();
mod.fireRule(current);
}
}
Processes the result of the xpath expression in the given mode. The xpath
expression is evaluated against the provided input object. |
public void applyTemplates(Object input,
XPath xpath,
String mode) throws Exception {
Mode mod = ruleManager.getMode(mode);
List list = xpath.selectNodes(input);
Iterator it = list.iterator();
while (it.hasNext()) {
Node current = (Node) it.next();
mod.fireRule(current);
}
} Deprecated! Use - Stylesheet#applyTemplates(Object, XPath, String)
instead.
Processes the result of the xpath expression in the given mode. The xpath
expression is evaluated against the provided input object. |
public void clear() {
ruleManager.clear();
}
|
public String getModeName() {
return modeName;
}
|
public Action getValueOfAction() {
return ruleManager.getValueOfAction();
}
|
public void removeRule(Rule rule) {
ruleManager.removeRule(rule);
}
Removes the specified rule from this stylesheet. |
public void run(Object input) throws Exception {
run(input, this.modeName);
}
Runs this stylesheet on the given input which should be either a Node or
a List of Node objects. |
public void run(List list) throws Exception {
run(list, this.modeName);
}
|
public void run(Node node) throws Exception {
run(node, this.modeName);
}
|
public void run(Object input,
String mode) throws Exception {
if (input instanceof Node) {
run((Node) input, mode);
} else if (input instanceof List) {
run((List) input, mode);
}
}
|
public void run(List list,
String mode) throws Exception {
for (int i = 0, size = list.size(); i < size; i++) {
Object object = list.get(i);
if (object instanceof Node) {
run((Node) object, mode);
}
}
}
|
public void run(Node node,
String mode) throws Exception {
Mode mod = ruleManager.getMode(mode);
mod.fireRule(node);
}
|
public void setModeName(String modeName) {
this.modeName = modeName;
}
Sets the name of the mode that the stylesheet uses by default. |
public void setValueOfAction(Action valueOfAction) {
ruleManager.setValueOfAction(valueOfAction);
}
Sets the default value-of action which is used in the default rules for
the pattern "text()|@" |