@Immutable @Loggable(value=1) public final class Xembler extends Object
For example, to modify a DOM document:
Document dom = DocumentBuilderFactory.newInstance()
.newDocumentBuilder().newDocument();
dom.appendChild(dom.createElement("root"));
new Xembler(
new Directives()
.xpath("/root")
.addIfAbsent("employees")
.add("employee")
.attr("id", 6564)
).apply(dom);
You can also convert your Xembly directives directly to XML document:
String xml = new Xembler(
new Directives()
.xpath("/root")
.addIfAbsent("employees")
.add("employee")
.attr("id", 6564)
).xml("root");| Constructor and Description |
|---|
Xembler(Iterable<Directive> dirs)
Public ctor.
|
@Loggable(value=1,
ignore=ImpossibleModificationException.class)
public Node apply(@NotNull(message="DOM can\'t be NULL")
Node dom)
throws ImpossibleModificationException
dom - DOM document/nodeImpossibleModificationException - If can't modify@Loggable(value=1,
ignore=ImpossibleModificationException.class)
public Document dom()
throws ImpossibleModificationException
ImpossibleModificationException - If can't modify@Loggable(value=1,
ignore=ImpossibleModificationException.class)
public String xml()
throws ImpossibleModificationException
ImpossibleModificationException - If can't modifyCopyright © 2013 Xembly. All rights reserved.