rdftemplate

Library for generating XML documents from RDF data using templates
git clone https://code.djc.id.au/git/rdftemplate/
commit 3fce2cf6bd6318ad5c0b9f07240fea89700c8e66
parent 06c1202e48e104311a72e31664a10e1f8e496878
Author: Dan Callaghan <djc@djc.id.au>
Date:   Sun, 17 Apr 2011 15:42:33 +1000

downgrade to Woodstox 3

Due to a bug with clearing the rdf: namespace declarations when there
are no other namespaces declared.

Diffstat:
Mpom.xml | 7++++---
Msrc/test/java/au/id/djc/rdftemplate/TemplateInterpolatorUnitTest.java | 10++++++++++
Asrc/test/resources/au/id/djc/rdftemplate/namespaces-no-others.xml | 4++++
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
@@ -158,11 +158,12 @@
             <version>1.2-SNAPSHOT</version>
             <optional>true</optional>
         </dependency>
+        <!-- JDK6 StAX implementation sucks, Woodstox 4 sucks, ... -->
         <dependency>
             <groupId>org.codehaus.woodstox</groupId>
-            <artifactId>woodstox-core-asl</artifactId>
-            <version>4.1.0</version>
-            <scope>runtime</scope> <!-- because JDK6 StAX impl is shit -->
+            <artifactId>wstx-asl</artifactId>
+            <version>3.2.9</version>
+            <scope>runtime</scope>
         </dependency>
     </dependencies>
     
diff --git a/src/test/java/au/id/djc/rdftemplate/TemplateInterpolatorUnitTest.java b/src/test/java/au/id/djc/rdftemplate/TemplateInterpolatorUnitTest.java
@@ -103,6 +103,16 @@ public class TemplateInterpolatorUnitTest {
         assertThat(result, not(containsString("rdf:")));
     }
     
+    // XXX this breaks with Woodstox 4, file a bug for it
+    @Test
+    public void should_strip_rdf_namespace_declarations_when_no_others() throws Exception {
+        Resource article = model.getResource("http://miskinhill.com.au/journals/test/1:1/article");
+        String result = templateInterpolator.interpolate(
+                new InputStreamReader(this.getClass().getResourceAsStream("namespaces-no-others.xml")), article);
+        assertThat(result, not(containsString("xmlns:")));
+        assertThat(result, not(containsString("rdf:")));
+    }
+    
     @Test
     public void forShouldIterateRdfSeqsInOrder() throws Exception {
         Resource article = model.getResource("http://miskinhill.com.au/journals/test/1:1/multi-author-article");
diff --git a/src/test/resources/au/id/djc/rdftemplate/namespaces-no-others.xml b/src/test/resources/au/id/djc/rdftemplate/namespaces-no-others.xml
@@ -0,0 +1,3 @@
+<record xmlns:rdf="http://code.miskinhill.com.au/rdftemplate/">
+<title rdf:content="dc:title#string-lv" />
+</record>
+\ No newline at end of file