From 1548b35ac1027a08bcec00f10e110170fe103653 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 14 Aug 2019 22:26:26 +0300 Subject: [PATCH] webinar --- README.md | 1 + src/test/java/org/xembly/XemblerTest.java | 27 +++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 687c7ff8..bbf1ce3a 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/src/test/java/org/xembly/XemblerTest.java b/src/test/java/org/xembly/XemblerTest.java index 3ea6312a..45aa82fc 100644 --- a/src/test/java/org/xembly/XemblerTest.java +++ b/src/test/java/org/xembly/XemblerTest.java @@ -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); + + + // 'Object Thinking' + + // create "books" + // add "book" + // change the content of "book" to "Object Thinking" + + final Node node = new XMLDocument( + "War and Peace" + ).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()); }