@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(Collection<Directive> dirs)
Public ctor.
|
public Xembler(@NotNull(message="collection of directives can\'t be NULL") Collection<Directive> dirs)
dirs
- Directives@Loggable(value=1, ignore=ImpossibleModificationException.class) public void apply(@NotNull(message="DOM can\'t be NULL") Document dom) throws ImpossibleModificationException
dom
- DOM documentImpossibleModificationException
- 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.