Skip to content

Commit

Permalink
webinar
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Aug 14, 2019
1 parent 9ac2a57 commit 1548b35
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -24,6 +24,7 @@ It is a much simplier alternative to
[XSLT](http://www.w3.org/TR/xslt) and [XQuery](http://www.w3.org/TR/xquery).
Read this blog post
for a more detailed explanation: [Xembly, an Assembly for XML](http://www.yegor256.com/2014/04/09/xembly-intro.html).
You may also want to watch [this webinar](https://www.youtube.com/watch?v=oNtTAF0UjjA).

You need this dependency:

Expand Down
27 changes: 20 additions & 7 deletions src/test/java/org/xembly/XemblerTest.java
Expand Up @@ -58,13 +58,26 @@ public final class XemblerTest {

@Test
public void test() throws Exception {
Directives dirs = new Directives(
StringUtils.join(
"ADD 'books'; ADD 'book'; CDATA 'hey';"
)
);
String xml = new Xembler(dirs).xml();
System.out.println(xml);


// '<books><book>Object Thinking</book><books>'

// create "books"
// add "book"
// change the content of "book" to "Object Thinking"

final Node node = new XMLDocument(
"<books><book>War and Peace</book></books>"
).node();
Directives dirs = new Directives()
.xpath("/books/book")
.strict(1)
.remove()
.add("book")
.set("Elegant Objects:\n\r$40.96")
.attr("id", 123);
new Xembler(dirs).apply(node);
System.out.println(new XMLDocument(node).toString());
}


Expand Down

0 comments on commit 1548b35

Please sign in to comment.