Skip to content

Releases: yegor256/xembly

Fast implementation of root-only XPath

23 Oct 10:01
Compare
Choose a tag to compare

Fast implementation added for XPATH '/root' directives. Instead of using XPathFactory we're getting root node directly from DOM.

Performance boost

22 Oct 14:57
Compare
Choose a tag to compare

In this version performance of Xembler was boosted a bit.

Graceful handling of empty directives

13 Oct 11:31
Compare
Choose a tag to compare

In this version a small bug was fixed, which didn't allow to use empty input in Directives. Now it's possible, for example:

String xml = new Xembler(new Directives("")).xml("test");

will produce:

<?xml version="1.0" encoding="UTF-8"?>
<test/>

No special treatment of DOM root element

18 Oct 10:56
Compare
Choose a tag to compare

In this version a special treatment of DOM root element is removed. That means that:

  1. DOM is created without root element
  2. DOM transformation starts with an empty set of current nodes

For example, this code creates a new DOM with a root element orders:

String xml = new Xembler(
  new Directives()
    .add("orders")
    .add("order")
    .attr("id", "553")
    .set("$140.00")
).xml();

PI directive for adding processing instructions

11 Oct 19:16
Compare
Choose a tag to compare

With this new PI directive you can add processing instructions to the XML document. Besides that, in this release there are two supplementary methods that enable instance generation of XML. For example:

String xml = new Xembler(
  new Directives()
    .xpath("/")
    .pi("xml-stylesheet", "type='text/xsl' href='foo.xsl'")
    .xpath("/document")
    .add("title")
    .set("Hello, world!")
).xml("document");

Will produce:

<?xml version="1.0"?>
<?xml-stylesheet", "type='text/xsl' href='foo.xsl'"?>
<document>
<title>Hello, world!</title>
</document>

Directives#add(Map)

29 Sep 10:33
Compare
Choose a tag to compare

New method add(Map<K,V>) added to Directives class. The method allows you to add multiple XML nodes in one operation, for example:

new Directives().xpath("/root").add(
  new ArrayMap<String, Object>()
    .with("first", 1)
    .with("second", "two")
).add("third")

The XML produced will look like:

<root>
  <first>1</first>
  <second>two</second>
  <third/>
</root>

XSET directive

13 Sep 18:21
Compare
Choose a tag to compare

XSET directive was added to the language. It enables node content changing with a value retrieved in runtime by XPath expression. This directives turns Xembly into a powerful instrument, similar to XSLT. For example, you can increment XML node value:

ADDIF "price";
XPATH "//price";
XSET ". + 500";

The third directive will increment the price by 500.

All XPath 2.0 functions can be used in the expression.

Bug fix

05 Sep 12:03
Compare
Choose a tag to compare

As explained in #14, new Directive("invalid xembly script") was throwing RuntimeException instead of intended XemblySyntaxException. Fixed in this release.

Strict validation of XML content

05 Sep 11:25
Compare
Choose a tag to compare

Strict validation of XML content added in #13. Any text that violates the restrictions of XML validity (http://www.w3.org/TR/2004/REC-xml11-20040204/#charsets) causes internal XmlContentException that leads to other corresponding exceptions.

Stable Version

05 Sep 11:27
Compare
Choose a tag to compare

This is the most stable version released since the creation of the project. All directives work in unit tests, including:

  • ADD
  • ADDIF
  • SET
  • ATTR
  • XPATH
  • STRICT
  • UP

Unit tests cover almost the entire module. Enjoy :)