You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/20 14:40:59 UTC

[sling-org-apache-sling-jcr-contentparser] branch master created (now 88d22ad)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git.


      at 88d22ad  SLING-7185 Content Parser: Support for ISO-8601 (patch provided by Jason E Bailey) closes #261

This branch includes the following new commits:

     new b485a57  SLING-6592 move and rename to jcr/contentparser, change java package and class names accordingly
     new 3f0bcb3  SLING-6592 remove parse(File) method from API
     new 536aed4  SLING-6592 switch to Stream API for content parsing, remove content representation API
     new 63eb612  add readme
     new 0d2cf03  add osgi versioning annotations
     new b3236b5  [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.0.0
     new 26963f8  [maven-release-plugin] prepare for next development iteration
     new 1726a8b  change name to "Apache Sling JCR Content Parser"
     new a039853  clarified JCR_XML format description
     new c6e22e6  SLING-6827 JCR Content Parser: Ignore 'jcr:name:' and 'jcr:uri:' prefixes by default
     new 66e5b87  SLING-6827 add doc link
     new fd43643  SLING-6828 JCR Content Parser: Support XML Descriptor Files
     new 8458f89  fix javadoc errors
     new 8a4a0c2  [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.1.0
     new f2dfb1a  [maven-release-plugin] prepare for next development iteration
     new fc6be19  SLING-6872 JCR Content Parser: Support tick as well as double quote when parsing JSON
     new cb9a1e3  SLING-6872 small optimization: set initial stringbuilder capacity
     new 9c468aa  declare johnzon dependency as "test"
     new 753dfa4  SLING-6872 make JsonTicksConverter public to allow embedding
     new c7dc4e1  [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.2.0
     new 0ab468a  [maven-release-plugin] prepare for next development iteration
     new 977e6ca  SLING-6915 JCR Content Parser: Tick parsing fails when comment contains tick character
     new d4190a5  SLING-6916 JCR Content Parser: Tick parsing fails when string contains escaped escaped character
     new a7d0d2b  SLING-6919 JCR Content Parser: Do no enable JSON tick parsing by default
     new 5631ad9  [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.2.2
     new 89deb13  [maven-release-plugin] prepare for next development iteration
     new 4626e22  rollback releases
     new b6c94ef  [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.2.2
     new 23d1ff5  [maven-release-plugin] prepare for next development iteration
     new b082607  SLING-6960 JCR Content Parser: Ignore security:acl and security:principals nodes
     new 3fea4cc  [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.2.4
     new 9b20123  [maven-release-plugin] prepare for next development iteration
     new a023165  Remove unused collections dependency
     new 266dea2  SLING-7167 Adjust READMEs
     new 45a7fa6  SLING-7167 Adjust READMEs
     new e27bd34  SLING-7167 Adjust READMEs
     new 199bc84  set dependency scope for javax.json to provided because artifactId is different for newer version of the spec
     new 88d22ad  SLING-7185 Content Parser: Support for ISO-8601 (patch provided by Jason E Bailey) closes #261

The 38 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-org-apache-sling-jcr-contentparser] 13/38: fix javadoc errors

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 8458f8990f2f73c5f85917fca73d035191ef33a8
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu May 4 20:11:10 2017 +0000

    fix javadoc errors
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1793874 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/jcr/contentparser/ContentType.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
index a4d99c5..ab8f935 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
@@ -28,13 +28,13 @@ public enum ContentType {
 
     /**
      * JSON content descriptor file.
-     * @see https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#json-descriptor-files
+     * @see <a href="https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#json-descriptor-files">JCR ContentLoader JSON descriptor files</a>
      */
     JSON("json"),
 
     /**
      * XML content descriptor file.
-     * @see https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#xml-descriptor-files
+     * @see <a href="https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#xml-descriptor-files">JCR ContentLoader XML descriptor files</a>
      */
     XML("xml"),
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 37/38: set dependency scope for javax.json to provided because artifactId is different for newer version of the spec

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 199bc84a34f4d9290eb362eaf7bccf88f16867de
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Oct 10 15:40:43 2017 +0000

    set dependency scope for javax.json to provided because artifactId is different for newer version of the spec
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1811715 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 7cea52a..e7a5355 100644
--- a/pom.xml
+++ b/pom.xml
@@ -81,7 +81,7 @@
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-json_1.0_spec</artifactId>
             <version>1.0-alpha-1</version>
-            <scope>compile</scope>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>javax.jcr</groupId>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 23/38: SLING-6916 JCR Content Parser: Tick parsing fails when string contains escaped escaped character

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit d4190a5e1c2cfac49bf5625f2194c126922fdd75
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon May 29 15:24:44 2017 +0000

    SLING-6916 JCR Content Parser: Tick parsing fails when string contains escaped escaped character
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1796649 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java  | 3 +++
 .../apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java  | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
index 3d2cf9d..691873c 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
@@ -50,6 +50,9 @@ public final class JsonTicksConverter {
                     if (in != '\'') {
                         output.append("\\");
                     }
+                    if (in == '\\') {
+                        output.append("\\");
+                    }
                     escaped = false;
                 }
                 else {
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java
index dfec3a0..d8c373a 100644
--- a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java
@@ -69,4 +69,9 @@ public class JsonTicksConverterTest {
         assertEquals("{\"p\":\"\\u03A9\\u03A6\\u00A5\"}", tickToDoubleQuote("{'p':\"\\u03A9\\u03A6\\u00A5\"}"));
     }
 
+    @Test
+    public void testTickToQuoteWithDoubleBackslash() {
+        assertEquals("{\"p\":\"aa\\\\bb\"}", tickToDoubleQuote("{'p':\"aa\\\\bb\"}"));
+    }
+
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 17/38: SLING-6872 small optimization: set initial stringbuilder capacity

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit cb9a1e371f8377b26cad99681567dd18fd24cd04
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue May 23 21:36:01 2017 +0000

    SLING-6872 small optimization: set initial stringbuilder capacity
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1795970 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
index 6125599..9d5f6e0 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
@@ -32,11 +32,12 @@ package org.apache.sling.jcr.contentparser.impl;
 class JsonTicksConverter {
     
     static String tickToDoubleQuote(final String input) {
-        final StringBuilder output = new StringBuilder();
+        final int len = input.length();
+        final StringBuilder output = new StringBuilder(len);
         boolean quoted = false;
         boolean tickQuoted = false;
         boolean escaped = false;
-        for (int i = 0, len = input.length(); i < len; i++) {
+        for (int i = 0; i < len; i++) {
             char in = input.charAt(i);
             if (quoted || tickQuoted) {
                 if (escaped) {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 11/38: SLING-6827 add doc link

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 66e5b8780c80099c2fef989add91b2e87f9867b9
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed May 3 21:29:32 2017 +0000

    SLING-6827 add doc link
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1793722 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/jcr/contentparser/ContentType.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
index 7b0f875..21d7e14 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
@@ -27,7 +27,8 @@ import org.osgi.annotation.versioning.ProviderType;
 public enum ContentType {
 
     /**
-     * JSON content.
+     * JSON content descriptor file.
+     * @see https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#json-descriptor-files
      */
     JSON("json"),
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 03/38: SLING-6592 switch to Stream API for content parsing, remove content representation API

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 536aed4674ef83223fe8cbbb496b7498081ad75e
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Mar 17 20:59:21 2017 +0000

    SLING-6592 switch to Stream API for content parsing, remove content representation API
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1787499 13f79535-47bb-0310-9956-ffa450edef68
---
 .../{ContentParser.java => ContentHandler.java}    | 21 +++----
 .../sling/jcr/contentparser/ContentParser.java     |  9 ++-
 .../jcr/contentparser/ContentParserFactory.java    |  2 +-
 .../sling/jcr/contentparser/ContentType.java       |  2 +-
 .../sling/jcr/contentparser/ParserOptions.java     |  4 +-
 .../contentparser/impl/JcrXmlContentParser.java    | 67 ++++++++++++++-------
 .../jcr/contentparser/impl/JsonContentParser.java  | 44 ++++++++++----
 .../sling/jcr/contentparser/impl/ParserHelper.java | 13 +++-
 .../sling/jcr/contentparser/package-info.java      |  2 +-
 .../impl/JcrXmlContentParserTest.java              | 55 ++++++++++-------
 .../contentparser/impl/JsonContentParserTest.java  | 61 ++++++++++++-------
 .../sling/jcr/contentparser/impl/TestUtils.java    | 27 ++-------
 .../impl/mapsupport/ContentElement.java}           | 44 +++++++-------
 .../impl/mapsupport/ContentElementHandler.java     | 69 ++++++++++++++++++++++
 .../impl/mapsupport/ContentElementImpl.java        | 68 +++++++++++++++++++++
 15 files changed, 348 insertions(+), 140 deletions(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentHandler.java
similarity index 62%
copy from src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java
copy to src/main/java/org/apache/sling/jcr/contentparser/ContentHandler.java
index 1d9595a..7582338 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentHandler.java
@@ -18,23 +18,20 @@
  */
 package org.apache.sling.jcr.contentparser;
 
-import java.io.IOException;
-import java.io.InputStream;
 import java.util.Map;
 
 /**
- * Parses repository content from a file.
- * Implementations have to be thread-safe.
+ * Handler that gets notified while parsing content with {@link ContentParser}.
+ * The resources are always reported in order of their paths as found in the content fragment.
+ * Parents are always reported before their children.
  */
-public interface ContentParser {
+public interface ContentHandler {
 
     /**
-     * Parse content.
-     * @param is Stream with serialized content
-     * @return Content as Map
-     * @throws IOException When I/O error occurs.
-     * @throws ParseException When parsing error occurs.
+     * Resource found in parsed content.
+     * @param path Path of resource inside the content fragment. The root resource from the content fragment has a path "/".
+     * @param properties Resource properties
      */
-    Map<String,Object> parse(InputStream is) throws IOException, ParseException;
-
+    void resource(String path, Map<String,Object> properties);
+    
 }
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java
index 1d9595a..fa6877d 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java
@@ -20,7 +20,6 @@ package org.apache.sling.jcr.contentparser;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Map;
 
 /**
  * Parses repository content from a file.
@@ -29,12 +28,12 @@ import java.util.Map;
 public interface ContentParser {
 
     /**
-     * Parse content.
-     * @param is Stream with serialized content
-     * @return Content as Map
+     * Parse content in a "stream-based" way. Each resource that is found in the content is reported to the contentHandler.
+     * @param contentHandler Content handler that accepts the parsed content.
+     * @param inputStream Stream with serialized content
      * @throws IOException When I/O error occurs.
      * @throws ParseException When parsing error occurs.
      */
-    Map<String,Object> parse(InputStream is) throws IOException, ParseException;
+    void parse(ContentHandler contentHandler, InputStream inputStream) throws IOException, ParseException;
 
 }
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java
index 7ae64e2..7357ec5 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java
@@ -22,7 +22,7 @@ import org.apache.sling.jcr.contentparser.impl.JcrXmlContentParser;
 import org.apache.sling.jcr.contentparser.impl.JsonContentParser;
 
 /**
- * Factory for content file parsers.
+ * Factory for content parsers.
  */
 public final class ContentParserFactory {
 
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
index 167722f..acba05d 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
@@ -29,7 +29,7 @@ public enum ContentType {
     JSON("json"),
 
     /**
-     * JCR XML content.
+     * JCR XML content (FileVault XML).
      */
     JCR_XML("jcr.xml");
 
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java b/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
index 0911dac..4dba088 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
@@ -24,7 +24,7 @@ import java.util.HashSet;
 import java.util.Set;
 
 /**
- * Options for content filer parser.
+ * Options for content parser.
  */
 public final class ParserOptions {
     
@@ -60,7 +60,7 @@ public final class ParserOptions {
     }
 
     /**
-     * Some content file formats like JSON do not contain information to identify date/time values.
+     * Some content formats like JSON do not contain information to identify date/time values.
      * Instead they have to be detected by heuristics by trying to parse every string value.
      * This mode is disabled by default.
      * @param value Activate calendar value detection
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParser.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParser.java
index 2af30e7..9b9486c 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParser.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParser.java
@@ -20,16 +20,20 @@ package org.apache.sling.jcr.contentparser.impl;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayDeque;
+import java.util.Deque;
 import java.util.HashMap;
-import java.util.LinkedHashMap;
+import java.util.HashSet;
 import java.util.Map;
-import java.util.Stack;
+import java.util.Set;
 
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.jackrabbit.util.ISO9075;
+import org.apache.sling.jcr.contentparser.ContentHandler;
 import org.apache.sling.jcr.contentparser.ContentParser;
 import org.apache.sling.jcr.contentparser.ParseException;
 import org.apache.sling.jcr.contentparser.ParserOptions;
@@ -54,15 +58,14 @@ public final class JcrXmlContentParser implements ContentParser {
     }
     
     @Override
-    public Map<String,Object> parse(InputStream is) throws IOException, ParseException {
+    public void parse(ContentHandler handler, InputStream is) throws IOException, ParseException {
         try {
-            XmlHandler xmlHandler = new XmlHandler();
+            XmlHandler xmlHandler = new XmlHandler(handler);
             SAXParser parser = saxParserFactory.newSAXParser();
             parser.parse(is, xmlHandler);
             if (xmlHandler.hasError()) {
                 throw xmlHandler.getError();
             }
-            return xmlHandler.getContent();
         }
         catch (ParserConfigurationException | SAXException ex) {
             throw new ParseException("Error parsing JCR XML content.", ex);
@@ -82,12 +85,13 @@ public final class JcrXmlContentParser implements ContentParser {
      * Parses XML stream to Map.
      */
     class XmlHandler extends DefaultHandler {
-        private final Map<String,Object> content = new LinkedHashMap<>();
-        private final Stack<Map<String,Object>> elements = new Stack<>();
+        private final ContentHandler contentHandler;
+        private final Deque<String> paths = new ArrayDeque<>();
+        private final Set<String> ignoredPaths = new HashSet<>();
         private SAXParseException error;
         
-        public Map<String,Object> getContent() {
-            return content;
+        public XmlHandler(ContentHandler contentHandler) {
+            this.contentHandler = contentHandler;
         }
         
         public boolean hasError() {
@@ -102,36 +106,55 @@ public final class JcrXmlContentParser implements ContentParser {
         public void startElement(String uri, String localName, String qName, Attributes attributes)
                 throws SAXException {
             
-            // prepare map for element
-            Map<String,Object> element;
-            if (elements.isEmpty()) {
-                element = content;
+            String resourceName = decodeName(qName);
+
+            // generate path for element
+            String path;
+            if (paths.isEmpty()) {
+                path = "/";
             }
             else {
-                element = new HashMap<>();
-                String resourceName = decodeName(qName);
-                if (!helper.ignoreResource(resourceName)) {
-                    elements.peek().put(resourceName, element);
+                path = helper.concatenatePath(paths.peek(), resourceName);
+                if (helper.ignoreResource(resourceName)) {
+                    ignoredPaths.add(path);
                 }
             }
-            elements.push(element);
+            paths.push(path);
+            
+            // skip further processing if this path or a parent path is ignored
+            if (isIgnoredPath(path)) {
+                return;
+            }
             
-            // get attributes
+            // get properties
+            Map<String,Object> properties = new HashMap<>();
             for (int i=0; i<attributes.getLength(); i++) {
                 String propertyName = helper.cleanupPropertyName(decodeName(attributes.getQName(i)));
                 if (!helper.ignoreProperty(propertyName)) {
                     Object value = JcrXmlValueConverter.parseValue(propertyName, attributes.getValue(i));
                     if (value != null) {
-                        element.put(propertyName, value);
+                        properties.put(propertyName, value);
                     }
                 }
             }
+            helper.ensureDefaultPrimaryType(properties);
+            contentHandler.resource(path, properties);
+        }
+        
+        private boolean isIgnoredPath(String path) {
+            if (StringUtils.isEmpty(path)) {
+                return false;
+            }
+            if (ignoredPaths.contains(path)) {
+                return true;
+            }
+            String parentPath = StringUtils.substringBeforeLast(path, "/");
+            return isIgnoredPath(parentPath);
         }
 
         @Override
         public void endElement(String uri, String localName, String qName) throws SAXException {
-            Map<String,Object> element = elements.pop();
-            helper.ensureDefaultPrimaryType(element);
+            paths.pop();
         }
 
         @Override
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java
index a17e91e..093fbec 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java
@@ -35,6 +35,7 @@ import javax.json.JsonString;
 import javax.json.JsonValue;
 import javax.json.stream.JsonParsingException;
 
+import org.apache.sling.jcr.contentparser.ContentHandler;
 import org.apache.sling.jcr.contentparser.ContentParser;
 import org.apache.sling.jcr.contentparser.ParseException;
 import org.apache.sling.jcr.contentparser.ParserOptions;
@@ -45,7 +46,12 @@ import org.apache.sling.jcr.contentparser.ParserOptions;
  */
 public final class JsonContentParser implements ContentParser {
     
-    private final ParserHelper helper;    
+    private final ParserHelper helper;
+    /*
+     * Implementation note: This parser uses JsonReader instead of the (more memory-efficient) 
+     * JsonParser Stream API because otherwise it would not be possible to report parent resources
+     * including all properties properly before their children.
+     */
     private final JsonReaderFactory jsonReaderFactory;
     
     public JsonContentParser(ParserOptions options) {
@@ -57,22 +63,25 @@ public final class JsonContentParser implements ContentParser {
     }
     
     @Override
-    public Map<String,Object> parse(InputStream is) throws IOException, ParseException {
+    public void parse(ContentHandler handler, InputStream is) throws IOException, ParseException {
         try (JsonReader reader = jsonReaderFactory.createReader(is)) {
-            return toMap(reader.readObject());
+            parse(handler, reader.readObject(), "/");
         }
         catch (JsonParsingException ex) {
             throw new ParseException("Error parsing JSON content.", ex);
         }
     }
-    
-    private Map<String,Object> toMap(JsonObject object) {
-        Map<String,Object> map = new LinkedHashMap<>();
+
+    private void parse(ContentHandler handler, JsonObject object, String path) {
+        // parse JSON object
+        Map<String,Object> properties = new HashMap<>();
+        Map<String,JsonObject> children = new LinkedHashMap<>();
         for (Map.Entry<String, JsonValue> entry : object.entrySet()) {
             String childName = entry.getKey();
             Object value = convertValue(entry.getValue());
+            boolean isResource = (value instanceof JsonObject);
             boolean ignore = false;
-            if (value instanceof Map) {
+            if (isResource) {
                 ignore = helper.ignoreResource(childName);
             }
             else {
@@ -80,11 +89,24 @@ public final class JsonContentParser implements ContentParser {
                 ignore = helper.ignoreProperty(childName);
             }
             if (!ignore) {
-                map.put(childName, value);
+                if (isResource) {
+                    children.put(childName, (JsonObject)value);
+                }
+                else {
+                    properties.put(childName, value);
+                }
             }
         }
-        helper.ensureDefaultPrimaryType(map);
-        return map;
+        helper.ensureDefaultPrimaryType(properties);
+        
+        // report current JSON object
+        handler.resource(path, properties);
+        
+        // parse and report children
+        for (Map.Entry<String,JsonObject> entry : children.entrySet()) {
+            String childPath = helper.concatenatePath(path, entry.getKey());;
+            parse(handler, entry.getValue(), childPath);
+        }
     }
     
     private Object convertValue(JsonValue value) {
@@ -120,7 +142,7 @@ public final class JsonContentParser implements ContentParser {
                 }
                 return helper.convertSingleTypeArray(values);
             case OBJECT:
-                return toMap((JsonObject)value);
+                return (JsonObject)value;
             default:
                 throw new ParseException("Unexpected JSON value type: " + value.getValueType());
         }
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/ParserHelper.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/ParserHelper.java
index 160cd0e..69b0f48 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/impl/ParserHelper.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/ParserHelper.java
@@ -27,6 +27,8 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
+import javax.json.JsonObject;
+
 import org.apache.commons.lang3.StringUtils;
 import org.apache.sling.jcr.contentparser.ParseException;
 import org.apache.sling.jcr.contentparser.ParserOptions;
@@ -113,7 +115,7 @@ class ParserHelper {
             if (value == null) {
                 throw new ParseException("Multivalue array must not contain null values.");
             }
-            if (value instanceof Map) {
+            if (value instanceof Map || value instanceof JsonObject) {
                 throw new ParseException("Multivalue array must not contain maps/objects.");
             }
             if (itemType == null) {
@@ -131,4 +133,13 @@ class ParserHelper {
         return convertedArray;
     }
     
+    public String concatenatePath(String parentPath, String name) {
+        if (StringUtils.endsWith(parentPath, "/")) {
+            return parentPath + name;
+        }
+        else {
+            return parentPath + "/" + name;
+        }
+    }
+    
 }
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/package-info.java b/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
index 21b7f41..1b6b2a8 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * Parser for repository content stored in files (e.g. JSON, JCR XML).
+ * Parser for repository content serialized e.g. as JSON or JCR XML.
  */
 @org.osgi.annotation.versioning.Version("1.0.0")
 package org.apache.sling.jcr.contentparser;
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParserTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParserTest.java
index 1faaf4e..99eca51 100644
--- a/src/test/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParserTest.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParserTest.java
@@ -18,7 +18,6 @@
  */
 package org.apache.sling.jcr.contentparser.impl;
 
-import static org.apache.sling.jcr.contentparser.impl.TestUtils.getDeep;
 import static org.apache.sling.jcr.contentparser.impl.TestUtils.parse;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
@@ -37,8 +36,8 @@ import org.apache.sling.jcr.contentparser.ContentParserFactory;
 import org.apache.sling.jcr.contentparser.ContentType;
 import org.apache.sling.jcr.contentparser.ParseException;
 import org.apache.sling.jcr.contentparser.ParserOptions;
+import org.apache.sling.jcr.contentparser.impl.mapsupport.ContentElement;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import com.google.common.collect.ImmutableSet;
@@ -52,14 +51,13 @@ public class JcrXmlContentParserTest {
         file = new File("src/test/resources/content-test/content.jcr.xml");
     }
 
-    @SuppressWarnings("unchecked")
     @Test
     public void testParseJcrXml() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML);
-        Map<String,Object> content = parse(underTest, file);
+        ContentElement content = parse(underTest, file);
         assertNotNull(content);
-        assertEquals("app:Page", content.get("jcr:primaryType"));
-        assertEquals("app:PageContent", ((Map<String,Object>)content.get("jcr:content")).get("jcr:primaryType"));
+        assertEquals("app:Page", content.getProperties().get("jcr:primaryType"));
+        assertEquals("app:PageContent", content.getChild("jcr:content").getProperties().get("jcr:primaryType"));
     }
 
     @Test(expected=ParseException.class)
@@ -72,8 +70,8 @@ public class JcrXmlContentParserTest {
     @Test
     public void testDataTypes() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML);
-        Map<String,Object> content = parse(underTest, file);
-        Map<String,Object> props = getDeep(content, "jcr:content");
+        ContentElement content = parse(underTest, file);
+        Map<String,Object> props = content.getChild("jcr:content").getProperties();
         
         assertEquals("en", props.get("jcr:title"));
         assertEquals(true, props.get("includeAside"));
@@ -105,26 +103,43 @@ public class JcrXmlContentParserTest {
         ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML, new ParserOptions()
                 .ignoreResourceNames(ImmutableSet.of("teaserbar", "aside"))
                 .ignorePropertyNames(ImmutableSet.of("longProp", "jcr:title")));
-        Map<String,Object> content = parse(underTest, file);
-        Map<String,Object> props = getDeep(content, "jcr:content");
+        ContentElement content = parse(underTest, file);
+        ContentElement child = content.getChild("jcr:content");
         
-        assertEquals("HOME", props.get("navTitle"));
-        assertNull(props.get("jcr:title"));
-        assertNull(props.get("longProp"));
+        assertEquals("HOME", child.getProperties().get("navTitle"));
+        assertNull(child.getProperties().get("jcr:title"));
+        assertNull(child.getProperties().get("longProp"));
         
-        assertNull(props.get("teaserbar"));
-        assertNull(props.get("aside"));
-        assertNotNull(props.get("content"));
+        assertNull(child.getChildren().get("teaserbar"));
+        assertNull(child.getChildren().get("aside"));
+        assertNotNull(child.getChildren().get("content"));
+    }
+
+    @Test
+    public void testGetChild() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML);
+        ContentElement content = parse(underTest, file);
+        assertNull(content.getName());
+        
+        ContentElement deepChild = content.getChild("jcr:content/teaserbar/teaserbaritem");
+        assertEquals("teaserbaritem", deepChild.getName());
+        assertEquals("samples/sample-app/components/content/teaserbar/teaserbarItem", deepChild.getProperties().get("sling:resourceType"));
+
+        ContentElement invalidChild = content.getChild("non/existing/path");
+        assertNull(invalidChild);
+
+        invalidChild = content.getChild("/jcr:content");
+        assertNull(invalidChild);
     }
 
     @Test
-    @Ignore
     public void testSameNamePropertyAndSubResource() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML);
-        Map<String,Object> content = parse(underTest, file);
-        Map<String,Object> props = getDeep(content, "jcr:content/teaserbar");
+        ContentElement content = parse(underTest, file);
+        ContentElement child = content.getChild("jcr:content/teaserbar");
         // teaserbaritem is a direct property as well as a sub resource
-        assertEquals("test", props.get("teaserbaritem"));
+        assertEquals("test", child.getProperties().get("teaserbaritem"));
+        assertNotNull(child.getChildren().get("teaserbaritem"));
     }
 
 }
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
index 3aa9531..706cb6e 100644
--- a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
@@ -18,7 +18,6 @@
  */
 package org.apache.sling.jcr.contentparser.impl;
 
-import static org.apache.sling.jcr.contentparser.impl.TestUtils.getDeep;
 import static org.apache.sling.jcr.contentparser.impl.TestUtils.parse;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
@@ -36,6 +35,7 @@ import org.apache.sling.jcr.contentparser.ContentParserFactory;
 import org.apache.sling.jcr.contentparser.ContentType;
 import org.apache.sling.jcr.contentparser.ParseException;
 import org.apache.sling.jcr.contentparser.ParserOptions;
+import org.apache.sling.jcr.contentparser.impl.mapsupport.ContentElement;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -53,17 +53,17 @@ public class JsonContentParserTest {
     @Test
     public void testPageJcrPrimaryType() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
-        Map<String, Object> content = parse(underTest, file);
+        ContentElement content = parse(underTest, file);
 
-        assertEquals("app:Page", content.get("jcr:primaryType"));
+        assertEquals("app:Page", content.getProperties().get("jcr:primaryType"));
     }
 
     @Test
     public void testDataTypes() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
-        Map<String, Object> content = parse(underTest, file);
+        ContentElement content = parse(underTest, file);
 
-        Map<String, Object> props = getDeep(content, "toolbar/profiles/jcr:content");
+        Map<String, Object> props = content.getChild("toolbar/profiles/jcr:content").getProperties();
         assertEquals(true, props.get("hideInNav"));
 
         assertEquals(1234567890123L, props.get("longProp"));
@@ -78,9 +78,9 @@ public class JsonContentParserTest {
     @Test
     public void testContentProperties() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
-        Map<String, Object> content = parse(underTest, file);
+        ContentElement content = parse(underTest, file);
 
-        Map<String, Object> props = getDeep(content, "jcr:content/header");
+        Map<String, Object> props = content.getChild("jcr:content/header").getProperties();
         assertEquals("/content/dam/sample/header.png", props.get("imageReference"));
     }
 
@@ -88,9 +88,9 @@ public class JsonContentParserTest {
     public void testCalendar() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON,
                 new ParserOptions().detectCalendarValues(true));
-        Map<String, Object> content = parse(underTest, file);
+        ContentElement content = parse(underTest, file);
 
-        Map<String, Object> props = getDeep(content, "jcr:content");
+        Map<String, Object> props = content.getChild("jcr:content").getProperties();
 
         Calendar calendar = (Calendar) props.get("app:lastModified");
         assertNotNull(calendar);
@@ -109,9 +109,9 @@ public class JsonContentParserTest {
     @Test
     public void testUTF8Chars() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
-        Map<String, Object> content = parse(underTest, file);
+        ContentElement content = parse(underTest, file);
 
-        Map<String, Object> props = getDeep(content, "jcr:content");
+        Map<String, Object> props = content.getChild("jcr:content").getProperties();
 
         assertEquals("äöü߀", props.get("utf8Property"));
     }
@@ -120,7 +120,7 @@ public class JsonContentParserTest {
     public void testParseInvalidJson() throws Exception {
         file = new File("src/test/resources/invalid-test/invalid.json");
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
-        Map<String, Object> content = parse(underTest, file);
+        ContentElement content = parse(underTest, file);
         assertNull(content);
     }
 
@@ -128,7 +128,7 @@ public class JsonContentParserTest {
     public void testParseInvalidJsonWithObjectList() throws Exception {
         file = new File("src/test/resources/invalid-test/contentWithObjectList.json");
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
-        Map<String, Object> content = parse(underTest, file);
+        ContentElement content = parse(underTest, file);
         assertNull(content);
     }
 
@@ -137,18 +137,35 @@ public class JsonContentParserTest {
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON,
                 new ParserOptions().ignoreResourceNames(ImmutableSet.of("header", "newslist"))
                         .ignorePropertyNames(ImmutableSet.of("jcr:title")));
-        Map<String, Object> content = parse(underTest, file);
-        Map<String, Object> props = getDeep(content, "jcr:content");
+        ContentElement content = parse(underTest, file);
+        ContentElement child = content.getChild("jcr:content");
 
-        assertEquals("Sample Homepage", props.get("pageTitle"));
-        assertNull(props.get("jcr:title"));
+        assertEquals("Sample Homepage", child.getProperties().get("pageTitle"));
+        assertNull(child.getProperties().get("jcr:title"));
 
-        assertNull(props.get("header"));
-        assertNull(props.get("newslist"));
-        assertNotNull(props.get("lead"));
+        assertNull(child.getChildren().get("header"));
+        assertNull(child.getChildren().get("newslist"));
+        assertNotNull(child.getChildren().get("lead"));
 
-        assertEquals("abc", props.get("refpro1"));
-        assertEquals("def", props.get("pathprop1"));
+        assertEquals("abc", child.getProperties().get("refpro1"));
+        assertEquals("def", child.getProperties().get("pathprop1"));
+    }
+
+    @Test
+    public void testGetChild() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
+        ContentElement content = parse(underTest, file);
+        assertNull(content.getName());
+        
+        ContentElement deepChild = content.getChild("jcr:content/par/image/file/jcr:content");
+        assertEquals("jcr:content", deepChild.getName());
+        assertEquals("nt:resource", deepChild.getProperties().get("jcr:primaryType"));
+
+        ContentElement invalidChild = content.getChild("non/existing/path");
+        assertNull(invalidChild);
+
+        invalidChild = content.getChild("/jcr:content");
+        assertNull(invalidChild);
     }
 
 }
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java
index f91c5ee..be395b9 100644
--- a/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java
@@ -22,10 +22,10 @@ import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
-import java.util.Map;
 
-import org.apache.commons.lang3.StringUtils;
 import org.apache.sling.jcr.contentparser.ContentParser;
+import org.apache.sling.jcr.contentparser.impl.mapsupport.ContentElement;
+import org.apache.sling.jcr.contentparser.impl.mapsupport.ContentElementHandler;
 
 public final class TestUtils {
     
@@ -33,27 +33,12 @@ public final class TestUtils {
         // static methods only
     }
 
-    @SuppressWarnings("unchecked")
-    public static Map<String, Object> getDeep(Map<String, Object> map, String path) {
-      String name = StringUtils.substringBefore(path, "/");
-      Object object = map.get(name);
-      if (object == null || !(object instanceof Map)) {
-        return null;
-      }
-      String remainingPath = StringUtils.substringAfter(path, "/");
-      Map<String, Object> childMap = (Map<String, Object>)object;
-      if (StringUtils.isEmpty(remainingPath)) {
-        return childMap;
-      }
-      else {
-        return getDeep(childMap, remainingPath);
-      }
-    }
-    
-    public static Map<String,Object> parse(ContentParser contentParser, File file) throws IOException {
+    public static ContentElement parse(ContentParser contentParser, File file) throws IOException {
         try (FileInputStream fis = new FileInputStream(file);
                 BufferedInputStream bis = new BufferedInputStream(fis)) {
-            return contentParser.parse(bis);
+            ContentElementHandler handler = new ContentElementHandler();
+            contentParser.parse(handler, bis);
+            return handler.getRoot();
         }
     }
     
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/mapsupport/ContentElement.java
similarity index 50%
copy from src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
copy to src/test/java/org/apache/sling/jcr/contentparser/impl/mapsupport/ContentElement.java
index 167722f..6584487 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/mapsupport/ContentElement.java
@@ -16,35 +16,37 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.jcr.contentparser;
+package org.apache.sling.jcr.contentparser.impl.mapsupport;
+
+import java.util.Map;
 
 /**
- * Content types.
+ * Represents a resource or node in the content hierarchy.
  */
-public enum ContentType {
+public interface ContentElement {
 
     /**
-     * JSON content.
+     * @return Resource name. The root resource has no name (null).
      */
-    JSON("json"),
-
+    String getName();
+    
     /**
-     * JCR XML content.
+     * Properties of this resource.
+     * @return Properties (keys, values)
      */
-    JCR_XML("jcr.xml");
-
-
-    private final String extension;
-
-    private ContentType(String extension) {
-        this.extension = extension;
-    }
-
+    Map<String, Object> getProperties();
+    
     /**
-     * @return Extension
+     * Get children of current resource. The Map preserves the ordering of children.
+     * @return Children (child names, child objects)
      */
-    public String getExtension() {
-        return extension;
-    }
-
+    Map<String, ContentElement> getChildren();
+    
+    /**
+     * Get child or descendant
+     * @param path Relative path to address child or one of it's descendants (use "/" as hierarchy separator).
+     * @return Child or null if no child found with this path
+     */
+    ContentElement getChild(String path);
+    
 }
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/mapsupport/ContentElementHandler.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/mapsupport/ContentElementHandler.java
new file mode 100644
index 0000000..190adad
--- /dev/null
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/mapsupport/ContentElementHandler.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl.mapsupport;
+
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.sling.jcr.contentparser.ContentHandler;
+
+/**
+ * {@link ContentHandler} implementation that produces a tree of {@link ContentElement} items.
+ */
+public class ContentElementHandler implements ContentHandler {
+    
+    private ContentElement root;
+    private Pattern PATH_PATTERN = Pattern.compile("^((/[^/]+)*)(/([^/]+))$"); 
+
+    @Override
+    public void resource(String path, Map<String, Object> properties) {
+        if (StringUtils.equals(path, "/")) {
+            root = new ContentElementImpl(null, properties);
+        }
+        else {
+            if (root == null) {
+                throw new RuntimeException("Root resource not set.");
+            }
+            Matcher matcher = PATH_PATTERN.matcher(path);
+            if (!matcher.matches()) {
+                throw new RuntimeException("Unexpected path:" + path);
+            }
+            String relativeParentPath = StringUtils.stripStart(matcher.group(1), "/");
+            String name = matcher.group(4);
+            ContentElement parent;
+            if (StringUtils.isEmpty(relativeParentPath)) {
+                parent = root;
+            }
+            else {
+                parent = root.getChild(relativeParentPath);
+            }
+            if (parent == null) {
+                throw new RuntimeException("Parent '" + relativeParentPath + "' does not exist.");
+            }
+            parent.getChildren().put(name, new ContentElementImpl(name, properties));
+        }
+    }
+    
+    public ContentElement getRoot() {
+        return root;
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/mapsupport/ContentElementImpl.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/mapsupport/ContentElementImpl.java
new file mode 100644
index 0000000..3956c98
--- /dev/null
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/mapsupport/ContentElementImpl.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl.mapsupport;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+final class ContentElementImpl implements ContentElement {
+    
+    private final String name;
+    private final Map<String, Object> properties;
+    private final Map<String, ContentElement> children = new LinkedHashMap<>();
+    
+    public ContentElementImpl(String name, Map<String, Object> properties) {
+        this.name = name;
+        this.properties = properties;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public Map<String, Object> getProperties() {
+        return properties;
+    }
+
+    @Override
+    public Map<String, ContentElement> getChildren() {
+        return children;
+    }
+
+    @Override
+    public ContentElement getChild(String path) {
+        String name = StringUtils.substringBefore(path, "/");
+        ContentElement child = children.get(name);
+        if (child == null) {
+          return null;
+        }
+        String remainingPath = StringUtils.substringAfter(path, "/");
+        if (StringUtils.isEmpty(remainingPath)) {
+          return child;
+        }
+        else {
+          return child.getChild(remainingPath);
+        }
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 32/38: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 9b20123a44c986a5b447d14791e9550a5f4440c5
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Jun 23 13:45:44 2017 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1799664 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 542c426..bae19ce 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.jcr.contentparser</artifactId>
     <packaging>bundle</packaging>
-    <version>1.2.4</version>
+    <version>1.2.5-SNAPSHOT</version>
 
     <name>Apache Sling JCR Content Parser</name>
     <description>
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.4</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.4</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.jcr.contentparser-1.2.4</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentparser</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 20/38: [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.2.0

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit c7dc4e1a53d418582b3a7c5435a4ffe06c112847
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed May 24 08:48:14 2017 +0000

    [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.2.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1796012 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 6f2cb49..c3c5584 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.jcr.contentparser</artifactId>
     <packaging>bundle</packaging>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>1.2.0</version>
 
     <name>Apache Sling JCR Content Parser</name>
     <description>
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentparser</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.0</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.0</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.jcr.contentparser-1.2.0</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 24/38: SLING-6919 JCR Content Parser: Do no enable JSON tick parsing by default

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit a7d0d2b4ed5e3be61e560cd8d3b5b83c17617e4f
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon May 29 19:10:01 2017 +0000

    SLING-6919 JCR Content Parser: Do no enable JSON tick parsing by default
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1796676 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java b/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
index f878745..d3e87fa 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
@@ -52,7 +52,7 @@ public final class ParserOptions {
      * List of JSON parser features activated by default.
      */
     public static final EnumSet<JsonParserFeature> DEFAULT_JSON_PARSER_FEATURES
-        = EnumSet.of(JsonParserFeature.COMMENTS, JsonParserFeature.QUOTE_TICK);
+        = EnumSet.of(JsonParserFeature.COMMENTS);
     
     private String defaultPrimaryType = DEFAULT_PRIMARY_TYPE;
     private boolean detectCalendarValues;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 28/38: [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.2.2

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit b6c94ef86a3b43b8a3c0829081cda5130f7e4a9a
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue May 30 08:11:31 2017 +0000

    [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.2.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1796772 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 601a3ed..68d43b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.jcr.contentparser</artifactId>
     <packaging>bundle</packaging>
-    <version>1.2.1-SNAPSHOT</version>
+    <version>1.2.2</version>
 
     <name>Apache Sling JCR Content Parser</name>
     <description>
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentparser</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.2</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.2</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.jcr.contentparser-1.2.2</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 09/38: clarified JCR_XML format description

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit a039853f9eaaab110b50537049d60d4ebda95ca1
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Fri Mar 24 11:02:17 2017 +0000

    clarified JCR_XML format description
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1788406 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/jcr/contentparser/ContentType.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
index 41665ee..7b0f875 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
@@ -32,7 +32,11 @@ public enum ContentType {
     JSON("json"),
 
     /**
-     * JCR XML content (FileVault XML).
+     * JCR XML content (FileVault XML). Also known as extended document view XML.
+     * Extends the regular document view as specified by JCR 2.0 by specifics like
+     * multivalue and typing information. Is used by Jackrabbit FileVault.
+     * @see <a href="https://docs.adobe.com/content/docs/en/spec/jcr/2.0/7_Export.html#7.3%20Document%20View">JCR 2.0, 7.3 Document View</a>
+     * @see <a href="http://jackrabbit.apache.org/filevault/">Jackrabbit FileVault</a>
      */
     JCR_XML("jcr.xml");
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 10/38: SLING-6827 JCR Content Parser: Ignore 'jcr:name:' and 'jcr:uri:' prefixes by default

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit c6e22e648303445244b5e647ed87babf5ec7e281
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed May 3 21:28:36 2017 +0000

    SLING-6827 JCR Content Parser: Ignore 'jcr:name:' and 'jcr:uri:' prefixes by default
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1793721 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/jcr/contentparser/ParserOptions.java     | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java b/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
index 4fe6192..e8c3939 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
@@ -40,7 +40,12 @@ public final class ParserOptions {
      * Default list of prefixes to remove from property names.
      */
     public static final Set<String> DEFAULT_REMOVE_PROPERTY_NAME_PREFIXES
-            = Collections.unmodifiableSet(new HashSet<>(Arrays.asList("jcr:reference:", "jcr:path:")));
+        = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
+            "jcr:reference:",
+            "jcr:path:",
+            "jcr:name:",
+            "jcr:uri:"
+          )));
     
     private String defaultPrimaryType = DEFAULT_PRIMARY_TYPE;
     private boolean detectCalendarValues;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 26/38: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 89deb13fbbf9c094de832d938ddfcbb1410446e2
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue May 30 07:38:41 2017 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1796743 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 68d43b0..7283c66 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.jcr.contentparser</artifactId>
     <packaging>bundle</packaging>
-    <version>1.2.2</version>
+    <version>1.2.3-SNAPSHOT</version>
 
     <name>Apache Sling JCR Content Parser</name>
     <description>
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.2</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.2</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.jcr.contentparser-1.2.2</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentparser</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 15/38: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit f2dfb1a88bea708c9b18b89e738bd0045e7477a4
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu May 4 20:12:37 2017 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1793877 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index a84cb33..e889134 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.jcr.contentparser</artifactId>
     <packaging>bundle</packaging>
-    <version>1.1.0</version>
+    <version>1.1.1-SNAPSHOT</version>
 
     <name>Apache Sling JCR Content Parser</name>
     <description>
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.1.0</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.1.0</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.jcr.contentparser-1.1.0</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentparser</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 38/38: SLING-7185 Content Parser: Support for ISO-8601 (patch provided by Jason E Bailey) closes #261

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 88d22ad558f847a73c9ff7628afeb722c3d45c7b
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed Oct 18 12:24:39 2017 +0000

    SLING-7185 Content Parser: Support for ISO-8601 (patch provided by Jason E Bailey)
    closes #261
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1812502 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/jcr/contentparser/impl/ParserHelper.java | 20 +++++++++++++-------
 .../contentparser/impl/JsonContentParserTest.java  | 22 ++++++++++++++++++++++
 2 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/ParserHelper.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/ParserHelper.java
index 69b0f48..0ac3022 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/impl/ParserHelper.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/ParserHelper.java
@@ -30,6 +30,7 @@ import java.util.Set;
 import javax.json.JsonObject;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.jackrabbit.util.ISO8601;
 import org.apache.sling.jcr.contentparser.ParseException;
 import org.apache.sling.jcr.contentparser.ParserOptions;
 
@@ -67,16 +68,21 @@ class ParserHelper {
 
     public Calendar tryParseCalendar(String value) {
         if (options.isDetectCalendarValues() && !StringUtils.isBlank(value)) {
-            synchronized (calendarFormat) {
-                try {
+            // 1st try: parse with ISO-8601 format first
+            Calendar calendar = ISO8601.parse(value);
+            if (calendar != null) {
+                return calendar;
+            }
+            // 2nd try: parse with ECMA date format which is used by Sling GET servlet
+            calendar = Calendar.getInstance();
+            try {
+                synchronized (calendarFormat) {
                     Date date = calendarFormat.parse(value);
-                    Calendar calendar = Calendar.getInstance();
                     calendar.setTime(date);
-                    return calendar;
-                }
-                catch (java.text.ParseException ex) {
-                    // ignore
                 }
+                return calendar;
+            } catch (java.text.ParseException ex) {
+                // ignore
             }
         }
         return null;
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
index 9d789fc..96c8357 100644
--- a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
@@ -107,6 +107,28 @@ public class JsonContentParserTest {
         assertEquals(11, calendar.get(Calendar.MINUTE));
         assertEquals(24, calendar.get(Calendar.SECOND));
     }
+    
+    @Test
+    public void testIso8601Calendar() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.JSON,
+                new ParserOptions().detectCalendarValues(true));
+        ContentElement content = parse(underTest, file);
+
+        Map<String, Object> props = content.getChild("jcr:content").getProperties();
+
+        Calendar calendar = (Calendar) props.get("dateISO8601String");
+        assertNotNull(calendar);
+
+        calendar.setTimeZone(TimeZone.getTimeZone("GMT+2"));
+
+        assertEquals(2014, calendar.get(Calendar.YEAR));
+        assertEquals(4, calendar.get(Calendar.MONTH) + 1);
+        assertEquals(22, calendar.get(Calendar.DAY_OF_MONTH));
+
+        assertEquals(15, calendar.get(Calendar.HOUR_OF_DAY));
+        assertEquals(11, calendar.get(Calendar.MINUTE));
+        assertEquals(24, calendar.get(Calendar.SECOND));
+    }
 
     @Test
     public void testUTF8Chars() throws Exception {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 29/38: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 23d1ff58895089c7f9d926ccd801511c67b79ab2
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue May 30 08:11:46 2017 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1796774 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 68d43b0..7283c66 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.jcr.contentparser</artifactId>
     <packaging>bundle</packaging>
-    <version>1.2.2</version>
+    <version>1.2.3-SNAPSHOT</version>
 
     <name>Apache Sling JCR Content Parser</name>
     <description>
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.2</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.2</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.jcr.contentparser-1.2.2</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentparser</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 21/38: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 0ab468ad1d3242b73ddae0acdb0c449fe381509d
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed May 24 08:48:29 2017 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1796014 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index c3c5584..601a3ed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.jcr.contentparser</artifactId>
     <packaging>bundle</packaging>
-    <version>1.2.0</version>
+    <version>1.2.1-SNAPSHOT</version>
 
     <name>Apache Sling JCR Content Parser</name>
     <description>
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.0</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.0</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.jcr.contentparser-1.2.0</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentparser</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 36/38: SLING-7167 Adjust READMEs

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit e27bd34e47b8d62e30dbada6e3705d9054dc82fd
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Oct 3 09:57:35 2017 +0000

    SLING-7167 Adjust READMEs
    
    add uniform header linking to Sling project
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1810858 13f79535-47bb-0310-9956-ffa450edef68
---
 README.md | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 24b5c8b..5af0d79 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
-Apache Sling JCR Content Parser
+# Apache Sling JCR Content Parser
+
+This module is part of the [Apache Sling](https://sling.apache.org) project.
 
 Parser for JCR repository content stored in files (e.g. JSON, FileVault XML).

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 02/38: SLING-6592 remove parse(File) method from API

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 3f0bcb340a830b319806096b5348b6946d7a4e1a
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Mar 14 10:57:31 2017 +0000

    SLING-6592 remove parse(File) method from API
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1786876 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/jcr/contentparser/ContentParser.java   | 10 ----------
 .../jcr/contentparser/impl/JcrXmlContentParser.java     |  9 ---------
 .../sling/jcr/contentparser/impl/JsonContentParser.java |  9 ---------
 .../jcr/contentparser/impl/JcrXmlContentParserTest.java | 11 ++++++-----
 .../jcr/contentparser/impl/JsonContentParserTest.java   | 17 +++++++++--------
 .../apache/sling/jcr/contentparser/impl/TestUtils.java  | 12 ++++++++++++
 6 files changed, 27 insertions(+), 41 deletions(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java
index cb6d013..1d9595a 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java
@@ -18,7 +18,6 @@
  */
 package org.apache.sling.jcr.contentparser;
 
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Map;
@@ -30,15 +29,6 @@ import java.util.Map;
 public interface ContentParser {
 
     /**
-     * Parse content file.
-     * @param file File
-     * @return Content
-     * @throws IOException When I/O error occurs.
-     * @throws ParseException When parsing error occurs.
-     */
-    Map<String,Object> parse(File file) throws IOException, ParseException;
-    
-    /**
      * Parse content.
      * @param is Stream with serialized content
      * @return Content as Map
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParser.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParser.java
index dde8c16..2af30e7 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParser.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParser.java
@@ -18,8 +18,6 @@
  */
 package org.apache.sling.jcr.contentparser.impl;
 
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.HashMap;
@@ -56,13 +54,6 @@ public final class JcrXmlContentParser implements ContentParser {
     }
     
     @Override
-    public Map<String,Object> parse(File file) throws IOException, ParseException {
-        try (FileInputStream fis = new FileInputStream(file)) {
-            return parse(fis);
-        }
-    }
-    
-    @Override
     public Map<String,Object> parse(InputStream is) throws IOException, ParseException {
         try {
             XmlHandler xmlHandler = new XmlHandler();
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java
index b070701..a17e91e 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java
@@ -18,8 +18,6 @@
  */
 package org.apache.sling.jcr.contentparser.impl;
 
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Calendar;
@@ -59,13 +57,6 @@ public final class JsonContentParser implements ContentParser {
     }
     
     @Override
-    public Map<String,Object> parse(File file) throws IOException, ParseException {
-        try (FileInputStream fis = new FileInputStream(file)) {
-            return parse(fis);
-        }
-    }
-    
-    @Override
     public Map<String,Object> parse(InputStream is) throws IOException, ParseException {
         try (JsonReader reader = jsonReaderFactory.createReader(is)) {
             return toMap(reader.readObject());
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParserTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParserTest.java
index d99a025..1faaf4e 100644
--- a/src/test/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParserTest.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParserTest.java
@@ -19,6 +19,7 @@
 package org.apache.sling.jcr.contentparser.impl;
 
 import static org.apache.sling.jcr.contentparser.impl.TestUtils.getDeep;
+import static org.apache.sling.jcr.contentparser.impl.TestUtils.parse;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -55,7 +56,7 @@ public class JcrXmlContentParserTest {
     @Test
     public void testParseJcrXml() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML);
-        Map<String,Object> content = underTest.parse(file);
+        Map<String,Object> content = parse(underTest, file);
         assertNotNull(content);
         assertEquals("app:Page", content.get("jcr:primaryType"));
         assertEquals("app:PageContent", ((Map<String,Object>)content.get("jcr:content")).get("jcr:primaryType"));
@@ -65,13 +66,13 @@ public class JcrXmlContentParserTest {
     public void testParseInvalidJcrXml() throws Exception {
         file = new File("src/test/resources/invalid-test/invalid.jcr.xml");
         ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML);
-        underTest.parse(file);
+        parse(underTest, file);
     }
 
     @Test
     public void testDataTypes() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML);
-        Map<String,Object> content = underTest.parse(file);
+        Map<String,Object> content = parse(underTest, file);
         Map<String,Object> props = getDeep(content, "jcr:content");
         
         assertEquals("en", props.get("jcr:title"));
@@ -104,7 +105,7 @@ public class JcrXmlContentParserTest {
         ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML, new ParserOptions()
                 .ignoreResourceNames(ImmutableSet.of("teaserbar", "aside"))
                 .ignorePropertyNames(ImmutableSet.of("longProp", "jcr:title")));
-        Map<String,Object> content = underTest.parse(file);
+        Map<String,Object> content = parse(underTest, file);
         Map<String,Object> props = getDeep(content, "jcr:content");
         
         assertEquals("HOME", props.get("navTitle"));
@@ -120,7 +121,7 @@ public class JcrXmlContentParserTest {
     @Ignore
     public void testSameNamePropertyAndSubResource() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML);
-        Map<String,Object> content = underTest.parse(file);
+        Map<String,Object> content = parse(underTest, file);
         Map<String,Object> props = getDeep(content, "jcr:content/teaserbar");
         // teaserbaritem is a direct property as well as a sub resource
         assertEquals("test", props.get("teaserbaritem"));
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
index a98757a..3aa9531 100644
--- a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
@@ -19,6 +19,7 @@
 package org.apache.sling.jcr.contentparser.impl;
 
 import static org.apache.sling.jcr.contentparser.impl.TestUtils.getDeep;
+import static org.apache.sling.jcr.contentparser.impl.TestUtils.parse;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -52,7 +53,7 @@ public class JsonContentParserTest {
     @Test
     public void testPageJcrPrimaryType() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
-        Map<String, Object> content = underTest.parse(file);
+        Map<String, Object> content = parse(underTest, file);
 
         assertEquals("app:Page", content.get("jcr:primaryType"));
     }
@@ -60,7 +61,7 @@ public class JsonContentParserTest {
     @Test
     public void testDataTypes() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
-        Map<String, Object> content = underTest.parse(file);
+        Map<String, Object> content = parse(underTest, file);
 
         Map<String, Object> props = getDeep(content, "toolbar/profiles/jcr:content");
         assertEquals(true, props.get("hideInNav"));
@@ -77,7 +78,7 @@ public class JsonContentParserTest {
     @Test
     public void testContentProperties() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
-        Map<String, Object> content = underTest.parse(file);
+        Map<String, Object> content = parse(underTest, file);
 
         Map<String, Object> props = getDeep(content, "jcr:content/header");
         assertEquals("/content/dam/sample/header.png", props.get("imageReference"));
@@ -87,7 +88,7 @@ public class JsonContentParserTest {
     public void testCalendar() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON,
                 new ParserOptions().detectCalendarValues(true));
-        Map<String, Object> content = underTest.parse(file);
+        Map<String, Object> content = parse(underTest, file);
 
         Map<String, Object> props = getDeep(content, "jcr:content");
 
@@ -108,7 +109,7 @@ public class JsonContentParserTest {
     @Test
     public void testUTF8Chars() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
-        Map<String, Object> content = underTest.parse(file);
+        Map<String, Object> content = parse(underTest, file);
 
         Map<String, Object> props = getDeep(content, "jcr:content");
 
@@ -119,7 +120,7 @@ public class JsonContentParserTest {
     public void testParseInvalidJson() throws Exception {
         file = new File("src/test/resources/invalid-test/invalid.json");
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
-        Map<String, Object> content = underTest.parse(file);
+        Map<String, Object> content = parse(underTest, file);
         assertNull(content);
     }
 
@@ -127,7 +128,7 @@ public class JsonContentParserTest {
     public void testParseInvalidJsonWithObjectList() throws Exception {
         file = new File("src/test/resources/invalid-test/contentWithObjectList.json");
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
-        Map<String, Object> content = underTest.parse(file);
+        Map<String, Object> content = parse(underTest, file);
         assertNull(content);
     }
 
@@ -136,7 +137,7 @@ public class JsonContentParserTest {
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON,
                 new ParserOptions().ignoreResourceNames(ImmutableSet.of("header", "newslist"))
                         .ignorePropertyNames(ImmutableSet.of("jcr:title")));
-        Map<String, Object> content = underTest.parse(file);
+        Map<String, Object> content = parse(underTest, file);
         Map<String, Object> props = getDeep(content, "jcr:content");
 
         assertEquals("Sample Homepage", props.get("pageTitle"));
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java
index bd3bb10..f91c5ee 100644
--- a/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java
@@ -18,9 +18,14 @@
  */
 package org.apache.sling.jcr.contentparser.impl;
 
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
 import java.util.Map;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.sling.jcr.contentparser.ContentParser;
 
 public final class TestUtils {
     
@@ -45,4 +50,11 @@ public final class TestUtils {
       }
     }
     
+    public static Map<String,Object> parse(ContentParser contentParser, File file) throws IOException {
+        try (FileInputStream fis = new FileInputStream(file);
+                BufferedInputStream bis = new BufferedInputStream(fis)) {
+            return contentParser.parse(bis);
+        }
+    }
+    
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 31/38: [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.2.4

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 3fea4cc5c25c8226e3a4d8e6edccf69299f461ee
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Jun 23 13:45:29 2017 +0000

    [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.2.4
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1799662 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 7283c66..542c426 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.jcr.contentparser</artifactId>
     <packaging>bundle</packaging>
-    <version>1.2.3-SNAPSHOT</version>
+    <version>1.2.4</version>
 
     <name>Apache Sling JCR Content Parser</name>
     <description>
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentparser</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.4</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.4</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.jcr.contentparser-1.2.4</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 30/38: SLING-6960 JCR Content Parser: Ignore security:acl and security:principals nodes

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit b08260752b71ef95afdc18c23b83fc04d93a9ccd
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed Jun 14 17:22:03 2017 +0000

    SLING-6960 JCR Content Parser: Ignore security:acl and security:principals nodes
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1798723 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/jcr/contentparser/ParserOptions.java     | 11 ++++++++-
 .../jcr/contentparser/impl/JsonContentParser.java  | 27 ++++++++++++++++------
 .../sling/jcr/contentparser/package-info.java      |  2 +-
 .../contentparser/impl/JsonContentParserTest.java  |  2 +-
 src/test/resources/content-test/content.json       | 10 ++++++++
 5 files changed, 42 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java b/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
index d3e87fa..1c006ea 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
@@ -49,6 +49,15 @@ public final class ParserOptions {
           )));
     
     /**
+     * Default list of resource names that should be ignored.
+     */
+    public static final Set<String> DEFAULT_IGNORE_RESOURCE_NAMES
+        = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
+            "security:acl",
+            "security:principals"
+          )));
+    
+    /**
      * List of JSON parser features activated by default.
      */
     public static final EnumSet<JsonParserFeature> DEFAULT_JSON_PARSER_FEATURES
@@ -57,7 +66,7 @@ public final class ParserOptions {
     private String defaultPrimaryType = DEFAULT_PRIMARY_TYPE;
     private boolean detectCalendarValues;
     private Set<String> ignorePropertyNames;
-    private Set<String> ignoreResourceNames;
+    private Set<String> ignoreResourceNames = DEFAULT_IGNORE_RESOURCE_NAMES;
     private Set<String> removePropertyNamePrefixes = DEFAULT_REMOVE_PROPERTY_NAME_PREFIXES;
     private EnumSet<JsonParserFeature> jsonParserFeatures = DEFAULT_JSON_PARSER_FEATURES;
     
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java
index 054be85..9b88282 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java
@@ -117,15 +117,28 @@ public final class JsonContentParser implements ContentParser {
         Map<String,JsonObject> children = new LinkedHashMap<>();
         for (Map.Entry<String, JsonValue> entry : object.entrySet()) {
             String childName = entry.getKey();
-            Object value = convertValue(entry.getValue());
-            boolean isResource = (value instanceof JsonObject);
+            Object value = null;
             boolean ignore = false;
-            if (isResource) {
-                ignore = helper.ignoreResource(childName);
+            try {
+                value = convertValue(entry.getValue());
+            }
+            catch (ParseException ex) {
+                if (helper.ignoreResource(childName) || helper.ignoreProperty(helper.cleanupPropertyName(childName))) {
+                    ignore = true;
+                }
+                else {
+                    throw ex;
+                }
             }
-            else {
-                childName = helper.cleanupPropertyName(childName);
-                ignore = helper.ignoreProperty(childName);
+            boolean isResource = (value instanceof JsonObject);
+            if (!ignore) {
+                if (isResource) {
+                    ignore = helper.ignoreResource(childName);
+                }
+                else {
+                    childName = helper.cleanupPropertyName(childName);
+                    ignore = helper.ignoreProperty(childName);
+                }
             }
             if (!ignore) {
                 if (isResource) {
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/package-info.java b/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
index 5cf33d1..51afb23 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
@@ -19,5 +19,5 @@
 /**
  * Parser for repository content serialized e.g. as JSON or JCR XML.
  */
-@org.osgi.annotation.versioning.Version("1.2.0")
+@org.osgi.annotation.versioning.Version("1.3.0")
 package org.apache.sling.jcr.contentparser;
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
index b8f3598..9d789fc 100644
--- a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
@@ -137,7 +137,7 @@ public class JsonContentParserTest {
     @Test
     public void testIgnoreResourcesProperties() throws Exception {
         ContentParser underTest = ContentParserFactory.create(ContentType.JSON,
-                new ParserOptions().ignoreResourceNames(ImmutableSet.of("header", "newslist"))
+                new ParserOptions().ignoreResourceNames(ImmutableSet.of("header", "newslist", "security:acl", "security:principals"))
                         .ignorePropertyNames(ImmutableSet.of("jcr:title")));
         ContentElement content = parse(underTest, file);
         ContentElement child = content.getChild("jcr:content");
diff --git a/src/test/resources/content-test/content.json b/src/test/resources/content-test/content.json
index c30d34e..8890044 100644
--- a/src/test/resources/content-test/content.json
+++ b/src/test/resources/content-test/content.json
@@ -20,6 +20,16 @@
     "utf8Property": "äöü߀",
     "jcr:reference:refpro1": "abc",
     "jcr:path:pathprop1": "def",
+    /* should be ignored */
+    "security:acl": [
+        { "principal": "TestGroup1", "granted": ["jcr:read","jcr:write"] },
+        { "principal": "TestUser1", "granted": ["jcr:read"], "denied": ["jcr:write"] }
+    ],
+    /* should be ignored */
+    "security:principals": [
+        { "name": "TestUser1", "password": "mypassword", "extraProp1": "extraProp1Value" },
+        { "name": "TestGroup1", "isgroup": "true", "members": ["TestUser1"], "extraProp1": "extraProp1Value" }
+    ],
     "par": {
       "jcr:primaryType": "nt:unstructured",
       "sling:resourceType": "foundation/components/parsys",

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 14/38: [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.1.0

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 8a4a0c2bc62fce852fb27f37d97375577d48ccb9
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu May 4 20:12:23 2017 +0000

    [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.1.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1793875 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index ea8af54..a84cb33 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.jcr.contentparser</artifactId>
     <packaging>bundle</packaging>
-    <version>1.0.1-SNAPSHOT</version>
+    <version>1.1.0</version>
 
     <name>Apache Sling JCR Content Parser</name>
     <description>
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentparser</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.1.0</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.1.0</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.jcr.contentparser-1.1.0</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 22/38: SLING-6915 JCR Content Parser: Tick parsing fails when comment contains tick character

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 977e6ca5752589f28728011dc54e60423e653da0
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon May 29 10:29:30 2017 +0000

    SLING-6915 JCR Content Parser: Tick parsing fails when comment contains tick character
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1796611 13f79535-47bb-0310-9956-ffa450edef68
---
 .../jcr/contentparser/impl/JsonTicksConverter.java | 23 +++++++++++++++++-----
 .../impl/JsonContentParserTicksTest.java           | 12 ++++++++++-
 .../contentparser/impl/JsonTicksConverterTest.java | 11 +++++++++++
 3 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
index 9996082..3d2cf9d 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
@@ -41,6 +41,8 @@ public final class JsonTicksConverter {
         boolean quoted = false;
         boolean tickQuoted = false;
         boolean escaped = false;
+        boolean comment = false;
+        char lastChar = ' ';
         for (int i = 0; i < len; i++) {
             char in = input.charAt(i);
             if (quoted || tickQuoted) {
@@ -71,18 +73,29 @@ public final class JsonTicksConverter {
                 }
             }
             else {
-                if (in == '\'') {
-                    in = '"';
-                    tickQuoted = true;
+                if (comment) {
+                    if (lastChar == '*' && in == '/') {
+                        comment = false;
+                    }
                 }
-                else if (in == '"') {
-                    quoted = true;
+                else {
+                    if (lastChar == '/' && in == '*') {
+                        comment = true;
+                    }
+                    else if (in == '\'') {
+                        in = '"';
+                        tickQuoted = true;
+                    }
+                    else if (in == '"') {
+                        quoted = true;
+                    }
                 }
             }
             if (in == '\\') {
                 continue;
             }
             output.append(in);
+            lastChar = in;
         }
         return output.toString();
     }
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTicksTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTicksTest.java
index 1ba5e62..cd61506 100644
--- a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTicksTest.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTicksTest.java
@@ -41,7 +41,7 @@ public class JsonContentParserTicksTest {
     @Before
     public void setUp() {
         underTest = ContentParserFactory.create(ContentType.JSON,
-                new ParserOptions().jsonParserFeatures(JsonParserFeature.QUOTE_TICK));
+                new ParserOptions().jsonParserFeatures(JsonParserFeature.QUOTE_TICK, JsonParserFeature.COMMENTS));
     }
 
     @Test
@@ -65,6 +65,16 @@ public class JsonContentParserTicksTest {
     }
 
     @Test
+    public void testJsonWithTicksMixedWithComment() throws Exception {
+        ContentElement content = parse(underTest, "{/*a'b\"c*/\"prop1\":'value1','prop2':123,'obj':{'prop3':\"value2\"}}");
+
+        Map<String, Object> props = content.getProperties();
+        assertEquals("value1", props.get("prop1"));
+        assertEquals(123L, props.get("prop2"));
+        assertEquals("value2", content.getChild("obj").getProperties().get("prop3"));
+    }
+
+    @Test
     public void testTicksDoubleQuotesInDoubleQuotes() throws Exception {
         ContentElement content = parse(underTest, "{\"prop1\":\"'\\\"\'\\\"\"}");
 
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java
index 836d1a8..dfec3a0 100644
--- a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java
@@ -43,6 +43,17 @@ public class JsonTicksConverterTest {
     }
 
     @Test
+    public void testTickToQuoteMixedWithComment() {
+        assertEquals("{ /* abc */ \"p\":\"v\"}", tickToDoubleQuote("{ /* abc */ 'p':\"v\"}"));
+        assertEquals("{ /* ab'c */ \"p\":\"v\"}", tickToDoubleQuote("{ /* ab'c */ 'p':\"v\"}"));
+        assertEquals("{ /* ab'c' */ \"p\":\"v\"}", tickToDoubleQuote("{ /* ab'c' */ 'p':\"v\"}"));
+        assertEquals("{ /* ab\"c */ \"p\":\"v\"}", tickToDoubleQuote("{ /* ab\"c */ 'p':\"v\"}"));
+        assertEquals("{ /* ab\"c\" */ \"p\":\"v\"}", tickToDoubleQuote("{ /* ab\"c\" */ 'p':\"v\"}"));
+        assertEquals("{ /* ab'c\" */ \"p\":\"v\"}", tickToDoubleQuote("{ /* ab'c\" */ 'p':\"v\"}"));
+        assertEquals("{/*ab'c\"*/\"p\":\"v\"/*ab'c\"*/}", tickToDoubleQuote("{/*ab'c\"*/'p':\"v\"/*ab'c\"*/}"));
+    }
+    
+    @Test
     public void testTicksDoubleQuotesInDoubleQuotes() {
         assertEquals("{\"p\":\"'\\\"'\\\"\"}", tickToDoubleQuote("{\"p\":\"'\\\"'\\\"\"}"));
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 19/38: SLING-6872 make JsonTicksConverter public to allow embedding

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 753dfa4bdfef23c082644eca8759537c824865e1
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue May 23 21:49:54 2017 +0000

    SLING-6872 make JsonTicksConverter public to allow embedding
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1795975 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/jcr/contentparser/impl/JsonTicksConverter.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
index 9d5f6e0..9996082 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
@@ -29,9 +29,13 @@ package org.apache.sling.jcr.contentparser.impl;
  *     After the conversion they are always escaped.</li>
  * </ul>
  */
-class JsonTicksConverter {
+public final class JsonTicksConverter {
     
-    static String tickToDoubleQuote(final String input) {
+    private JsonTicksConverter() {
+        // static methods only
+    }
+    
+    public static String tickToDoubleQuote(final String input) {
         final int len = input.length();
         final StringBuilder output = new StringBuilder(len);
         boolean quoted = false;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 34/38: SLING-7167 Adjust READMEs

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 266dea2706ae6bfbcfb5ac89acf426e3188bfe51
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Oct 2 14:57:23 2017 +0000

    SLING-7167 Adjust READMEs
    
    remove outdated information
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1810398 13f79535-47bb-0310-9956-ffa450edef68
---
 README.txt | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/README.txt b/README.txt
index 1446028..24b5c8b 100644
--- a/README.txt
+++ b/README.txt
@@ -1,26 +1,3 @@
 Apache Sling JCR Content Parser
 
 Parser for JCR repository content stored in files (e.g. JSON, FileVault XML).
-
-Getting Started
-===============
-
-This component uses a Maven 3 (http://maven.apache.org/) build
-environment. It requires a Java 7 JDK (or higher) and Maven (http://maven.apache.org/)
-3.3.9 or later. We recommend to use the latest Maven version.
-
-If you have Maven installed, you can compile and
-package the jar using the following command:
-
-    mvn package
-
-See the Maven documentation for other build features.
-
-The latest source code for this component is available in the
-Subversion (http://subversion.tigris.org/) source repository of
-the Apache Software Foundation. If you have Subversion installed,
-you can checkout the latest source using the following command:
-
-    svn checkout http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser
-
-See the Subversion documentation for other source control features.

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 33/38: Remove unused collections dependency

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit a023165b8b600dead350f0d2e56791c7051a0b6f
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Aug 25 09:30:19 2017 +0000

    Remove unused collections dependency
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1806136 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/pom.xml b/pom.xml
index bae19ce..7cea52a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,12 +72,6 @@
             <scope>compile</scope>
         </dependency>
         <dependency>
-            <groupId>commons-collections</groupId>
-            <artifactId>commons-collections</artifactId>
-            <version>3.2.1</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
             <version>2.4</version>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 04/38: add readme

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 63eb6123b530958ed97eed3c92385974d1eebeef
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Mar 20 11:06:04 2017 +0000

    add readme
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1787713 13f79535-47bb-0310-9956-ffa450edef68
---
 README.txt | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..d0888d9
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,26 @@
+Apache Sling Content Parser
+
+Parser for JCR repository content stored in files (e.g. JSON, FileVault XML).
+
+Getting Started
+===============
+
+This component uses a Maven 3 (http://maven.apache.org/) build
+environment. It requires a Java 7 JDK (or higher) and Maven (http://maven.apache.org/)
+3.3.9 or later. We recommend to use the latest Maven version.
+
+If you have Maven installed, you can compile and
+package the jar using the following command:
+
+    mvn package
+
+See the Maven documentation for other build features.
+
+The latest source code for this component is available in the
+Subversion (http://subversion.tigris.org/) source repository of
+the Apache Software Foundation. If you have Subversion installed,
+you can checkout the latest source using the following command:
+
+    svn checkout http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser
+
+See the Subversion documentation for other source control features.

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 06/38: [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.0.0

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit b3236b5c317666546d26039fd15e665272ada6f5
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Mar 20 11:15:01 2017 +0000

    [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.0.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1787716 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index e092a3a..e740ebd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.jcr.contentparser</artifactId>
     <packaging>bundle</packaging>
-    <version>1.0.0-SNAPSHOT</version>
+    <version>1.0.0</version>
 
     <name>Apache Sling Content Parser</name>
     <description>
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentparser</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.0.0</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.0.0</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.jcr.contentparser-1.0.0</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 07/38: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 26963f8807ca827fc4b3153920b663c0b796ed53
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Mar 20 11:15:16 2017 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1787718 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index e740ebd..a4e4f67 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.jcr.contentparser</artifactId>
     <packaging>bundle</packaging>
-    <version>1.0.0</version>
+    <version>1.0.1-SNAPSHOT</version>
 
     <name>Apache Sling Content Parser</name>
     <description>
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.0.0</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.0.0</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.jcr.contentparser-1.0.0</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentparser</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 05/38: add osgi versioning annotations

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 0d2cf03ddc193953263acafd81942b1096a1d576
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Mar 20 11:10:08 2017 +0000

    add osgi versioning annotations
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1787714 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/jcr/contentparser/ContentHandler.java   | 3 +++
 src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java    | 3 +++
 .../java/org/apache/sling/jcr/contentparser/ContentParserFactory.java  | 2 ++
 src/main/java/org/apache/sling/jcr/contentparser/ContentType.java      | 3 +++
 src/main/java/org/apache/sling/jcr/contentparser/ParseException.java   | 3 +++
 src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java    | 3 +++
 6 files changed, 17 insertions(+)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentHandler.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentHandler.java
index 7582338..8c88d84 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentHandler.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentHandler.java
@@ -20,11 +20,14 @@ package org.apache.sling.jcr.contentparser;
 
 import java.util.Map;
 
+import org.osgi.annotation.versioning.ConsumerType;
+
 /**
  * Handler that gets notified while parsing content with {@link ContentParser}.
  * The resources are always reported in order of their paths as found in the content fragment.
  * Parents are always reported before their children.
  */
+@ConsumerType
 public interface ContentHandler {
 
     /**
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java
index fa6877d..4876986 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java
@@ -21,10 +21,13 @@ package org.apache.sling.jcr.contentparser;
 import java.io.IOException;
 import java.io.InputStream;
 
+import org.osgi.annotation.versioning.ProviderType;
+
 /**
  * Parses repository content from a file.
  * Implementations have to be thread-safe.
  */
+@ProviderType
 public interface ContentParser {
 
     /**
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java
index 7357ec5..33ca999 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java
@@ -20,10 +20,12 @@ package org.apache.sling.jcr.contentparser;
 
 import org.apache.sling.jcr.contentparser.impl.JcrXmlContentParser;
 import org.apache.sling.jcr.contentparser.impl.JsonContentParser;
+import org.osgi.annotation.versioning.ProviderType;
 
 /**
  * Factory for content parsers.
  */
+@ProviderType
 public final class ContentParserFactory {
 
     private ContentParserFactory() {
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
index acba05d..41665ee 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
@@ -18,9 +18,12 @@
  */
 package org.apache.sling.jcr.contentparser;
 
+import org.osgi.annotation.versioning.ProviderType;
+
 /**
  * Content types.
  */
+@ProviderType
 public enum ContentType {
 
     /**
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ParseException.java b/src/main/java/org/apache/sling/jcr/contentparser/ParseException.java
index 4df0160..38970b8 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ParseException.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ParseException.java
@@ -18,9 +18,12 @@
  */
 package org.apache.sling.jcr.contentparser;
 
+import org.osgi.annotation.versioning.ProviderType;
+
 /**
  * Parsing exception.
  */
+@ProviderType
 public final class ParseException extends RuntimeException {
     private static final long serialVersionUID = 1L;
 
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java b/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
index 4dba088..4fe6192 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
@@ -23,9 +23,12 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.osgi.annotation.versioning.ProviderType;
+
 /**
  * Options for content parser.
  */
+@ProviderType
 public final class ParserOptions {
     
     /**

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 25/38: [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.2.2

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 5631ad900e3b325186ebbc9ce285ce4779057fdb
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue May 30 07:38:26 2017 +0000

    [maven-release-plugin] prepare release org.apache.sling.jcr.contentparser-1.2.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1796741 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 601a3ed..68d43b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.jcr.contentparser</artifactId>
     <packaging>bundle</packaging>
-    <version>1.2.1-SNAPSHOT</version>
+    <version>1.2.2</version>
 
     <name>Apache Sling JCR Content Parser</name>
     <description>
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentparser</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.2</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.contentparser-1.2.2</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.jcr.contentparser-1.2.2</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 27/38: rollback releases

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 4626e226b0e79dcb4f85e8a3cb78ac7a0696ff83
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue May 30 08:08:18 2017 +0000

    rollback releases
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1796769 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 7283c66..601a3ed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.jcr.contentparser</artifactId>
     <packaging>bundle</packaging>
-    <version>1.2.3-SNAPSHOT</version>
+    <version>1.2.1-SNAPSHOT</version>
 
     <name>Apache Sling JCR Content Parser</name>
     <description>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 35/38: SLING-7167 Adjust READMEs

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 45a7fa6a0162e7a6dee4a80511495e7e1ce58350
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Oct 2 16:15:08 2017 +0000

    SLING-7167 Adjust READMEs
    
    switch from plain text to Markdown
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1810485 13f79535-47bb-0310-9956-ffa450edef68
---
 README.txt => README.md | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/README.txt b/README.md
similarity index 100%
rename from README.txt
rename to README.md

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 08/38: change name to "Apache Sling JCR Content Parser"

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 1726a8bf105a6c412c1970145a58be99f319c4a4
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Mar 20 11:18:02 2017 +0000

    change name to "Apache Sling JCR Content Parser"
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1787719 13f79535-47bb-0310-9956-ffa450edef68
---
 README.txt | 2 +-
 pom.xml    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.txt b/README.txt
index d0888d9..1446028 100644
--- a/README.txt
+++ b/README.txt
@@ -1,4 +1,4 @@
-Apache Sling Content Parser
+Apache Sling JCR Content Parser
 
 Parser for JCR repository content stored in files (e.g. JSON, FileVault XML).
 
diff --git a/pom.xml b/pom.xml
index a4e4f67..ea8af54 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
     <packaging>bundle</packaging>
     <version>1.0.1-SNAPSHOT</version>
 
-    <name>Apache Sling Content Parser</name>
+    <name>Apache Sling JCR Content Parser</name>
     <description>
         Parser for JCR repository content stored in files (e.g. JSON, FileVault XML).
     </description>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 12/38: SLING-6828 JCR Content Parser: Support XML Descriptor Files

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit fd436431d5e9422d71e24081621cd0039bdb38a3
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu May 4 13:30:10 2017 +0000

    SLING-6828 JCR Content Parser: Support XML Descriptor Files
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1793800 13f79535-47bb-0310-9956-ffa450edef68
---
 .../jcr/contentparser/ContentParserFactory.java    |   3 +
 .../sling/jcr/contentparser/ContentType.java       |   6 +
 .../jcr/contentparser/impl/XmlContentParser.java   | 228 +++++++++++++++
 .../sling/jcr/contentparser/package-info.java      |   2 +-
 .../contentparser/impl/XmlContentParserTest.java   | 171 +++++++++++
 src/test/resources/content-test/content.xml        | 316 +++++++++++++++++++++
 6 files changed, 725 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java
index 33ca999..8894de6 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java
@@ -20,6 +20,7 @@ package org.apache.sling.jcr.contentparser;
 
 import org.apache.sling.jcr.contentparser.impl.JcrXmlContentParser;
 import org.apache.sling.jcr.contentparser.impl.JsonContentParser;
+import org.apache.sling.jcr.contentparser.impl.XmlContentParser;
 import org.osgi.annotation.versioning.ProviderType;
 
 /**
@@ -51,6 +52,8 @@ public final class ContentParserFactory {
         switch (type) {
             case JSON:
                 return new JsonContentParser(options);
+            case XML:
+                return new XmlContentParser(options);
             case JCR_XML:
                 return new JcrXmlContentParser(options);
             default:
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
index 21d7e14..a4d99c5 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
@@ -33,6 +33,12 @@ public enum ContentType {
     JSON("json"),
 
     /**
+     * XML content descriptor file.
+     * @see https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#xml-descriptor-files
+     */
+    XML("xml"),
+
+    /**
      * JCR XML content (FileVault XML). Also known as extended document view XML.
      * Extends the regular document view as specified by JCR 2.0 by specifics like
      * multivalue and typing information. Is used by Jackrabbit FileVault.
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/XmlContentParser.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/XmlContentParser.java
new file mode 100644
index 0000000..4685a8c
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/XmlContentParser.java
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jcr.PropertyType;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.sling.jcr.contentparser.ContentHandler;
+import org.apache.sling.jcr.contentparser.ContentParser;
+import org.apache.sling.jcr.contentparser.ParseException;
+import org.apache.sling.jcr.contentparser.ParserOptions;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * Parses XML files that contains content fragments.
+ * Instance of this class is thread-safe.
+ */
+public final class XmlContentParser implements ContentParser {
+    
+    private final ParserHelper helper;    
+    private final DocumentBuilderFactory documentBuilderFactory;
+    
+    public XmlContentParser(ParserOptions options) {
+        this.helper = new ParserHelper(options);
+        documentBuilderFactory = DocumentBuilderFactory.newInstance();
+    }
+    
+    @Override
+    public void parse(ContentHandler handler, InputStream is) throws IOException, ParseException {
+        try {
+            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+            Document doc = documentBuilder.parse(is);
+            parse(handler, doc.getDocumentElement(), null);
+        }
+        catch (ParserConfigurationException | SAXException ex) {
+            throw new ParseException("Error parsing JCR XML content.", ex);
+        }
+    }
+    
+    private void parse(ContentHandler handler, Element element, String parentPath) {
+        
+        // build node path
+        String path;
+        if (parentPath == null) {
+            path = "/";
+        }
+        else {
+            String name = getChildText(element, "name");
+            if (StringUtils.isEmpty(name)) {
+                throw new ParseException("Child node without name detected below path " + parentPath);
+            }
+            path = helper.concatenatePath(parentPath, name);
+            if (helper.ignoreResource(name)) {
+                return;
+            }
+        }
+
+        Map<String,Object> properties = new HashMap<>();
+        
+        // primary node type and mixins
+        String primaryType = getChildText(element, "primaryNodeType");
+        if (StringUtils.isNotBlank(primaryType) && !helper.ignoreProperty("jcr:primaryType")) {
+            properties.put("jcr:primaryType", primaryType);
+        }
+        String[] mixins = getChildTextArray(element, "mixinNodeType");
+        if (mixins.length > 0 && !helper.ignoreProperty("jcr:mixinTypes")) {
+            properties.put("jcr:mixinTypes", mixins);
+        }
+        
+        // properties
+        List<Element> propertyElements = getChildren(element, "property");
+        for (Element propertyElement : propertyElements) {
+            
+            // property name
+            String name = getChildText(propertyElement, "name");
+            if (StringUtils.isBlank(name)) {
+                throw new ParseException("Property without name detected at path " + path);
+            }
+            if (helper.ignoreProperty(name)) {
+                continue;
+            }
+            
+            // property type
+            String typeString = getChildText(propertyElement, "type");
+            if (StringUtils.isBlank(typeString)) {
+                throw new ParseException("Property '" + name + "' has no type at path " + path);
+            }
+            int type;
+            try {
+                type = PropertyType.valueFromName(typeString);
+            }
+            catch (IllegalArgumentException ex) {
+                throw new ParseException("Property '" + name + "' has illegal type '" + typeString + "' at path " + path);
+            }
+            
+            // property value
+            Object value;
+            List<Element> valuesElements = getChildren(propertyElement, "values");
+            if (!valuesElements.isEmpty()) {
+                Element valuesElement = valuesElements.get(0);
+                List<Element> valueElements = getChildren(valuesElement, "value");
+                String[] stringValues = new String[valueElements.size()];
+                for (int i=0; i<valueElements.size(); i++) {
+                    stringValues[i] = valueElements.get(i).getTextContent();
+                }
+                value = convertMultiValue(stringValues, type);
+            }
+            else {
+                String stringValue = getChildText(propertyElement, "value");
+                value = convertValue(stringValue, type);
+            }
+            properties.put(name, value);
+        }
+        
+        // report current JSON object
+        helper.ensureDefaultPrimaryType(properties);
+        handler.resource(path, properties);
+        
+        // child nodes
+        List<Element> nodeElements = getChildren(element, "node");
+        for (Element node : nodeElements) {
+            parse(handler, node, path);
+        }
+        
+    }
+    
+    private List<Element> getChildren(Element element, String childName) {
+        List<Element> result = new ArrayList<>();
+        NodeList children = element.getChildNodes();
+        int len = children.getLength();
+        for (int i=0; i<len; i++) {
+            Node child = children.item(i);
+            if (child instanceof Element) {
+                Element childElement = (Element)child;
+                if (StringUtils.equals(childElement.getNodeName(), childName)) {
+                    result.add(childElement);
+                }
+            }
+        }
+        return result;
+    }
+    
+    private String getChildText(Element element, String childName) {
+        List<Element> children = getChildren(element, childName);
+        if (children.isEmpty()) {
+            return null;
+        }
+        else if (children.size() == 1) {
+            return children.get(0).getTextContent();
+        }
+        else {
+            throw new ParseException("Found multiple elements with name '" + childName + "': " + children.size());
+        }
+    }
+    
+    private String[] getChildTextArray(Element element, String childName) {
+        List<Element> children = getChildren(element, childName);
+        String[] result = new String[children.size()];
+        for (int i=0; i<children.size(); i++) {
+            result[i] = children.get(i).getTextContent();
+        }
+        return result;
+    }
+    
+    private Object convertValue(String value, int type) {
+        switch (type) {
+            case PropertyType.STRING:
+            case PropertyType.NAME:
+            case PropertyType.PATH:
+            case PropertyType.REFERENCE:
+            case PropertyType.WEAKREFERENCE:
+            case PropertyType.URI:
+                return value;
+            case PropertyType.LONG:
+                return Long.valueOf(value);
+            case PropertyType.DOUBLE:
+                return Double.valueOf(value);
+            case PropertyType.DATE:
+                return helper.tryParseCalendar(value);
+            case PropertyType.BOOLEAN:
+                return Boolean.valueOf(value);
+            case PropertyType.DECIMAL:
+                return new BigDecimal(value);
+            default:
+                throw new ParseException("Unsupported property type: " + PropertyType.nameFromValue(type));
+        }
+    }
+
+    private Object convertMultiValue(String[] values, int type) {
+        Object[] result = new Object[values.length];
+        for (int i=0; i<values.length; i++) {
+            result[i] = convertValue(values[i], type);
+        }
+        return helper.convertSingleTypeArray(result);
+    }
+    
+}
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/package-info.java b/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
index 1b6b2a8..771f212 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
@@ -19,5 +19,5 @@
 /**
  * Parser for repository content serialized e.g. as JSON or JCR XML.
  */
-@org.osgi.annotation.versioning.Version("1.0.0")
+@org.osgi.annotation.versioning.Version("1.1.0")
 package org.apache.sling.jcr.contentparser;
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/XmlContentParserTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/XmlContentParserTest.java
new file mode 100644
index 0000000..d51c5d6
--- /dev/null
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/XmlContentParserTest.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl;
+
+import static org.apache.sling.jcr.contentparser.impl.TestUtils.parse;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.io.File;
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Map;
+import java.util.TimeZone;
+
+import org.apache.sling.jcr.contentparser.ContentParser;
+import org.apache.sling.jcr.contentparser.ContentParserFactory;
+import org.apache.sling.jcr.contentparser.ContentType;
+import org.apache.sling.jcr.contentparser.ParseException;
+import org.apache.sling.jcr.contentparser.ParserOptions;
+import org.apache.sling.jcr.contentparser.impl.mapsupport.ContentElement;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+public class XmlContentParserTest {
+
+    private File file;
+
+    @Before
+    public void setUp() throws Exception {
+        file = new File("src/test/resources/content-test/content.xml");
+    }
+
+    @Test
+    public void testPageJcrPrimaryType() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.XML);
+        ContentElement content = parse(underTest, file);
+
+        assertEquals("app:Page", content.getProperties().get("jcr:primaryType"));
+    }
+
+    @Test
+    public void testDataTypes() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.XML);
+        ContentElement content = parse(underTest, file);
+
+        Map<String, Object> props = content.getChild("toolbar/profiles/jcr:content").getProperties();
+        assertEquals(true, props.get("hideInNav"));
+
+        assertEquals(1234567890123L, props.get("longProp"));
+        assertEquals(new BigDecimal("1.2345"), props.get("decimalProp"));
+        assertEquals(true, props.get("booleanProp"));
+
+        assertArrayEquals(new Long[] { 1234567890123L, 55L }, (Long[]) props.get("longPropMulti"));
+        assertArrayEquals(new BigDecimal[] { new BigDecimal("1.2345"), new BigDecimal("1.1") }, (BigDecimal[]) props.get("decimalPropMulti"));
+        assertArrayEquals(new Boolean[] { true, false }, (Boolean[]) props.get("booleanPropMulti"));
+    }
+
+    @Test
+    public void testContentProperties() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.XML);
+        ContentElement content = parse(underTest, file);
+
+        Map<String, Object> props = content.getChild("jcr:content/header").getProperties();
+        assertEquals("/content/dam/sample/header.png", props.get("imageReference"));
+    }
+
+    @Test
+    public void testCalendar() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.XML,
+                new ParserOptions().detectCalendarValues(true));
+        ContentElement content = parse(underTest, file);
+
+        Map<String, Object> props = content.getChild("jcr:content").getProperties();
+
+        Calendar calendar = (Calendar) props.get("app:lastModified");
+        assertNotNull(calendar);
+
+        calendar.setTimeZone(TimeZone.getTimeZone("GMT+2"));
+
+        assertEquals(2014, calendar.get(Calendar.YEAR));
+        assertEquals(4, calendar.get(Calendar.MONTH) + 1);
+        assertEquals(22, calendar.get(Calendar.DAY_OF_MONTH));
+
+        assertEquals(15, calendar.get(Calendar.HOUR_OF_DAY));
+        assertEquals(11, calendar.get(Calendar.MINUTE));
+        assertEquals(24, calendar.get(Calendar.SECOND));
+    }
+
+    @Test
+    public void testUTF8Chars() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.XML);
+        ContentElement content = parse(underTest, file);
+
+        Map<String, Object> props = content.getChild("jcr:content").getProperties();
+
+        assertEquals("äöü߀", props.get("utf8Property"));
+    }
+
+    @Test(expected = ParseException.class)
+    public void testParseInvalidJson() throws Exception {
+        file = new File("src/test/resources/invalid-test/invalid.json");
+        ContentParser underTest = ContentParserFactory.create(ContentType.XML);
+        ContentElement content = parse(underTest, file);
+        assertNull(content);
+    }
+
+    @Test(expected = ParseException.class)
+    public void testParseInvalidJsonWithObjectList() throws Exception {
+        file = new File("src/test/resources/invalid-test/contentWithObjectList.json");
+        ContentParser underTest = ContentParserFactory.create(ContentType.XML);
+        ContentElement content = parse(underTest, file);
+        assertNull(content);
+    }
+
+    @Test
+    public void testIgnoreResourcesProperties() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.XML,
+                new ParserOptions().ignoreResourceNames(ImmutableSet.of("header", "newslist"))
+                        .ignorePropertyNames(ImmutableSet.of("jcr:title")));
+        ContentElement content = parse(underTest, file);
+        ContentElement child = content.getChild("jcr:content");
+
+        assertEquals("Sample Homepage", child.getProperties().get("pageTitle"));
+        assertNull(child.getProperties().get("jcr:title"));
+
+        assertNull(child.getChildren().get("header"));
+        assertNull(child.getChildren().get("newslist"));
+        assertNotNull(child.getChildren().get("lead"));
+
+        assertEquals("abc", child.getProperties().get("refpro1"));
+        assertEquals("def", child.getProperties().get("pathprop1"));
+    }
+
+    @Test
+    public void testGetChild() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.XML);
+        ContentElement content = parse(underTest, file);
+        assertNull(content.getName());
+        
+        ContentElement deepChild = content.getChild("jcr:content/par/image/file/jcr:content");
+        assertEquals("jcr:content", deepChild.getName());
+        assertEquals("nt:resource", deepChild.getProperties().get("jcr:primaryType"));
+
+        ContentElement invalidChild = content.getChild("non/existing/path");
+        assertNull(invalidChild);
+
+        invalidChild = content.getChild("/jcr:content");
+        assertNull(invalidChild);
+    }
+
+}
diff --git a/src/test/resources/content-test/content.xml b/src/test/resources/content-test/content.xml
new file mode 100644
index 0000000..88be464
--- /dev/null
+++ b/src/test/resources/content-test/content.xml
@@ -0,0 +1,316 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node>
+  <primaryNodeType>app:Page</primaryNodeType>
+  <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+  <property><name>jcr:created</name><value>Thu Aug 07 2014 16:32:59 GMT+0200</value><type>Date</type></property>
+  
+  <node>
+    <name>jcr:content</name>
+    <primaryNodeType>app:PageContent</primaryNodeType>
+    <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+    <property><name>jcr:title</name><value>English</value><type>String</type></property>
+    <property><name>app:template</name><value>sample/templates/homepage</value><type>String</type></property>
+    <property><name>jcr:created</name><value>Thu Aug 07 2014 16:32:59 GMT+0200</value><type>Date</type></property>
+    <property><name>app:lastModified</name><value>Tue Apr 22 2014 15:11:24 GMT+0200</value><type>Date</type></property>
+    <property><name>dateISO8601String</name><value>2014-04-22T15:11:24.000+02:00</value><type>Date</type></property>
+    <property><name>pageTitle</name><value>Sample Homepage</value><type>String</type></property>
+    <property><name>sling:resourceType</name><value>sample/components/homepage</value><type>String</type></property>
+    <property><name>sling:resourceSuperType</name><value>sample/components/supertype</value><type>String</type></property>
+    <property><name>app:designPath</name><value>/etc/designs/sample</value><type>String</type></property>
+    <property><name>app:lastModifiedBy</name><value>admin</value><type>String</type></property>
+    <property><name>utf8Property</name><value>äöü߀</value><type>String</type></property>
+    <property><name>refpro1</name><value>abc</value><type>Reference</type></property>
+    <property><name>pathprop1</name><value>def</value><type>Path</type></property>
+    
+    <node>
+      <name>par</name>
+      <primaryNodeType>nt:unstructured</primaryNodeType>
+      <property><name>sling:resourceType</name><value>foundation/components/parsys</value><type>String</type></property>
+      <node>
+        <name>colctrl</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+        <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+        <property><name>jcr:lastModifiedBy</name><value>admin</value><type>String</type></property>
+        <property><name>layout</name><value>2;colctrl-lt0</value><type>String</type></property>
+        <property><name>jcr:created</name><value>Mon Aug 23 2010 22:02:24 GMT+0200</value><type>Date</type></property>
+        <property><name>jcr:lastModified</name><value>Mon Aug 23 2010 22:02:35 GMT+0200</value><type>Date</type></property>
+        <property><name>sling:resourceType</name><value>foundation/components/parsys/colctrl</value><type>String</type></property>
+      </node>
+      <node>
+        <name>image</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+        <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+        <property><name>fileReference</name><value>/content/dam/sample/portraits/jane_doe.jpg</value><type>String</type></property>
+        <property><name>jcr:lastModifiedBy</name><value>admin</value><type>String</type></property>
+        <property><name>jcr:created</name><value>Mon Aug 23 2010 22:03:39 GMT+0200</value><type>Date</type></property>
+        <property><name>width</name><value>340</value><type>String</type></property>
+        <property><name>jcr:lastModified</name><value>Sun Oct 31 2010 21:39:50 GMT+0100</value><type>Date</type></property>
+        <property><name>sling:resourceTyp</name><value>foundation/components/image</value><type>String</type></property>
+        <node>
+          <name>file</name>
+          <primaryNodeType>nt:file</primaryNodeType>
+          <property><name>jcr:createdB</name><value>admin</value><type>String</type></property>
+          <property><name>jcr:created</name><value>Thu Aug 07 2014 16:32:59 GMT+0200</value><type>Date</type></property>
+          <node>
+            <name>jcr:content</name>
+            <primaryNodeType>nt:resource</primaryNodeType>
+            <property><name>jcr:lastModifiedBy</name><value>anonymous</value><type>String</type></property>
+            <property><name>jcr:mimeType</name><value>image/jpeg</value><type>String</type></property>
+            <property><name>jcr:lastModified</name><value>Thu Aug 07 2014 16:32:59 GMT+0200</value><type>Date</type></property>
+            <property><name>jcr:uuid</name><value>eda76d00-b2cd-4b59-878f-c33f71ceaddc</value><type>String</type></property>
+          </node>
+        </node>
+      </node>
+      <node>
+        <name>title_1</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+        <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+        <property><name>jcr:title</name><value>Strategic Consulting</value><type>String</type></property>
+        <property><name>jcr:lastModifiedBy</name><value>admin</value><type>String</type></property>
+        <property><name>jcr:created</name><value>Mon Aug 23 2010 22:12:08 GMT+0200</value><type>Date</type></property>
+        <property><name>jcr:lastModified</name><value>Wed Oct 27 2010 21:33:24 GMT+0200</value><type>Date</type></property>
+        <property><name>sling:resourceType</name><value>sample/components/title</value><type>String</type></property>
+      </node>
+      <node>
+        <name>text_1</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+        <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+        <property><name>jcr:lastModifiedBy</name><value>admin</value><type>String</type></property>
+        <property><name>jcr:created</name><value>Sun Oct 31 2010 21:48:04 GMT+0100</value><type>Date</type></property>
+        <property><name>text</name><value><![CDATA[<p><span class="Apple-style-span" style="font-size: 12px;">In&nbsp;today's competitive market, organizations can face several key geometric challenges:</span></p>
+<ul>
+<li><span class="Apple-style-span" style="font-size: 12px;">Polyhedral Sectioning</span></li>
+<li><span class="Apple-style-span" style="font-size: 12px;">Triangulation&nbsp;</span></li>
+<li><span class="Apple-style-span" style="font-size: 12px;">Trigonometric Calculation</span></li>
+<li><span class="Apple-style-span" style="font-size: 12px;">Ruler and Compass Construction</span></li>
+</ul>
+<p><span class="Apple-style-span" style="font-size: 12px;"><br>
+Sample is ready to help your organization deal effectively with all these challenges through our award winning geometric consulting services.</span></p>
+<p style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 12px;\"><\/p>
+]]></value><type>String</type></property>
+        <property><name>jcr:lastModified</name><value>Sun Oct 31 2010 21:49:06 GMT+0100</value><type>Date</type></property>
+        <property><name>sling:resourceType</name><value>foundation/components/text</value><type>String</type></property>
+        <property><name>textIsRich</name><value>true</value><type>String</type></property>
+      </node>
+      <node>
+        <name>col_break12825937554040</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+        <property><name>controlType</name><value>break</value><type>String</type></property>
+        <property><name>sling:resourceType</name><value>foundation/components/parsys/colctrl</value><type>String</type></property>
+      </node>
+      <node>
+        <name>image_0</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+        <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+        <property><name>fileReference</name><value>/content/dam/sample/offices/clean_room.jpg</value><type>String</type></property>
+        <property><name>height</name><value>226</value><type>String</type></property>
+        <property><name>jcr:lastModifiedBy</name><value>admin</value><type>String</type></property>
+        <property><name>jcr:created</name><value>Mon Aug 23 2010 22:04:46 GMT+0200</value><type>Date</type></property>
+        <property><name>jcr:lastModified</name><value>Fri Nov 05 2010 10:38:15 GMT+0100</value><type>Date</type></property>
+        <property><name>sling:resourceType</name><value>foundation/components/image</value><type>String</type></property>
+        <property><name>imageRotate</name><value>0</value><type>String</type></property>
+        <node>
+          <name>file</name>
+          <primaryNodeType>nt:file</primaryNodeType>
+          <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+          <property><name>jcr:created</name><value>Thu Aug 07 2014 16:32:59 GMT+0200</value><type>Date</type></property>
+          <node>
+            <name>jcr:content</name>
+            <primaryNodeType>nt:resource</primaryNodeType>
+            <property><name>jcr:lastModifiedBy</name><value>anonymous</value><type>String</type></property>
+            <property><name>jcr:mimeType</name><value>image/jpeg</value><type>String</type></property>
+            <property><name>jcr:lastModified</name><value>Thu Aug 07 2014 16:32:59 GMT+0200</value><type>String</type></property>
+            <property><name>jcr:uuid</name><value>6139077f-191f-4337-aaef-55456ebe6784</value><type>String</type></property>
+          </node>
+        </node>
+      </node>
+      <node>
+        <name>title_2</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+        <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+        <property><name>jcr:title</name><value>Shape Technology</value><type>String</type></property>
+        <property><name>jcr:lastModifiedBy</name><value>admin</value><type>String</type></property>
+        <property><name>jcr:created</name><value>Mon Aug 23 2010 22:12:13 GMT+0200</value><type>Date</type></property>
+        <property><name>jcr:lastModified</name><value>Tue Oct 26 2010 21:16:29 GMT+0200</value><type>Date</type></property>
+        <property><name>sling:resourceType</name><value>sample/components/title</value><type>String</type></property>
+      </node>
+      <node>
+        <name>text_0</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+        <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+        <property><name>jcr:lastModifiedBy</name><value>admin</value><type>String</type></property>
+        <property><name>jcr:created</name><value>Mon Aug 23 2010 22:16:30 GMT+0200</value><type>Date</type></property>
+        <property><name>text</name><value><![CDATA[<p>The Sample investment in R&amp;D has done more than solidify our industry leadership role, we have now outpaced our competitors to such an extent that we are in an altogether new space.</p>
+<p>This is why our high quality polygons and polyhedra provide the only turnkey solutions across the whole range of euclidean geometry. And our mathematicians are working on the next generation of fractal curves to bring you shapes that are unthinkable today.</p>
+<p></p>
+<p></p>
+]]></value><type>String</type></property>
+        <property><name>jcr:lastModified</name><value>Mon Nov 08 2010 20:39:00 GMT+0100</value><type>Date</type></property>
+        <property><name>sling:resourceType</name><value>foundation/components/text</value><type>String</type></property>
+        <property><name>textIsRich</name><value>true</value><type>String</type></property>
+      </node>
+      <node>
+        <name>col_end12825937444810</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+        <property><name>controlType</name><value>end</value><type>String</type></property>
+        <property><name>sling:resourceType</name><value>foundation/components/parsys/colctrl</value><type>String</type></property>
+      </node>
+    </node>
+    <node>
+      <name>header</name>
+      <primaryNodeType>nt:unstructured</primaryNodeType>
+      <property><name>jcr:title</name><value>trust our experience
+to manage your business</value><type>String</type></property>
+      <property><name>imageReference</name><value>/content/dam/sample/header.png</value><type>String</type></property>
+      <property><name>text</name><value>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc eget neque. Nunc condimentum ipsum et orci. Aenean est. Cras eget diam. read more</value><type>String</type></property>
+      <property><name>sling:resourceType</name><value>sample/components/header</value><type>String</type></property>
+    </node>
+    <node>
+      <name>newslist</name>
+      <primaryNodeType>nt:unstructured</primaryNodeType>
+      <property><name>headline</name><value>trust our experience
+to manage your business</value><type>String</type></property>
+      <property><name>text</name><value>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc eget neque. Nunc condimentum ipsum et orci. Aenean est. Cras eget diam. read more</value><type>String</type></property>
+      <property><name>sling:resourceType</name><value>sample/components/listchildren</value><type>String</type></property>
+      <property><name>listroot</name><value>/content/sample/en/about/news</value><type>String</type></property>
+    </node>
+    <node>
+      <name>lead</name>
+      <primaryNodeType>nt:unstructured</primaryNodeType>
+      <property><name>jcr:title</name><value>World Leader in Applied Geometry </value><type>String</type></property>
+      <property><name>jcr:lastModifiedBy</name><value>admin</value><type>String</type></property>
+      <property><name>text</name><value>Lead Text</value><type>String</type></property>
+      <property><name>title</name><value>Lead Title</value><type>String</type></property>
+      <property><name>jcr:description</name><value>ample has been selling and servicing shapes for over 2000 years. From our beginnings as a small vendor of squares and rectangles we have grown our business into a leading global provider of platonic solids and fractals. Join us as we lead geometry into the future.</value><type>String</type></property>
+      <property><name>jcr:lastModified</name><value>Wed Jan 19 2011 14:35:29 GMT+0100</value><type>Date</type></property>
+      <property><name>sling:resourceType</name><value>sample/components/lead</value><type>String</type></property>
+      <node>
+        <name>app:annotations</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+      </node>
+    </node>
+    <node>
+      <name>image</name>
+      <primaryNodeType>nt:unstructured</primaryNodeType>
+      <property><name>jcr:lastModifiedBy</name><value>admin</value><type>String</type></property>
+      <property><name>jcr:lastModified</name><value>Wed Oct 27 2010 21:30:59 GMT+0200</value><type>Date</type></property>
+      <property><name>imageRotate</name><value>0</value><type>String</type></property>
+    </node>
+    <node>
+      <name>carousel</name>
+      <primaryNodeType>nt:unstructured</primaryNodeType>
+      <property><name>playSpeed</name><value>6000</value><type>String</type></property>
+      <property><name>jcr:lastModifiedBy</name><value>admin</value><type>String</type></property>
+      <property><name>pages</name><values><value>/content/sample/en/events/techsummit</value><value>/content/sample/en/events/userconf</value><value>/content/sample/en/events/shapecon</value><value>/content/sample/en/events/dsc</value></values><type>String</type></property>
+      <property><name>jcr:lastModified</name><value>Tue Oct 05 2010 14:14:27 GMT+0200</value><type>Date</type></property>
+      <property><name>transTime</name><value>1000</value><type>String</type></property>
+      <property><name>sling:resourceType</name><value>foundation/components/carousel</value><type>String</type></property>
+      <property><name>listFrom</name><value>static</value><type>String</type></property>
+    </node>
+    <node>
+      <name>rightpar</name>
+      <primaryNodeType>nt:unstructured</primaryNodeType>
+      <property><name>sling:resourceType</name><value>foundation/components/parsys</value><type>String</type></property>
+      <node>
+        <name>teaser</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+        <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+        <property><name>jcr:lastModifiedBy</name><value>admin</value><type>String</type></property>
+        <property><name>jcr:created</name><value>Tue Jan 25 2011 11:30:09 GMT+0100</value><type>Date</type></property>
+        <property><name>campaignpath</name><value>/content/campaigns/sample</value><type>String</type></property>
+        <property><name>jcr:lastModified</name><value>Wed Feb 02 2011 08:40:30 GMT+0100</value><type>Date</type></property>
+        <property><name>sling:resourceTyp</name><value>personalization/components/teaser</value><type>String</type></property>
+      </node>
+    </node>
+  </node>
+  <node>
+    <name>toolbar</name>
+    <primaryNodeType>app:Page</primaryNodeType>
+    <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+    <property><name>jcr:created</name><value>Thu Aug 07 2014 16:33:00 GMT+0200</value><type>String</type></property>
+    <node>
+      <name>jcr:content</name>
+      <primaryNodeType>app:PageContent</primaryNodeType>
+      <property><name>subtitle</name><value>Contains the toolbar</value><type>String</type></property>
+      <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+      <property><name>jcr:title</name><value>Toolbar</value><type>String</type></property>
+      <property><name>app:template</name><value>sample/templates/contentpage</value><type>String</type></property>
+      <property><name>jcr:created</name><value>Thu Aug 07 2014 16:33:00 GMT+0200</value><type>String</type></property>
+      <property><name>app:lastModified</name><value>Wed Aug 25 2010 22:51:02 GMT+0200</value><type>Date</type></property>
+      <property><name>hideInNav</name><value>true</value><type>Date</type></property>
+      <property><name>sling:resourceType</name><value>sample/components/contentpage</value><type>String</type></property>
+      <property><name>app:lastModifiedBy</name><value>admin</value><type>String</type></property>
+      <node>
+        <name>par</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+        <property><name>sling:resourceType</name><value>foundation/components/parsys</value><type>String</type></property>
+      </node>
+      <node>
+        <name>rightpar</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+        <property><name>sling:resourceType</name><value>foundation/components/iparsys</value><type>String</type></property>
+        <node>
+          <name>iparsys_fake_par</name>
+          <primaryNodeType>nt:unstructured</primaryNodeType>
+          <property><name>sling:resourceType</name><value>foundation/components/iparsys/par</value><type>String</type></property>
+        </node>
+      </node>
+    </node>
+    <node>
+      <name>profiles</name>
+      <primaryNodeType>app:Page</primaryNodeType>
+      <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+      <property><name>jcr:created</name><value>Thu Aug 07 2014 16:33:00 GMT+0200</value><type>Date</type></property>
+      <node>
+        <name>jcr:content</name>
+        <primaryNodeType>app:PageContent</primaryNodeType>
+        <mixinNodeType>type1</mixinNodeType>
+        <mixinNodeType>type2</mixinNodeType>
+        <property><name>jcr:createdBy</name><value>admin</value><type>String</type></property>
+        <property><name>jcr:title</name><value>Profiles</value><type>String</type></property>
+        <property><name>app:template</name><value>sample/templates/contentpage</value><type>String</type></property>
+        <property><name>jcr:created</name><value>Thu Aug 07 2014 16:33:00 GMT+0200</value><type>Date</type></property>
+        <property><name>app:lastModified</name><value>Thu Nov 05 2009 20:27:13 GMT+0100</value><type>Date</type></property>
+        <property><name>hideInNav</name><value>true</value><type>Boolean</type></property>
+        <property><name>sling:resourceType</name><value>sample/components/contentpage</value><type>String</type></property>
+        <property><name>app:lastModifiedBy</name><value>admin</value><type>String</type></property>
+        <property><name>longProp</name><value>1234567890123</value><type>Long</type></property>
+        <property><name>decimalProp</name><value>1.2345</value><type>Decimal</type></property>
+        <property><name>booleanProp</name><value>true</value><type>Boolean</type></property>
+        <property><name>longPropMulti</name><values><value>1234567890123</value><value>55</value></values><type>Long</type></property>
+        <property><name>decimalPropMulti</name><values><value>1.2345</value><value>1.1</value></values><type>Decimal</type></property>
+        <property><name>booleanPropMulti</name><values><value>true</value><value>false</value></values><type>Boolean</type></property>
+        <property><name>stringPropMulti</name><values><value>aa</value><value>bb</value><value>cc</value></values><type>String</type></property>
+        <node>
+          <name>par</name>
+          <primaryNodeType>nt:unstructured</primaryNodeType>
+          <property><name>sling:resourceType</name><value>foundation/components/parsys</value><type>String</type></property>
+          <node>
+            <name>textimage</name>
+            <primaryNodeType>nt:unstructured</primaryNodeType>
+            <property><name>sling:resourceType</name><value>foundation/components/textimage</value><type>String</type></property>
+          </node>
+          <node>
+            <name>mygadgets</name>
+            <primaryNodeType>nt:unstructured</primaryNodeType>
+            <property><name>gadgets</name><value>http://customer.meteogroup.de/meteogroup/gadgets/wetter24.xml
+http://germanweatherradar.googlecode.com/svn/trunk/german-weather-radar.xml
+http://www.digitalpowered.info/gadget/ski.pictures.xml
+http://www.canbuffi.de/gadgets/clock/clock.xml</value><type>String</type></property>
+            <property><name>sling:resourceType</name><value>personalization/components/mygadgets</value><type>String</type></property>
+          </node>
+        </node>
+        <node>
+          <name>rightpar</name>
+          <primaryNodeType>nt:unstructured</primaryNodeType>
+          <property><name>sling:resourceType</name><value>foundation/components/iparsys</value><type>String</type></property>
+          <node>
+            <name>iparsys_fake_par</name>
+            <primaryNodeType>nt:unstructured</primaryNodeType>
+            <property><name>sling:resourceType</name><value>foundation/components/iparsys/par</value><type>String</type></property>
+          </node>
+        </node>
+      </node>
+    </node>
+  </node>
+</node>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 16/38: SLING-6872 JCR Content Parser: Support tick as well as double quote when parsing JSON

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit fc6be19cd6bb939d4ff945e194ddbced20f9dcfb
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue May 23 21:03:37 2017 +0000

    SLING-6872 JCR Content Parser: Support tick as well as double quote when parsing JSON
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1795961 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |   6 ++
 .../{package-info.java => JsonParserFeature.java}  |  19 +++-
 .../sling/jcr/contentparser/ParserOptions.java     |  25 +++++
 .../jcr/contentparser/impl/JsonContentParser.java  |  47 ++++++++-
 .../jcr/contentparser/impl/JsonTicksConverter.java |  85 +++++++++++++++++
 .../sling/jcr/contentparser/package-info.java      |   2 +-
 .../contentparser/impl/JsonContentParserTest.java  |   9 ++
 .../impl/JsonContentParserTicksTest.java           | 106 +++++++++++++++++++++
 .../contentparser/impl/JsonTicksConverterTest.java |  61 ++++++++++++
 .../sling/jcr/contentparser/impl/TestUtils.java    |  10 ++
 10 files changed, 362 insertions(+), 8 deletions(-)

diff --git a/pom.xml b/pom.xml
index e889134..5df4e2f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,6 +78,12 @@
             <scope>compile</scope>
         </dependency>
         <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.4</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.johnzon</groupId>
             <artifactId>johnzon-core</artifactId>
             <version>1.0.0</version>
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/package-info.java b/src/main/java/org/apache/sling/jcr/contentparser/JsonParserFeature.java
similarity index 73%
copy from src/main/java/org/apache/sling/jcr/contentparser/package-info.java
copy to src/main/java/org/apache/sling/jcr/contentparser/JsonParserFeature.java
index 771f212..59c5a23 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/JsonParserFeature.java
@@ -16,8 +16,21 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+package org.apache.sling.jcr.contentparser;
+
 /**
- * Parser for repository content serialized e.g. as JSON or JCR XML.
+ * Feature flags for parsing JSON files.
  */
-@org.osgi.annotation.versioning.Version("1.1.0")
-package org.apache.sling.jcr.contentparser;
+public enum JsonParserFeature {
+
+    /**
+     * Support comments (&#47;* ... *&#47;) in JSON files.
+     */
+    COMMENTS,
+    
+    /**
+     * Support ticks (') additional to double quotes (") as quoting symbol for JSON names and strings. 
+     */
+    QUOTE_TICK
+    
+}
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java b/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
index e8c3939..f878745 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
@@ -20,6 +20,7 @@ package org.apache.sling.jcr.contentparser;
 
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -47,11 +48,18 @@ public final class ParserOptions {
             "jcr:uri:"
           )));
     
+    /**
+     * List of JSON parser features activated by default.
+     */
+    public static final EnumSet<JsonParserFeature> DEFAULT_JSON_PARSER_FEATURES
+        = EnumSet.of(JsonParserFeature.COMMENTS, JsonParserFeature.QUOTE_TICK);
+    
     private String defaultPrimaryType = DEFAULT_PRIMARY_TYPE;
     private boolean detectCalendarValues;
     private Set<String> ignorePropertyNames;
     private Set<String> ignoreResourceNames;
     private Set<String> removePropertyNamePrefixes = DEFAULT_REMOVE_PROPERTY_NAME_PREFIXES;
+    private EnumSet<JsonParserFeature> jsonParserFeatures = DEFAULT_JSON_PARSER_FEATURES;
     
     /**
      * Default "jcr:primaryType" property for resources that have no explicit value for this value.
@@ -121,4 +129,21 @@ public final class ParserOptions {
         return removePropertyNamePrefixes;
     }
     
+    /**
+     * Set set of features the JSON parser should apply when parsing files. 
+     * @param value JSON parser features
+     * @return this
+     */
+    public ParserOptions jsonParserFeatures(EnumSet<JsonParserFeature> value) {
+        this.jsonParserFeatures = value;
+        return this;
+    }
+    public ParserOptions jsonParserFeatures(JsonParserFeature... value) {
+        this.jsonParserFeatures = EnumSet.copyOf(Arrays.asList(value));
+        return this;
+    }
+    public EnumSet<JsonParserFeature> getJsonParserFeatures() {
+        return jsonParserFeatures;
+    }
+    
 }
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java
index 093fbec..054be85 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java
@@ -20,6 +20,7 @@ package org.apache.sling.jcr.contentparser.impl;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.StringReader;
 import java.util.Calendar;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -35,8 +36,11 @@ import javax.json.JsonString;
 import javax.json.JsonValue;
 import javax.json.stream.JsonParsingException;
 
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.CharEncoding;
 import org.apache.sling.jcr.contentparser.ContentHandler;
 import org.apache.sling.jcr.contentparser.ContentParser;
+import org.apache.sling.jcr.contentparser.JsonParserFeature;
 import org.apache.sling.jcr.contentparser.ParseException;
 import org.apache.sling.jcr.contentparser.ParserOptions;
 
@@ -54,21 +58,56 @@ public final class JsonContentParser implements ContentParser {
      */
     private final JsonReaderFactory jsonReaderFactory;
     
+    private final boolean jsonQuoteTickets;
+    
     public JsonContentParser(ParserOptions options) {
         this.helper = new ParserHelper(options);
-        // allow comments in JSON files
+        
         Map<String,Object> jsonReaderFactoryConfig = new HashMap<>();
-        jsonReaderFactoryConfig.put("org.apache.johnzon.supports-comments", true);
+        
+        // allow comments in JSON files?
+        if (options.getJsonParserFeatures().contains(JsonParserFeature.COMMENTS)) {
+            jsonReaderFactoryConfig.put("org.apache.johnzon.supports-comments", true);
+        }
+        jsonQuoteTickets = options.getJsonParserFeatures().contains(JsonParserFeature.QUOTE_TICK);
+        
         jsonReaderFactory = Json.createReaderFactory(jsonReaderFactoryConfig);
     }
     
     @Override
     public void parse(ContentHandler handler, InputStream is) throws IOException, ParseException {
+        parse(handler, toJsonObject(is), "/");
+    }
+    
+    private JsonObject toJsonObject(InputStream is) {
+        if (jsonQuoteTickets) {
+            return toJsonObjectWithJsonTicks(is);
+        }
         try (JsonReader reader = jsonReaderFactory.createReader(is)) {
-            parse(handler, reader.readObject(), "/");
+            return reader.readObject();
+        }
+        catch (JsonParsingException ex) {
+            throw new ParseException("Error parsing JSON content: " + ex.getMessage(), ex);
+        }
+    }
+
+    private JsonObject toJsonObjectWithJsonTicks(InputStream is) {
+        String jsonString;
+        try {
+            jsonString = IOUtils.toString(is, CharEncoding.UTF_8);
+        }
+        catch (IOException ex) {
+            throw new ParseException("Error getting JSON string.", ex);
+        }
+        
+        // convert ticks to double quotes
+        jsonString = JsonTicksConverter.tickToDoubleQuote(jsonString);
+        
+        try (JsonReader reader = jsonReaderFactory.createReader(new StringReader(jsonString))) {
+            return reader.readObject();
         }
         catch (JsonParsingException ex) {
-            throw new ParseException("Error parsing JSON content.", ex);
+            throw new ParseException("Error parsing JSON content: " + ex.getMessage(), ex);
         }
     }
 
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
new file mode 100644
index 0000000..6125599
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl;
+
+/**
+ * Converts JSON with ticks to JSON with quotes.
+ * <p>Conversions:</p>
+ * <ul>
+ * <li>Converts ticks ' to " when used as quotation marks for names or string values</li>
+ * <li>Within names or string values quoted with ticks, ticks have to be escaped with <code>\'</code>.
+ *     This escaping sign is removed on the conversion, because in JSON ticks must not be escaped.</li>
+ * <li>Within names or string values quoted with ticks, double quotes may or may not be escaped.
+ *     After the conversion they are always escaped.</li>
+ * </ul>
+ */
+class JsonTicksConverter {
+    
+    static String tickToDoubleQuote(final String input) {
+        final StringBuilder output = new StringBuilder();
+        boolean quoted = false;
+        boolean tickQuoted = false;
+        boolean escaped = false;
+        for (int i = 0, len = input.length(); i < len; i++) {
+            char in = input.charAt(i);
+            if (quoted || tickQuoted) {
+                if (escaped) {
+                    if (in != '\'') {
+                        output.append("\\");
+                    }
+                    escaped = false;
+                }
+                else {
+                    if (in == '"') {
+                        if (quoted) {
+                            quoted = false;
+                        }
+                        else if (tickQuoted) {
+                            output.append("\\");
+                        }
+                    }
+                    else if (in == '\'') {
+                        if (tickQuoted) {
+                            in = '"';
+                            tickQuoted = false;
+                        }
+                    }
+                    else if (in == '\\') {
+                        escaped = true;
+                    }
+                }
+            }
+            else {
+                if (in == '\'') {
+                    in = '"';
+                    tickQuoted = true;
+                }
+                else if (in == '"') {
+                    quoted = true;
+                }
+            }
+            if (in == '\\') {
+                continue;
+            }
+            output.append(in);
+        }
+        return output.toString();
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/package-info.java b/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
index 771f212..5cf33d1 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
@@ -19,5 +19,5 @@
 /**
  * Parser for repository content serialized e.g. as JSON or JCR XML.
  */
-@org.osgi.annotation.versioning.Version("1.1.0")
+@org.osgi.annotation.versioning.Version("1.2.0")
 package org.apache.sling.jcr.contentparser;
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
index 706cb6e..b8f3598 100644
--- a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
@@ -27,12 +27,14 @@ import static org.junit.Assert.assertNull;
 import java.io.File;
 import java.math.BigDecimal;
 import java.util.Calendar;
+import java.util.EnumSet;
 import java.util.Map;
 import java.util.TimeZone;
 
 import org.apache.sling.jcr.contentparser.ContentParser;
 import org.apache.sling.jcr.contentparser.ContentParserFactory;
 import org.apache.sling.jcr.contentparser.ContentType;
+import org.apache.sling.jcr.contentparser.JsonParserFeature;
 import org.apache.sling.jcr.contentparser.ParseException;
 import org.apache.sling.jcr.contentparser.ParserOptions;
 import org.apache.sling.jcr.contentparser.impl.mapsupport.ContentElement;
@@ -168,4 +170,11 @@ public class JsonContentParserTest {
         assertNull(invalidChild);
     }
 
+    @Test(expected = ParseException.class)
+    public void testFailsWithoutCommentsEnabled() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.JSON,
+                new ParserOptions().jsonParserFeatures(EnumSet.noneOf(JsonParserFeature.class)));
+        parse(underTest, file);
+    }
+
 }
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTicksTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTicksTest.java
new file mode 100644
index 0000000..1ba5e62
--- /dev/null
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTicksTest.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl;
+
+import static org.apache.sling.jcr.contentparser.impl.TestUtils.parse;
+import static org.junit.Assert.assertEquals;
+
+import java.util.EnumSet;
+import java.util.Map;
+
+import org.apache.sling.jcr.contentparser.ContentParser;
+import org.apache.sling.jcr.contentparser.ContentParserFactory;
+import org.apache.sling.jcr.contentparser.ContentType;
+import org.apache.sling.jcr.contentparser.JsonParserFeature;
+import org.apache.sling.jcr.contentparser.ParseException;
+import org.apache.sling.jcr.contentparser.ParserOptions;
+import org.apache.sling.jcr.contentparser.impl.mapsupport.ContentElement;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JsonContentParserTicksTest {
+    
+    private ContentParser underTest;
+    
+    @Before
+    public void setUp() {
+        underTest = ContentParserFactory.create(ContentType.JSON,
+                new ParserOptions().jsonParserFeatures(JsonParserFeature.QUOTE_TICK));
+    }
+
+    @Test
+    public void testJsonWithTicks() throws Exception {
+        ContentElement content = parse(underTest, "{'prop1':'value1','prop2':123,'obj':{'prop3':'value2'}}");
+
+        Map<String, Object> props = content.getProperties();
+        assertEquals("value1", props.get("prop1"));
+        assertEquals(123L, props.get("prop2"));
+        assertEquals("value2", content.getChild("obj").getProperties().get("prop3"));
+    }
+
+    @Test
+    public void testJsonWithTicksMixed() throws Exception {
+        ContentElement content = parse(underTest, "{\"prop1\":'value1','prop2':123,'obj':{'prop3':\"value2\"}}");
+
+        Map<String, Object> props = content.getProperties();
+        assertEquals("value1", props.get("prop1"));
+        assertEquals(123L, props.get("prop2"));
+        assertEquals("value2", content.getChild("obj").getProperties().get("prop3"));
+    }
+
+    @Test
+    public void testTicksDoubleQuotesInDoubleQuotes() throws Exception {
+        ContentElement content = parse(underTest, "{\"prop1\":\"'\\\"\'\\\"\"}");
+
+        Map<String, Object> props = content.getProperties();
+        assertEquals("'\"'\"", props.get("prop1"));
+    }
+
+    @Test
+    public void testTicksDoubleQuotesInTicks() throws Exception {
+        ContentElement content = parse(underTest, "{'prop1':'\\'\\\"\\\'\\\"'}");
+
+        Map<String, Object> props = content.getProperties();
+        assertEquals("'\"'\"", props.get("prop1"));
+    }
+
+    @Test
+    public void testWithUtf8Escaped() throws Exception {
+        ContentElement content = parse(underTest, "{\"prop1\":\"\\u03A9\\u03A6\\u00A5\"}");
+
+        Map<String, Object> props = content.getProperties();
+        assertEquals("\u03A9\u03A6\u00A5", props.get("prop1"));
+    }
+
+    @Test
+    public void testWithTicksUtf8Escaped() throws Exception {
+        ContentElement content = parse(underTest, "{'prop1':'\\u03A9\\u03A6\\u00A5'}");
+
+        Map<String, Object> props = content.getProperties();
+        assertEquals("\u03A9\u03A6\u00A5", props.get("prop1"));
+    }
+
+    @Test(expected = ParseException.class)
+    public void testFailsWihtoutFeatureEnabled() throws Exception {
+        underTest = ContentParserFactory.create(ContentType.JSON,
+                new ParserOptions().jsonParserFeatures(EnumSet.noneOf(JsonParserFeature.class)));
+        parse(underTest, "{'prop1':'value1','prop2':123,'obj':{'prop3':'value2'}}");
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java
new file mode 100644
index 0000000..836d1a8
--- /dev/null
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import static org.apache.sling.jcr.contentparser.impl.JsonTicksConverter.*;
+
+public class JsonTicksConverterTest {
+
+    @Test
+    public void testNoConvert() {
+        assertEquals("{\"p\":\"v\"}", tickToDoubleQuote("{\"p\":\"v\"}"));
+    }
+
+    @Test
+    public void testTickToQuote() {
+        assertEquals("{\"p\":\"v\"}", tickToDoubleQuote("{'p':\"v\"}"));
+    }
+
+    @Test
+    public void testTickToQuoteMixed() {
+        assertEquals("{\"p\":\"v\"}", tickToDoubleQuote("{'p':\"v\"}"));
+        assertEquals("{\"p\":\"v\"}", tickToDoubleQuote("{\"p\":'v'}"));
+    }
+
+    @Test
+    public void testTicksDoubleQuotesInDoubleQuotes() {
+        assertEquals("{\"p\":\"'\\\"'\\\"\"}", tickToDoubleQuote("{\"p\":\"'\\\"'\\\"\"}"));
+    }
+
+    @Test
+    public void testTicksDoubleQuotesInTicks() {
+        assertEquals("{\"p\":\"'\\\"'\\\"\"}", tickToDoubleQuote("{\"p\":'\\'\\\"\\'\\\"'}"));
+        assertEquals("{\"p\":\"'\\\"'\\\"\"}", tickToDoubleQuote("{\"p\":'\\'\"\\'\"'}"));
+    }
+
+    @Test
+    public void testTickToQuoteWithUtf8Escaped() {
+        assertEquals("{\"p\":\"\\u03A9\\u03A6\\u00A5\"}", tickToDoubleQuote("{'p':\"\\u03A9\\u03A6\\u00A5\"}"));
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java
index be395b9..0908a47 100644
--- a/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java
@@ -19,10 +19,12 @@
 package org.apache.sling.jcr.contentparser.impl;
 
 import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 
+import org.apache.commons.lang3.CharEncoding;
 import org.apache.sling.jcr.contentparser.ContentParser;
 import org.apache.sling.jcr.contentparser.impl.mapsupport.ContentElement;
 import org.apache.sling.jcr.contentparser.impl.mapsupport.ContentElementHandler;
@@ -42,4 +44,12 @@ public final class TestUtils {
         }
     }
     
+    public static ContentElement parse(ContentParser contentParser, String jsonContent) throws IOException {
+        try (ByteArrayInputStream is = new ByteArrayInputStream(jsonContent.getBytes(CharEncoding.UTF_8))) {
+            ContentElementHandler handler = new ContentElementHandler();
+            contentParser.parse(handler, is);
+            return handler.getRoot();
+        }
+    }
+    
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 18/38: declare johnzon dependency as "test"

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit 9c468aac3f3cc6b63990cba76e745870f9236e75
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue May 23 21:41:52 2017 +0000

    declare johnzon dependency as "test"
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1795972 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5df4e2f..6f2cb49 100644
--- a/pom.xml
+++ b/pom.xml
@@ -84,12 +84,6 @@
             <scope>compile</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.johnzon</groupId>
-            <artifactId>johnzon-core</artifactId>
-            <version>1.0.0</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-json_1.0_spec</artifactId>
             <version>1.0-alpha-1</version>
@@ -129,5 +123,11 @@
             <version>15.0</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.johnzon</groupId>
+            <artifactId>johnzon-core</artifactId>
+            <version>1.0.0</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-contentparser] 01/38: SLING-6592 move and rename to jcr/contentparser, change java package and class names accordingly

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit b485a57111f9226affe2b7c1b9384f772cf6da2c
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Mar 14 10:41:47 2017 +0000

    SLING-6592 move and rename to jcr/contentparser, change java package and class names accordingly
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1786869 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 127 ++++++++++
 .../sling/jcr/contentparser/ContentParser.java     |  50 ++++
 .../jcr/contentparser/ContentParserFactory.java    |  59 +++++
 .../sling/jcr/contentparser/ContentType.java       |  50 ++++
 .../sling/jcr/contentparser/ParseException.java    |  42 ++++
 .../sling/jcr/contentparser/ParserOptions.java     | 116 +++++++++
 .../contentparser/impl/JcrXmlContentParser.java    | 158 ++++++++++++
 .../contentparser/impl/JcrXmlValueConverter.java   | 149 ++++++++++++
 .../jcr/contentparser/impl/JsonContentParser.java  | 138 +++++++++++
 .../sling/jcr/contentparser/impl/ParserHelper.java | 134 +++++++++++
 .../sling/jcr/contentparser/package-info.java      |  23 ++
 .../impl/JcrXmlContentParserTest.java              | 129 ++++++++++
 .../impl/JcrXmlValueConverterTest.java             | 123 ++++++++++
 .../contentparser/impl/JsonContentParserTest.java  | 153 ++++++++++++
 .../jcr/contentparser/impl/ParserHelperTest.java   | 199 ++++++++++++++++
 .../sling/jcr/contentparser/impl/TestUtils.java    |  48 ++++
 src/test/resources/content-test/content.jcr.xml    | 194 +++++++++++++++
 src/test/resources/content-test/content.json       | 264 +++++++++++++++++++++
 .../invalid-test/contentWithObjectList.json        |  14 ++
 src/test/resources/invalid-test/invalid.jcr.xml    |   1 +
 src/test/resources/invalid-test/invalid.json       |   1 +
 21 files changed, 2172 insertions(+)

diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..e092a3a
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>30</version>
+        <relativePath />
+    </parent>
+
+    <artifactId>org.apache.sling.jcr.contentparser</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+
+    <name>Apache Sling Content Parser</name>
+    <description>
+        Parser for JCR repository content stored in files (e.g. JSON, FileVault XML).
+    </description>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentparser</url>
+    </scm>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                      <exclude>src/test/resources/content-test/**</exclude>
+                      <exclude>src/test/resources/invalid-test/**</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.3.2</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+            <version>3.2.1</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.johnzon</groupId>
+            <artifactId>johnzon-core</artifactId>
+            <version>1.0.0</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-json_1.0_spec</artifactId>
+            <version>1.0-alpha-1</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-api</artifactId>
+            <version>2.8.0</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-jcr-commons</artifactId>
+            <version>2.8.0</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit.vault</groupId>
+            <artifactId>org.apache.jackrabbit.vault</artifactId>
+            <version>3.1.18</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>15.0</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java
new file mode 100644
index 0000000..cb6d013
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentParser.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+
+/**
+ * Parses repository content from a file.
+ * Implementations have to be thread-safe.
+ */
+public interface ContentParser {
+
+    /**
+     * Parse content file.
+     * @param file File
+     * @return Content
+     * @throws IOException When I/O error occurs.
+     * @throws ParseException When parsing error occurs.
+     */
+    Map<String,Object> parse(File file) throws IOException, ParseException;
+    
+    /**
+     * Parse content.
+     * @param is Stream with serialized content
+     * @return Content as Map
+     * @throws IOException When I/O error occurs.
+     * @throws ParseException When parsing error occurs.
+     */
+    Map<String,Object> parse(InputStream is) throws IOException, ParseException;
+
+}
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java
new file mode 100644
index 0000000..7ae64e2
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentParserFactory.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser;
+
+import org.apache.sling.jcr.contentparser.impl.JcrXmlContentParser;
+import org.apache.sling.jcr.contentparser.impl.JsonContentParser;
+
+/**
+ * Factory for content file parsers.
+ */
+public final class ContentParserFactory {
+
+    private ContentParserFactory() {
+        // static methods only
+    }
+    
+    /**
+     * Create content parser.
+     * @param type Content type
+     * @return Content parser
+     */
+    public static ContentParser create(ContentType type) {
+        return create(type, new ParserOptions());
+    }
+    
+    /**
+     * Create content parser.
+     * @param type Content type
+     * @param options Parser options
+     * @return Content parser
+     */
+    public static ContentParser create(ContentType type, ParserOptions options) {
+        switch (type) {
+            case JSON:
+                return new JsonContentParser(options);
+            case JCR_XML:
+                return new JcrXmlContentParser(options);
+            default:
+                throw new IllegalArgumentException("Unsupported type: " + type);
+        }
+    }
+    
+}
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java b/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
new file mode 100644
index 0000000..167722f
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ContentType.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser;
+
+/**
+ * Content types.
+ */
+public enum ContentType {
+
+    /**
+     * JSON content.
+     */
+    JSON("json"),
+
+    /**
+     * JCR XML content.
+     */
+    JCR_XML("jcr.xml");
+
+
+    private final String extension;
+
+    private ContentType(String extension) {
+        this.extension = extension;
+    }
+
+    /**
+     * @return Extension
+     */
+    public String getExtension() {
+        return extension;
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ParseException.java b/src/main/java/org/apache/sling/jcr/contentparser/ParseException.java
new file mode 100644
index 0000000..4df0160
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ParseException.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser;
+
+/**
+ * Parsing exception.
+ */
+public final class ParseException extends RuntimeException {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * @param message Message
+     */
+    public ParseException(String message) {
+        super(message);
+    }
+    
+    /**
+     * @param message Message
+     * @param cause Cause
+     */
+    public ParseException(String message, Throwable cause) {
+        super(message, cause);
+    }
+    
+}
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java b/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
new file mode 100644
index 0000000..0911dac
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/contentparser/ParserOptions.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Options for content filer parser.
+ */
+public final class ParserOptions {
+    
+    /**
+     * Default primary type.
+     */
+    public static final String DEFAULT_PRIMARY_TYPE = "nt:unstructured";
+
+    /**
+     * Default list of prefixes to remove from property names.
+     */
+    public static final Set<String> DEFAULT_REMOVE_PROPERTY_NAME_PREFIXES
+            = Collections.unmodifiableSet(new HashSet<>(Arrays.asList("jcr:reference:", "jcr:path:")));
+    
+    private String defaultPrimaryType = DEFAULT_PRIMARY_TYPE;
+    private boolean detectCalendarValues;
+    private Set<String> ignorePropertyNames;
+    private Set<String> ignoreResourceNames;
+    private Set<String> removePropertyNamePrefixes = DEFAULT_REMOVE_PROPERTY_NAME_PREFIXES;
+    
+    /**
+     * Default "jcr:primaryType" property for resources that have no explicit value for this value.
+     * If set to null, not default type is applied.
+     * @param value Default primary type.
+     * @return this
+     */
+    public ParserOptions defaultPrimaryType(String value) {
+        this.defaultPrimaryType = value;
+        return this;
+    }
+    public String getDefaultPrimaryType() {
+        return defaultPrimaryType;
+    }
+
+    /**
+     * Some content file formats like JSON do not contain information to identify date/time values.
+     * Instead they have to be detected by heuristics by trying to parse every string value.
+     * This mode is disabled by default.
+     * @param value Activate calendar value detection
+     * @return this
+     */
+    public ParserOptions detectCalendarValues(boolean value) {
+        this.detectCalendarValues = value;
+        return this;
+    }
+    public boolean isDetectCalendarValues() {
+        return detectCalendarValues;
+    }
+
+    /**
+     * Set a list of property names that should be ignored when parsing the content file.
+     * @param value List of property names 
+     * @return this
+     */
+    public ParserOptions ignorePropertyNames(Set<String> value) {
+        this.ignorePropertyNames = value;
+        return this;
+    }
+    public Set<String> getIgnorePropertyNames() {
+        return ignorePropertyNames;
+    }
+
+    /**
+     * Set a list of resource/node names that should be ignored when parsing the content file.
+     * @param value List of resource/node names
+     * @return this
+     */
+    public ParserOptions ignoreResourceNames(Set<String> value) {
+        this.ignoreResourceNames = value;
+        return this;
+    }
+    public Set<String> getIgnoreResourceNames() {
+        return ignoreResourceNames;
+    }
+
+    /**
+     * Set a list of property name prefixes that should be removed automatically from the property name. 
+     * @param value List of property name prefixes
+     * @return this
+     */
+    public ParserOptions removePropertyNamePrefixes(Set<String> value) {
+        this.removePropertyNamePrefixes = value;
+        return this;
+    }
+    public Set<String> getRemovePropertyNamePrefixes() {
+        return removePropertyNamePrefixes;
+    }
+    
+}
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParser.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParser.java
new file mode 100644
index 0000000..dde8c16
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParser.java
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Stack;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.apache.jackrabbit.util.ISO9075;
+import org.apache.sling.jcr.contentparser.ContentParser;
+import org.apache.sling.jcr.contentparser.ParseException;
+import org.apache.sling.jcr.contentparser.ParserOptions;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * Parses JCR XML files that contains content fragments.
+ * Instance of this class is thread-safe.
+ */
+public final class JcrXmlContentParser implements ContentParser {
+    
+    private final ParserHelper helper;    
+    private final SAXParserFactory saxParserFactory;
+    
+    public JcrXmlContentParser(ParserOptions options) {
+        this.helper = new ParserHelper(options);
+        saxParserFactory = SAXParserFactory.newInstance();
+        saxParserFactory.setNamespaceAware(true);
+    }
+    
+    @Override
+    public Map<String,Object> parse(File file) throws IOException, ParseException {
+        try (FileInputStream fis = new FileInputStream(file)) {
+            return parse(fis);
+        }
+    }
+    
+    @Override
+    public Map<String,Object> parse(InputStream is) throws IOException, ParseException {
+        try {
+            XmlHandler xmlHandler = new XmlHandler();
+            SAXParser parser = saxParserFactory.newSAXParser();
+            parser.parse(is, xmlHandler);
+            if (xmlHandler.hasError()) {
+                throw xmlHandler.getError();
+            }
+            return xmlHandler.getContent();
+        }
+        catch (ParserConfigurationException | SAXException ex) {
+            throw new ParseException("Error parsing JCR XML content.", ex);
+        }
+    }
+    
+    /**
+     * Decodes element or attribute names.
+     * @param qname qname
+     * @return Decoded name
+     */
+    static String decodeName(String qname) {
+        return ISO9075.decode(qname);
+    }
+    
+    /**
+     * Parses XML stream to Map.
+     */
+    class XmlHandler extends DefaultHandler {
+        private final Map<String,Object> content = new LinkedHashMap<>();
+        private final Stack<Map<String,Object>> elements = new Stack<>();
+        private SAXParseException error;
+        
+        public Map<String,Object> getContent() {
+            return content;
+        }
+        
+        public boolean hasError() {
+            return error != null;
+        }
+        
+        public SAXParseException getError() {
+            return error;
+        }
+
+        @Override
+        public void startElement(String uri, String localName, String qName, Attributes attributes)
+                throws SAXException {
+            
+            // prepare map for element
+            Map<String,Object> element;
+            if (elements.isEmpty()) {
+                element = content;
+            }
+            else {
+                element = new HashMap<>();
+                String resourceName = decodeName(qName);
+                if (!helper.ignoreResource(resourceName)) {
+                    elements.peek().put(resourceName, element);
+                }
+            }
+            elements.push(element);
+            
+            // get attributes
+            for (int i=0; i<attributes.getLength(); i++) {
+                String propertyName = helper.cleanupPropertyName(decodeName(attributes.getQName(i)));
+                if (!helper.ignoreProperty(propertyName)) {
+                    Object value = JcrXmlValueConverter.parseValue(propertyName, attributes.getValue(i));
+                    if (value != null) {
+                        element.put(propertyName, value);
+                    }
+                }
+            }
+        }
+
+        @Override
+        public void endElement(String uri, String localName, String qName) throws SAXException {
+            Map<String,Object> element = elements.pop();
+            helper.ensureDefaultPrimaryType(element);
+        }
+
+        @Override
+        public void error(SAXParseException ex) throws SAXException {
+            this.error = ex;
+        }
+
+        @Override
+        public void fatalError(SAXParseException ex) throws SAXException {
+            this.error = ex;
+        }
+        
+    }
+    
+}
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JcrXmlValueConverter.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/JcrXmlValueConverter.java
new file mode 100644
index 0000000..f4cdfc4
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JcrXmlValueConverter.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl;
+
+import java.lang.reflect.Array;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Calendar;
+import java.util.UUID;
+
+import javax.jcr.PropertyType;
+
+import org.apache.jackrabbit.util.ISO8601;
+import org.apache.jackrabbit.vault.util.DocViewProperty;
+
+/**
+ * Parses JCR XML files that contains content fragments.
+ */
+class JcrXmlValueConverter {
+    
+    private JcrXmlValueConverter() {
+        // static methods only
+    }
+    
+    /**
+     * Parse JSON value from XML Attribute.
+     * @param value XML attribute value
+     * @return Value object
+     */
+    public static Object parseValue(final String name, final String value) {
+        if (value == null) {
+            return null;
+        }
+        DocViewProperty prop = DocViewProperty.parse(name, value);
+        
+        // convert values
+        if (prop.isMulti) {
+            Class<?> arrayType = getType(prop.type);
+            if (arrayType == null) {
+                return null;
+            }
+            Object result = Array.newInstance(arrayType, prop.values.length);
+            for (int i=0; i<prop.values.length; i++) {
+                Array.set(result, i, convertValue(prop.values[i], prop.type, true));
+            }
+            return result;
+        }
+        else {
+            return convertValue(prop.values[0], prop.type, false);
+        }
+    }
+    
+    /**
+     * Parse value depending on type prefix.
+     * @param value Value
+     * @param type Type
+     * @param inArray Value is in array
+     * @return Value object
+     */
+    private static Object convertValue(final String value, final int type, final boolean inArray) {
+        switch (type) {
+            case PropertyType.UNDEFINED:
+            case PropertyType.STRING:
+            case PropertyType.NAME:
+            case PropertyType.PATH:
+                return value;
+            case PropertyType.BOOLEAN:
+                return Boolean.valueOf(value);
+            case PropertyType.LONG:
+                return Long.valueOf(value);
+            case PropertyType.DOUBLE:
+                return Double.valueOf(value);
+            case PropertyType.DECIMAL:
+                return new BigDecimal(value);
+            case PropertyType.DATE:
+                return ISO8601.parse(value);
+            case PropertyType.REFERENCE:
+            case PropertyType.WEAKREFERENCE:
+                return UUID.fromString(value);
+            case PropertyType.URI:
+                try {
+                    return new URI(value);
+                }
+                catch (URISyntaxException ex) {
+                    throw new IllegalArgumentException("Unexpected URI syntax: " + value);
+                }
+            case PropertyType.BINARY:
+                // not supported - ignore value
+                return null;
+            default:
+                throw new IllegalArgumentException("Unexpected type: " + PropertyType.nameFromValue(type));
+            
+        }
+    }
+    
+    /**
+     * Get java type for given JCR type.
+     * @param type Type
+     * @return Type
+     */
+    private static Class<?> getType(final int type) {
+        switch (type) {
+            case PropertyType.UNDEFINED:
+            case PropertyType.STRING:
+            case PropertyType.NAME:
+            case PropertyType.PATH:
+                return String.class;
+            case PropertyType.BOOLEAN:
+                return Boolean.class;
+            case PropertyType.LONG:
+                return Long.class;
+            case PropertyType.DOUBLE:
+                return Double.class;
+            case PropertyType.DECIMAL:
+                return BigDecimal.class;
+            case PropertyType.DATE:
+                return Calendar.class;
+            case PropertyType.REFERENCE:
+            case PropertyType.WEAKREFERENCE:
+                return UUID.class;
+            case PropertyType.URI:
+                return URI.class;
+            case PropertyType.BINARY:
+                // not supported - ignore value
+                return null;
+            default:
+                throw new IllegalArgumentException("Unexpected type: " + PropertyType.nameFromValue(type));
+            
+        }
+    }
+    
+}
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java
new file mode 100644
index 0000000..b070701
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import javax.json.Json;
+import javax.json.JsonArray;
+import javax.json.JsonNumber;
+import javax.json.JsonObject;
+import javax.json.JsonReader;
+import javax.json.JsonReaderFactory;
+import javax.json.JsonString;
+import javax.json.JsonValue;
+import javax.json.stream.JsonParsingException;
+
+import org.apache.sling.jcr.contentparser.ContentParser;
+import org.apache.sling.jcr.contentparser.ParseException;
+import org.apache.sling.jcr.contentparser.ParserOptions;
+
+/**
+ * Parses JSON files that contains content fragments.
+ * Instance of this class is thread-safe.
+ */
+public final class JsonContentParser implements ContentParser {
+    
+    private final ParserHelper helper;    
+    private final JsonReaderFactory jsonReaderFactory;
+    
+    public JsonContentParser(ParserOptions options) {
+        this.helper = new ParserHelper(options);
+        // allow comments in JSON files
+        Map<String,Object> jsonReaderFactoryConfig = new HashMap<>();
+        jsonReaderFactoryConfig.put("org.apache.johnzon.supports-comments", true);
+        jsonReaderFactory = Json.createReaderFactory(jsonReaderFactoryConfig);
+    }
+    
+    @Override
+    public Map<String,Object> parse(File file) throws IOException, ParseException {
+        try (FileInputStream fis = new FileInputStream(file)) {
+            return parse(fis);
+        }
+    }
+    
+    @Override
+    public Map<String,Object> parse(InputStream is) throws IOException, ParseException {
+        try (JsonReader reader = jsonReaderFactory.createReader(is)) {
+            return toMap(reader.readObject());
+        }
+        catch (JsonParsingException ex) {
+            throw new ParseException("Error parsing JSON content.", ex);
+        }
+    }
+    
+    private Map<String,Object> toMap(JsonObject object) {
+        Map<String,Object> map = new LinkedHashMap<>();
+        for (Map.Entry<String, JsonValue> entry : object.entrySet()) {
+            String childName = entry.getKey();
+            Object value = convertValue(entry.getValue());
+            boolean ignore = false;
+            if (value instanceof Map) {
+                ignore = helper.ignoreResource(childName);
+            }
+            else {
+                childName = helper.cleanupPropertyName(childName);
+                ignore = helper.ignoreProperty(childName);
+            }
+            if (!ignore) {
+                map.put(childName, value);
+            }
+        }
+        helper.ensureDefaultPrimaryType(map);
+        return map;
+    }
+    
+    private Object convertValue(JsonValue value) {
+        switch (value.getValueType()) {
+            case STRING:
+                String stringValue = ((JsonString)value).getString();
+                Calendar calendarValue = helper.tryParseCalendar(stringValue);
+                if (calendarValue != null) {
+                    return calendarValue;
+                }
+                else {
+                    return stringValue;
+                }
+            case NUMBER:
+                JsonNumber numberValue = (JsonNumber)value;
+                if (numberValue.isIntegral()) {
+                    return numberValue.longValue();
+                }
+                else {
+                    return numberValue.bigDecimalValue();
+                }
+            case TRUE:
+                return true;
+            case FALSE:
+                return false;
+            case NULL:
+                return null;
+            case ARRAY:
+                JsonArray arrayValue = (JsonArray)value;
+                Object[] values = new Object[arrayValue.size()];
+                for (int i=0; i<values.length; i++) {
+                    values[i] = convertValue(arrayValue.get(i));
+                }
+                return helper.convertSingleTypeArray(values);
+            case OBJECT:
+                return toMap((JsonObject)value);
+            default:
+                throw new ParseException("Unexpected JSON value type: " + value.getValueType());
+        }
+    }
+    
+}
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/ParserHelper.java b/src/main/java/org/apache/sling/jcr/contentparser/impl/ParserHelper.java
new file mode 100644
index 0000000..160cd0e
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/ParserHelper.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl;
+
+import java.lang.reflect.Array;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.sling.jcr.contentparser.ParseException;
+import org.apache.sling.jcr.contentparser.ParserOptions;
+
+/**
+ * Helper parsing logic based on parser options.
+ */
+class ParserHelper {
+
+    static final String JCR_PRIMARYTYPE = "jcr:primaryType";
+
+    static final String ECMA_DATE_FORMAT = "EEE MMM dd yyyy HH:mm:ss 'GMT'Z";
+    static final Locale DATE_FORMAT_LOCALE = Locale.US;
+
+    private final ParserOptions options;
+    private final DateFormat calendarFormat;
+
+    public ParserHelper(ParserOptions options) {
+        this.options = options;
+        if (options.isDetectCalendarValues()) {
+            this.calendarFormat = new SimpleDateFormat(ECMA_DATE_FORMAT, DATE_FORMAT_LOCALE);
+        }
+        else {
+            this.calendarFormat = null;
+        }
+    }
+
+    public void ensureDefaultPrimaryType(Map<String, Object> map) {
+        String defaultPrimaryType = options.getDefaultPrimaryType();
+        if (defaultPrimaryType != null) {
+            if (!map.containsKey(JCR_PRIMARYTYPE)) {
+                map.put(JCR_PRIMARYTYPE, defaultPrimaryType);
+            }
+        }
+    }
+
+    public Calendar tryParseCalendar(String value) {
+        if (options.isDetectCalendarValues() && !StringUtils.isBlank(value)) {
+            synchronized (calendarFormat) {
+                try {
+                    Date date = calendarFormat.parse(value);
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(date);
+                    return calendar;
+                }
+                catch (java.text.ParseException ex) {
+                    // ignore
+                }
+            }
+        }
+        return null;
+    }
+    
+    public boolean ignoreProperty(String propertyName) {
+        return ignoreNames(options.getIgnorePropertyNames(), propertyName);
+    }
+    
+    public boolean ignoreResource(String resourceName) {
+        return ignoreNames(options.getIgnoreResourceNames(), resourceName);
+    }
+    
+    private boolean ignoreNames(Set<String> names, String name) {
+        return names != null && names.contains(name);
+    }
+
+    public String cleanupPropertyName(String propertyName) {
+        Set<String> prefixes = options.getRemovePropertyNamePrefixes();
+        if (prefixes != null) {
+            for (String prefix : prefixes) {
+                if (StringUtils.startsWith(propertyName, prefix)) {
+                    return StringUtils.substringAfter(propertyName, prefix);
+                  }
+            }
+        }
+        return propertyName;
+    }
+    
+    public Object convertSingleTypeArray(Object[] values) {
+        if (values.length == 0) {
+            return values;
+        }
+        Class<?> itemType = null;
+        for (Object value : values) {
+            if (value == null) {
+                throw new ParseException("Multivalue array must not contain null values.");
+            }
+            if (value instanceof Map) {
+                throw new ParseException("Multivalue array must not contain maps/objects.");
+            }
+            if (itemType == null) {
+                itemType = value.getClass();
+            }
+            else if (itemType != value.getClass()) {
+                throw new ParseException("Multivalue array must not contain values with different types "
+                        + "(" + itemType.getName() + ", " + value.getClass().getName() + ").");
+            }
+        }
+        Object convertedArray = Array.newInstance(itemType, values.length);
+        for (int i=0; i<values.length; i++) {
+            Array.set(convertedArray, i, values[i]);
+        }
+        return convertedArray;
+    }
+    
+}
diff --git a/src/main/java/org/apache/sling/jcr/contentparser/package-info.java b/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
new file mode 100644
index 0000000..21b7f41
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/contentparser/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Parser for repository content stored in files (e.g. JSON, JCR XML).
+ */
+@org.osgi.annotation.versioning.Version("1.0.0")
+package org.apache.sling.jcr.contentparser;
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParserTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParserTest.java
new file mode 100644
index 0000000..d99a025
--- /dev/null
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JcrXmlContentParserTest.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl;
+
+import static org.apache.sling.jcr.contentparser.impl.TestUtils.getDeep;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.io.File;
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Map;
+import java.util.TimeZone;
+
+import org.apache.jackrabbit.util.ISO9075;
+import org.apache.sling.jcr.contentparser.ContentParser;
+import org.apache.sling.jcr.contentparser.ContentParserFactory;
+import org.apache.sling.jcr.contentparser.ContentType;
+import org.apache.sling.jcr.contentparser.ParseException;
+import org.apache.sling.jcr.contentparser.ParserOptions;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+public class JcrXmlContentParserTest {
+
+    private File file;
+
+    @Before
+    public void setUp() throws Exception {
+        file = new File("src/test/resources/content-test/content.jcr.xml");
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testParseJcrXml() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML);
+        Map<String,Object> content = underTest.parse(file);
+        assertNotNull(content);
+        assertEquals("app:Page", content.get("jcr:primaryType"));
+        assertEquals("app:PageContent", ((Map<String,Object>)content.get("jcr:content")).get("jcr:primaryType"));
+    }
+
+    @Test(expected=ParseException.class)
+    public void testParseInvalidJcrXml() throws Exception {
+        file = new File("src/test/resources/invalid-test/invalid.jcr.xml");
+        ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML);
+        underTest.parse(file);
+    }
+
+    @Test
+    public void testDataTypes() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML);
+        Map<String,Object> content = underTest.parse(file);
+        Map<String,Object> props = getDeep(content, "jcr:content");
+        
+        assertEquals("en", props.get("jcr:title"));
+        assertEquals(true, props.get("includeAside"));
+        assertEquals((Long)1234567890123L, props.get("longProp"));
+        assertEquals(new BigDecimal("1.2345"), props.get("decimalProp"));
+        
+        assertArrayEquals(new String[] { "aa", "bb", "cc" }, (String[])props.get("stringPropMulti"));
+        assertArrayEquals(new Long[] { 1234567890123L, 55L }, (Long[])props.get("longPropMulti"));
+        
+        Calendar calendar = (Calendar)props.get("dateProp");
+        calendar.setTimeZone(TimeZone.getTimeZone("GMT+2"));
+        assertEquals(2014, calendar.get(Calendar.YEAR));
+        assertEquals(9, calendar.get(Calendar.MONTH) + 1);
+        assertEquals(19, calendar.get(Calendar.DAY_OF_MONTH));
+        assertEquals(21, calendar.get(Calendar.HOUR_OF_DAY));
+        assertEquals(20, calendar.get(Calendar.MINUTE));
+        assertEquals(26, calendar.get(Calendar.SECOND));
+        assertEquals(812, calendar.get(Calendar.MILLISECOND));
+    }
+
+    @Test
+    public void testDecodeName() {
+        assertEquals("jcr:title", JcrXmlContentParser.decodeName("jcr:" + ISO9075.encode("title")));
+        assertEquals("sling:123", JcrXmlContentParser.decodeName("sling:" + ISO9075.encode("123")));
+    }
+
+    @Test
+    public void testIgnoreResourcesProperties() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML, new ParserOptions()
+                .ignoreResourceNames(ImmutableSet.of("teaserbar", "aside"))
+                .ignorePropertyNames(ImmutableSet.of("longProp", "jcr:title")));
+        Map<String,Object> content = underTest.parse(file);
+        Map<String,Object> props = getDeep(content, "jcr:content");
+        
+        assertEquals("HOME", props.get("navTitle"));
+        assertNull(props.get("jcr:title"));
+        assertNull(props.get("longProp"));
+        
+        assertNull(props.get("teaserbar"));
+        assertNull(props.get("aside"));
+        assertNotNull(props.get("content"));
+    }
+
+    @Test
+    @Ignore
+    public void testSameNamePropertyAndSubResource() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.JCR_XML);
+        Map<String,Object> content = underTest.parse(file);
+        Map<String,Object> props = getDeep(content, "jcr:content/teaserbar");
+        // teaserbaritem is a direct property as well as a sub resource
+        assertEquals("test", props.get("teaserbaritem"));
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JcrXmlValueConverterTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JcrXmlValueConverterTest.java
new file mode 100644
index 0000000..c3ec747
--- /dev/null
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JcrXmlValueConverterTest.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl;
+
+import static org.apache.sling.jcr.contentparser.impl.JcrXmlValueConverter.parseValue;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.UUID;
+
+import org.junit.Test;
+
+public class JcrXmlValueConverterTest {
+    
+    private static final String NAME = "prop1";
+
+    @Test
+    public void testNull() {
+        assertNull(parseValue(NAME, null));
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testInvalid() {
+        parseValue(NAME, "{InvalidType}xyz");
+    }
+
+    @Test
+    public void testString() {
+        assertEquals("myString", parseValue(NAME, "myString"));
+        assertEquals("prop", "myString [ ] { } \\ ,", parseValue(NAME, "myString [ ] { } \\\\ ,"));
+        assertEquals("{myString}", parseValue(NAME, "\\{myString}"));
+        assertEquals("aaa{myString}", parseValue(NAME, "aaa{myString}"));
+        assertEquals("[myString]", parseValue(NAME, "\\[myString]"));
+        assertEquals("aaa[myString]", parseValue(NAME, "aaa[myString]"));
+    }
+
+    @Test
+    public void testStringArray() {
+        assertArrayEquals(new Object[] { "myString1", "myString2" }, (Object[]) parseValue(NAME, "[myString1,myString2]"));
+        assertArrayEquals(new Object[] { "myString1,[]\\äöü߀", "myString2", "myString3 [ ] { } \\ ,", "", "[myString5]", "{myString6}" },
+                (Object[]) parseValue(NAME, "[myString1\\,[]\\\\äöü߀,myString2,myString3 [ ] { } \\\\ \\,,,[myString5],{myString6}]"));
+    }
+
+    @Test
+    public void testBoolean() {
+        assertEquals(true, parseValue(NAME, "{Boolean}true"));
+        assertEquals(false, parseValue(NAME, "{Boolean}false"));
+    }
+
+    @Test
+    public void testBooleanArray() {
+        assertArrayEquals(new Object[] { true, false }, (Object[]) parseValue(NAME, "{Boolean}[true,false]"));
+    }
+
+    @Test
+    public void testLong() {
+        assertEquals(1L, parseValue(NAME, "{Long}1"));
+        assertEquals(10000000000L, parseValue(NAME, "{Long}10000000000"));
+    }
+
+    @Test
+    public void testLongArray() {
+        assertArrayEquals(new Object[] { 1L, 2L }, (Object[]) parseValue(NAME, "{Long}[1,2]"));
+        assertArrayEquals(new Object[] { 10000000000L, 20000000000L }, (Object[]) parseValue(NAME, "{Long}[10000000000,20000000000]"));
+    }
+
+    @Test
+    public void testDouble() {
+        assertEquals(new BigDecimal("1.234"), parseValue(NAME, "{Decimal}1.234"));
+    }
+
+    @Test
+    public void testDoubleArray() {
+        assertArrayEquals(new Object[] { new BigDecimal("1.234"), new BigDecimal("2.345") }, (Object[]) parseValue(NAME, "{Decimal}[1.234,2.345]"));
+    }
+
+    @Test
+    public void testCalendar() {
+        Calendar value = (Calendar)parseValue(NAME, "{Date}2010-09-05T15:10:20.000Z");
+        assertEquals(2010, value.get(Calendar.YEAR));
+        assertEquals(8, value.get(Calendar.MONTH));
+        assertEquals(5, value.get(Calendar.DAY_OF_MONTH));
+    }
+
+    @Test
+    public void testStringArrayRepPrivileges() {
+        assertArrayEquals(new Object[] { "rep:write", "crx:replicate", "jcr:read" }, (Object[]) parseValue(NAME, "{Name}[rep:write,crx:replicate,jcr:read]"));
+    }
+
+    @Test
+    public void testReference() {
+        UUID uuid = UUID.randomUUID();
+        UUID value = (UUID)parseValue(NAME, "{Reference}" + uuid.toString());
+        assertEquals(uuid, value);
+    }
+
+    @Test
+    public void testURI() {
+        URI value = (URI)parseValue(NAME, "{URI}http://www.jodelkaiser.de/");
+        assertEquals("http://www.jodelkaiser.de/", value.toString());
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
new file mode 100644
index 0000000..a98757a
--- /dev/null
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonContentParserTest.java
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl;
+
+import static org.apache.sling.jcr.contentparser.impl.TestUtils.getDeep;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.io.File;
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Map;
+import java.util.TimeZone;
+
+import org.apache.sling.jcr.contentparser.ContentParser;
+import org.apache.sling.jcr.contentparser.ContentParserFactory;
+import org.apache.sling.jcr.contentparser.ContentType;
+import org.apache.sling.jcr.contentparser.ParseException;
+import org.apache.sling.jcr.contentparser.ParserOptions;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+public class JsonContentParserTest {
+
+    private File file;
+
+    @Before
+    public void setUp() {
+        file = new File("src/test/resources/content-test/content.json");
+    }
+
+    @Test
+    public void testPageJcrPrimaryType() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
+        Map<String, Object> content = underTest.parse(file);
+
+        assertEquals("app:Page", content.get("jcr:primaryType"));
+    }
+
+    @Test
+    public void testDataTypes() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
+        Map<String, Object> content = underTest.parse(file);
+
+        Map<String, Object> props = getDeep(content, "toolbar/profiles/jcr:content");
+        assertEquals(true, props.get("hideInNav"));
+
+        assertEquals(1234567890123L, props.get("longProp"));
+        assertEquals(new BigDecimal("1.2345"), props.get("decimalProp"));
+        assertEquals(true, props.get("booleanProp"));
+
+        assertArrayEquals(new Long[] { 1234567890123L, 55L }, (Long[]) props.get("longPropMulti"));
+        assertArrayEquals(new BigDecimal[] { new BigDecimal("1.2345"), new BigDecimal("1.1") }, (BigDecimal[]) props.get("decimalPropMulti"));
+        assertArrayEquals(new Boolean[] { true, false }, (Boolean[]) props.get("booleanPropMulti"));
+    }
+
+    @Test
+    public void testContentProperties() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
+        Map<String, Object> content = underTest.parse(file);
+
+        Map<String, Object> props = getDeep(content, "jcr:content/header");
+        assertEquals("/content/dam/sample/header.png", props.get("imageReference"));
+    }
+
+    @Test
+    public void testCalendar() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.JSON,
+                new ParserOptions().detectCalendarValues(true));
+        Map<String, Object> content = underTest.parse(file);
+
+        Map<String, Object> props = getDeep(content, "jcr:content");
+
+        Calendar calendar = (Calendar) props.get("app:lastModified");
+        assertNotNull(calendar);
+
+        calendar.setTimeZone(TimeZone.getTimeZone("GMT+2"));
+
+        assertEquals(2014, calendar.get(Calendar.YEAR));
+        assertEquals(4, calendar.get(Calendar.MONTH) + 1);
+        assertEquals(22, calendar.get(Calendar.DAY_OF_MONTH));
+
+        assertEquals(15, calendar.get(Calendar.HOUR_OF_DAY));
+        assertEquals(11, calendar.get(Calendar.MINUTE));
+        assertEquals(24, calendar.get(Calendar.SECOND));
+    }
+
+    @Test
+    public void testUTF8Chars() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
+        Map<String, Object> content = underTest.parse(file);
+
+        Map<String, Object> props = getDeep(content, "jcr:content");
+
+        assertEquals("äöü߀", props.get("utf8Property"));
+    }
+
+    @Test(expected = ParseException.class)
+    public void testParseInvalidJson() throws Exception {
+        file = new File("src/test/resources/invalid-test/invalid.json");
+        ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
+        Map<String, Object> content = underTest.parse(file);
+        assertNull(content);
+    }
+
+    @Test(expected = ParseException.class)
+    public void testParseInvalidJsonWithObjectList() throws Exception {
+        file = new File("src/test/resources/invalid-test/contentWithObjectList.json");
+        ContentParser underTest = ContentParserFactory.create(ContentType.JSON);
+        Map<String, Object> content = underTest.parse(file);
+        assertNull(content);
+    }
+
+    @Test
+    public void testIgnoreResourcesProperties() throws Exception {
+        ContentParser underTest = ContentParserFactory.create(ContentType.JSON,
+                new ParserOptions().ignoreResourceNames(ImmutableSet.of("header", "newslist"))
+                        .ignorePropertyNames(ImmutableSet.of("jcr:title")));
+        Map<String, Object> content = underTest.parse(file);
+        Map<String, Object> props = getDeep(content, "jcr:content");
+
+        assertEquals("Sample Homepage", props.get("pageTitle"));
+        assertNull(props.get("jcr:title"));
+
+        assertNull(props.get("header"));
+        assertNull(props.get("newslist"));
+        assertNotNull(props.get("lead"));
+
+        assertEquals("abc", props.get("refpro1"));
+        assertEquals("def", props.get("pathprop1"));
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/ParserHelperTest.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/ParserHelperTest.java
new file mode 100644
index 0000000..f9e72da
--- /dev/null
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/ParserHelperTest.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl;
+
+import static org.apache.sling.jcr.contentparser.ParserOptions.DEFAULT_PRIMARY_TYPE;
+import static org.apache.sling.jcr.contentparser.impl.ParserHelper.JCR_PRIMARYTYPE;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TimeZone;
+
+import org.apache.sling.jcr.contentparser.ParseException;
+import org.apache.sling.jcr.contentparser.ParserOptions;
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+public class ParserHelperTest {
+
+    @Test
+    public void testEnsureDefaultPrimaryType() {
+        Map<String,Object> content = new HashMap<>();
+        content.put("prop1", "value1");
+
+        ParserHelper underTest = new ParserHelper(new ParserOptions());
+        underTest.ensureDefaultPrimaryType(content);
+        
+        assertEquals(ImmutableMap.<String,Object>of("prop1", "value1", JCR_PRIMARYTYPE, DEFAULT_PRIMARY_TYPE), content);
+    }
+
+    @Test
+    public void testEnsureDefaultPrimaryType_Disabled() {
+        Map<String,Object> content = new HashMap<>();
+        content.put("prop1", "value1");
+
+        ParserHelper underTest = new ParserHelper(new ParserOptions().defaultPrimaryType(null));
+        underTest.ensureDefaultPrimaryType(content);
+        
+        assertEquals(ImmutableMap.<String,Object>of("prop1", "value1"), content);
+    }
+
+    @Test
+    public void testEnsureDefaultPrimaryType_AlreadySet() {
+        Map<String,Object> content = new HashMap<>();
+        content.put("prop1", "value1");
+        content.put(JCR_PRIMARYTYPE, "type1");
+
+        ParserHelper underTest = new ParserHelper(new ParserOptions());
+        underTest.ensureDefaultPrimaryType(content);
+        
+        assertEquals(ImmutableMap.<String,Object>of("prop1", "value1", JCR_PRIMARYTYPE, "type1"), content);
+    }
+
+    @Test
+    public void testTryParseCalendar() {
+        ParserHelper underTest = new ParserHelper(new ParserOptions().detectCalendarValues(true));
+        
+        Calendar value = underTest.tryParseCalendar("Tue Apr 22 2014 15:11:24 GMT+0200");
+        assertNotNull(value);
+
+        value.setTimeZone(TimeZone.getTimeZone("GMT+2"));
+
+        assertEquals(2014, value.get(Calendar.YEAR));
+        assertEquals(4, value.get(Calendar.MONTH) + 1);
+        assertEquals(22, value.get(Calendar.DAY_OF_MONTH));
+
+        assertEquals(15, value.get(Calendar.HOUR_OF_DAY));
+        assertEquals(11, value.get(Calendar.MINUTE));
+        assertEquals(24, value.get(Calendar.SECOND));
+    }
+
+    @Test
+    public void testTryParseCalendar_Invalid() {
+        ParserHelper underTest = new ParserHelper(new ParserOptions().detectCalendarValues(true));
+        
+        Calendar value = underTest.tryParseCalendar("hello world");
+        assertNull(value);
+
+        value = underTest.tryParseCalendar("");
+        assertNull(value);
+
+        value = underTest.tryParseCalendar(null);
+        assertNull(value);
+    }
+
+    @Test
+    public void testTryParseCalendar_Disabled() {
+        ParserHelper underTest = new ParserHelper(new ParserOptions());
+        
+        Calendar value = underTest.tryParseCalendar("Tue Apr 22 2014 15:11:24 GMT+0200");
+        assertNull(value);
+    }
+
+    @Test
+    public void testIgnoreProperty() {
+        ParserHelper underTest = new ParserHelper(new ParserOptions().ignorePropertyNames(ImmutableSet.of("prop1", "jcr:prop2")));
+        
+        assertTrue(underTest.ignoreProperty("prop1"));
+        assertTrue(underTest.ignoreProperty("jcr:prop2"));
+        assertFalse(underTest.ignoreProperty("prop3"));
+    }
+
+    @Test
+    public void testIgnoreProperty_Disabled() {
+        ParserHelper underTest = new ParserHelper(new ParserOptions());
+        
+        assertFalse(underTest.ignoreProperty("prop1"));
+        assertFalse(underTest.ignoreProperty("jcr:prop2"));
+        assertFalse(underTest.ignoreProperty("prop3"));
+    }
+
+    @Test
+    public void testIgnoreResource() {
+        ParserHelper underTest = new ParserHelper(new ParserOptions().ignoreResourceNames(ImmutableSet.of("node1", "jcr:node2")));
+        
+        assertTrue(underTest.ignoreResource("node1"));
+        assertTrue(underTest.ignoreResource("jcr:node2"));
+        assertFalse(underTest.ignoreResource("node3"));
+    }
+
+    @Test
+    public void testIgnoreResource_Disabled() {
+        ParserHelper underTest = new ParserHelper(new ParserOptions());
+        
+        assertFalse(underTest.ignoreResource("node1"));
+        assertFalse(underTest.ignoreResource("jcr:node2"));
+        assertFalse(underTest.ignoreResource("node3"));
+    }
+
+    @Test
+    public void testCleanupPropertyName() {
+        ParserHelper underTest = new ParserHelper(new ParserOptions());
+
+        assertEquals("prop1", underTest.cleanupPropertyName("jcr:reference:prop1"));
+        assertEquals("prop2", underTest.cleanupPropertyName("jcr:path:prop2"));
+        assertEquals("jcr:xyz:prop3", underTest.cleanupPropertyName("jcr:xyz:prop3"));
+    }
+
+    @Test
+    public void testCleanupPropertyName_Disabled() {
+        ParserHelper underTest = new ParserHelper(new ParserOptions().removePropertyNamePrefixes(null));
+
+        assertEquals("jcr:reference:prop1", underTest.cleanupPropertyName("jcr:reference:prop1"));
+        assertEquals("jcr:path:prop2", underTest.cleanupPropertyName("jcr:path:prop2"));
+        assertEquals("jcr:xyz:prop3", underTest.cleanupPropertyName("jcr:xyz:prop3"));
+    }
+
+    @Test
+    public void testConvertSingleTypeArray() {
+        ParserHelper underTest = new ParserHelper(new ParserOptions());
+
+        assertArrayEquals(new Object[0], (Object[])underTest.convertSingleTypeArray(new Object[0]));
+        assertArrayEquals(new String[] {"value1","value2"}, (String[])underTest.convertSingleTypeArray(new Object[] {"value1","value2"}));
+        assertArrayEquals(new Long[] {1L,2L}, (Long[])underTest.convertSingleTypeArray(new Object[] {1L,2L}));
+    }
+
+    @Test(expected=ParseException.class)
+    public void testConvertSingleTypeArray_WithNull() {
+        ParserHelper underTest = new ParserHelper(new ParserOptions());
+        underTest.convertSingleTypeArray(new Object[] {"value1",null});
+    }
+
+    @Test(expected=ParseException.class)
+    public void testConvertSingleTypeArray_Map() {
+        ParserHelper underTest = new ParserHelper(new ParserOptions());
+        underTest.convertSingleTypeArray(new Object[] {ImmutableMap.<String,Object>of("prop1", "value1")});
+    }
+
+    @Test(expected=ParseException.class)
+    public void testConvertSingleTypeArray_MixedType() {
+        ParserHelper underTest = new ParserHelper(new ParserOptions());
+        underTest.convertSingleTypeArray(new Object[] {"value1",1L});
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java b/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java
new file mode 100644
index 0000000..bd3bb10
--- /dev/null
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/TestUtils.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentparser.impl;
+
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+public final class TestUtils {
+    
+    private TestUtils() {
+        // static methods only
+    }
+
+    @SuppressWarnings("unchecked")
+    public static Map<String, Object> getDeep(Map<String, Object> map, String path) {
+      String name = StringUtils.substringBefore(path, "/");
+      Object object = map.get(name);
+      if (object == null || !(object instanceof Map)) {
+        return null;
+      }
+      String remainingPath = StringUtils.substringAfter(path, "/");
+      Map<String, Object> childMap = (Map<String, Object>)object;
+      if (StringUtils.isEmpty(remainingPath)) {
+        return childMap;
+      }
+      else {
+        return getDeep(childMap, remainingPath);
+      }
+    }
+    
+}
diff --git a/src/test/resources/content-test/content.jcr.xml b/src/test/resources/content-test/content.jcr.xml
new file mode 100644
index 0000000..7d97cc0
--- /dev/null
+++ b/src/test/resources/content-test/content.jcr.xml
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:app="http://sample.com/jcr/app/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
+    jcr:primaryType="app:Page">
+  <jcr:content
+      jcr:primaryType="app:PageContent"
+      jcr:title="en"
+      sling:resourceType="samples/sample-app/components/content/page/homepage"
+      includeAside="{Boolean}true"
+      includeAsideBar="{Boolean}true"
+      includeTeaserBar="{Boolean}true"
+      includeTeaserbar="{Boolean}true"
+      inheritAside="{Boolean}false"
+      inheritTeaserbar="{Boolean}false"
+      longProp="{Long}1234567890123"
+      decimalProp="{Decimal}1.2345"
+      longPropMulti="{Long}[1234567890123,55]"
+      stringPropMulti="[aa,bb,cc]"
+      dateProp="{Date}2014-09-19T21:20:26.812+02:00"
+      navTitle="HOME"
+      pageTitle="Sample Site">
+    <teaserbar
+        jcr:primaryType="nt:unstructured"
+        sling:resourceType="samples/sample-app/components/content/teaserbar/teaserbarParsys"
+        teaserbaritem="test">
+      <teaserbaritem
+          jcr:primaryType="nt:unstructured"
+          sling:resourceType="samples/sample-app/components/content/teaserbar/teaserbarItem"
+          linkContentRef="/content/samples/en/conference"
+          linkMediaDownload="{Boolean}false"
+          linkTitle="This should help you with your decision"
+          linkType="internal"
+          linkWindowFeatures="default"
+          linkWindowTarget="_self"
+          mediaRef="/content/dam/samples/content/user.png"
+          teaserContent="Still not convinced to attend? Need persuasion? Facts for your boss?"
+          title="Why to attend" />
+      <teaserbaritem_0
+          jcr:primaryType="nt:unstructured"
+          sling:resourceType="samples/sample-app/components/content/teaserbar/teaserbarItem"
+          linkContentRef="/content/samples/en/venue"
+          linkMediaDownload="{Boolean}false"
+          linkTitle="More information"
+          linkType="internal"
+          linkWindowFeatures="default"
+          linkWindowTarget="_self"
+          mediaRef="/content/dam/samples/content/location.png"
+          teaserContent="Take a look at the new venue for 2013. The Kulturbrauerei in the Prenzlauer Berg district."
+          title="Location" />
+      <teaserbaritem_1
+          jcr:primaryType="nt:unstructured"
+          sling:resourceType="samples/sample-app/components/content/teaserbar/teaserbarItem"
+          linkContentRef="/content/samples/en/conference/call-for-papers"
+          linkMediaDownload="{Boolean}false"
+          linkTitle="Submit your proposal here"
+          linkType="internal"
+          linkWindowFeatures="default"
+          linkWindowTarget="_self"
+          mediaRef="/content/dam/samples/content/talk.png"
+          teaserContent="If you have insight and experiences with Apache Sling and want to share them? We are actually asking for your participation!"
+          title="Want to share?" />
+      <teaserbaritem_2
+          jcr:primaryType="nt:unstructured"
+          sling:resourceType="samples/sample-app/components/content/teaserbar/teaserbarItem"
+          linkContentRef="/content/samples/en/archive"
+          linkMediaDownload="{Boolean}false"
+          linkTitle="Dive into the archive"
+          linkType="internal"
+          linkWindowFeatures="default"
+          linkWindowTarget="_self"
+          mediaRef="/content/dam/samples/content/archive.png"
+          teaserContent="adaptTo() is not a new event. Take a look at what was said and done previously."
+          title="Take a look back" />
+    </teaserbar>
+    <aside
+        jcr:primaryType="nt:unstructured"
+        sling:resourceType="samples/sample-app/components/content/aside/asideParsys">
+      <asidesponsorteaser
+          jcr:primaryType="nt:unstructured"
+          sling:resourceType="samples/sample-app/components/content/aside/asideSponsorTeaser"
+          title="Sponsors">
+        <images
+            jcr:primaryType="nt:unstructured"
+            sling:resourceType="samples/sample-app/components/content/aside/asideSponsorTeaserParsys">
+          <asidesponsorteaserit_0
+              jcr:primaryType="nt:unstructured"
+              sling:resourceType="samples/sample-app/components/content/aside/asideSponsorTeaserItem"
+              imageHeight="41"
+              imageWidth="200"
+              linkExternalRef="http://www.pro-vision.de"
+              linkType="external"
+              linkWindowFeatures="default"
+              linkWindowTarget="_blank"
+              mediaRef="/content/dam/samples/content/provision-logo.png" />
+        </images>
+      </asidesponsorteaser>
+      <asidesocialteaser
+          jcr:primaryType="nt:unstructured"
+          sling:resourceType="samples/sample-app/components/content/aside/asideSocialTeaser"
+          title="Follow us">
+        <images
+            jcr:primaryType="nt:unstructured"
+            sling:resourceType="samples/sample-app/components/content/aside/asideSponsorTeaserParsys">
+          <asidesocialteaserite
+              jcr:primaryType="nt:unstructured"
+              sling:resourceType="samples/sample-app/components/content/aside/asideSocialTeaserItem"
+              linkExternalRef="http://twitter.com/adaptto"
+              linkMediaDownload="{Boolean}false"
+              linkTitle="@adaptTo"
+              linkType="external"
+              linkWindowFeatures="default"
+              linkWindowTarget="_blank"
+              mediaRef="/content/dam/samples/content/twitter-icon.png"
+              title="on twitter" />
+        </images>
+      </asidesocialteaser>
+    </aside>
+    <content
+        jcr:primaryType="nt:unstructured"
+        sling:resourceType="sample/wcm/parsys/components/parsys">
+      <contentrichtext
+          jcr:primaryType="nt:unstructured"
+          sling:resourceType="samples/sample-app/components/content/common/contentRichText"
+          text="&lt;p&gt;adaptTo() is a meetup in Berlin focused on Apache Sling including Apache Jackrabbit and Apache Felix and is addressed to all using this stack or parts of it.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a data=&quot;{&amp;quot;linkType&amp;quot;:&amp;quot;internal&amp;quot;,&amp;quot;linkContentRef&amp;quot;:&amp;quot;/content/samples/handler/en/conference&amp;quot;,&amp;quot;linkWindowTarget&amp;quot;:&amp;quot;_self&amp;quot;,&amp;quot;linkWindowFeatures&amp;quot;:&amp;quot;defa [...]
+      <contentheadline
+          jcr:primaryType="nt:unstructured"
+          sling:resourceType="samples/sample-app/components/content/common/contentHeadline"
+          headline="Extended Call for Papers"
+          smaller="{Boolean}true" />
+      <contentrichtext_0
+          jcr:primaryType="nt:unstructured"
+          sling:resourceType="samples/sample-app/components/content/common/contentRichText"
+          text="&lt;p&gt;Although we got some great submissions for adaptTo() 2013, we still have some slots for further sessions. Therefore we extend the timeslot for submissions to the call for papers and for feedback by two weeks. This means you still can submit you submissions till 06.05.2013. We're looking forward to get more of your great talks.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a data=&quot;{&amp;quot;linkType&amp;quot;:&amp;quot;internal&amp;quot;,&amp;quot;linkContentRef&amp;quot;:&amp [...]
+    </content>
+    <stage
+        jcr:primaryType="nt:unstructured"
+        sling:resourceType="sample/wcm/parsys/components/parsys">
+      <stageheader
+          jcr:primaryType="nt:unstructured"
+          sling:resourceType="samples/sample-app/components/content/stage/stageheader"
+          linkMediaDownload="{Boolean}false"
+          linkType="internal"
+          linkWindowFeatures="default"
+          linkWindowTarget="_self"
+          mediaRef="/content/dam/samples/content/stageheader-outside2.jpg"
+          subtitle="23.–25. September 2013&#xA;Kulturbrauerei Berlin"
+          title="adaptTo() 2013">
+        <links
+            jcr:primaryType="nt:unstructured"
+            sling:resourceType="samples/sample-app/components/content/stage/stageheaderParsys">
+          <stageheaderlinkitem
+              jcr:primaryType="nt:unstructured"
+              sling:resourceType="samples/sample-app/components/content/stage/stageheaderLinkItem"
+              linkContentRef="/content/samples/en/tickets"
+              linkMediaDownload="{Boolean}false"
+              linkTitle="Get tickets now"
+              linkType="internal"
+              linkWindowFeatures="default"
+              linkWindowTarget="_self" />
+          <stageheaderlinkitem_0
+              jcr:primaryType="nt:unstructured"
+              sling:resourceType="samples/sample-app/components/content/stage/stageheaderLinkItem"
+              linkContentRef="/content/samples/en/conference/call-for-papers"
+              linkMediaDownload="{Boolean}false"
+              linkTitle="Submit paper"
+              linkType="internal"
+              linkWindowFeatures="default"
+              linkWindowTarget="_self" />
+        </links>
+      </stageheader>
+    </stage>
+    <image
+        jcr:primaryType="nt:unstructured" />
+  </jcr:content>
+  <tools />
+  <conference />
+</jcr:root>
diff --git a/src/test/resources/content-test/content.json b/src/test/resources/content-test/content.json
new file mode 100644
index 0000000..c30d34e
--- /dev/null
+++ b/src/test/resources/content-test/content.json
@@ -0,0 +1,264 @@
+/* Comment example */
+{
+  "jcr:primaryType": "app:Page",
+  "jcr:createdBy": "admin",
+  "jcr:created": "Thu Aug 07 2014 16:32:59 GMT+0200",
+  /* Comment example */
+  "jcr:content": {
+    "jcr:primaryType": "app:PageContent",  /* Comment example */
+    "jcr:createdBy": "admin",
+    "jcr:title": "English",
+    "app:template": "sample/templates/homepage",
+    "jcr:created": "Thu Aug 07 2014 16:32:59 GMT+0200",
+    "app:lastModified": "Tue Apr 22 2014 15:11:24 GMT+0200",
+    "dateISO8601String": "2014-04-22T15:11:24.000+02:00",
+    "pageTitle": "Sample Homepage",
+    "sling:resourceType": "sample/components/homepage",
+    "sling:resourceSuperType": "sample/components/supertype",
+    "app:designPath": "/etc/designs/sample",
+    "app:lastModifiedBy": "admin",
+    "utf8Property": "äöü߀",
+    "jcr:reference:refpro1": "abc",
+    "jcr:path:pathprop1": "def",
+    "par": {
+      "jcr:primaryType": "nt:unstructured",
+      "sling:resourceType": "foundation/components/parsys",
+      "colctrl": {
+        "jcr:primaryType": "nt:unstructured",
+        "jcr:createdBy": "admin",
+        "jcr:lastModifiedBy": "admin",
+        "layout": "2;colctrl-lt0",
+        "jcr:created": "Mon Aug 23 2010 22:02:24 GMT+0200",
+        "jcr:lastModified": "Mon Aug 23 2010 22:02:35 GMT+0200",
+        "sling:resourceType": "foundation/components/parsys/colctrl"
+      },
+      "image": {
+        "jcr:primaryType": "nt:unstructured",
+        "jcr:createdBy": "admin",
+        "fileReference": "/content/dam/sample/portraits/jane_doe.jpg",
+        "jcr:lastModifiedBy": "admin",
+        "jcr:created": "Mon Aug 23 2010 22:03:39 GMT+0200",
+        "width": "340",
+        "jcr:lastModified": "Sun Oct 31 2010 21:39:50 GMT+0100",
+        "sling:resourceType": "foundation/components/image",
+        "file": {
+          "jcr:primaryType": "nt:file",
+          "jcr:createdBy": "admin",
+          "jcr:created": "Thu Aug 07 2014 16:32:59 GMT+0200",
+          "jcr:content": {
+            "jcr:primaryType": "nt:resource",
+            "jcr:lastModifiedBy": "anonymous",
+            "jcr:mimeType": "image/jpeg",
+            "jcr:lastModified": "Thu Aug 07 2014 16:32:59 GMT+0200",
+            ":jcr:data": 24377,
+            "jcr:uuid": "eda76d00-b2cd-4b59-878f-c33f71ceaddc"
+          }
+        }
+      },
+      "title_1": {
+        "jcr:primaryType": "nt:unstructured",
+        "jcr:createdBy": "admin",
+        "jcr:title": "Strategic Consulting",
+        "jcr:lastModifiedBy": "admin",
+        "jcr:created": "Mon Aug 23 2010 22:12:08 GMT+0200",
+        "jcr:lastModified": "Wed Oct 27 2010 21:33:24 GMT+0200",
+        "sling:resourceType": "sample/components/title"
+      },
+      "text_1": {
+        "jcr:primaryType": "nt:unstructured",
+        "jcr:createdBy": "admin",
+        "jcr:lastModifiedBy": "admin",
+        "jcr:created": "Sun Oct 31 2010 21:48:04 GMT+0100",
+        "text": "<p><span class=\"Apple-style-span\" style=\"font-size: 12px;\">In&nbsp;today's competitive market, organizations can face several key geometric challenges:<\/span><\/p>\n<ul>\n<li><span class=\"Apple-style-span\" style=\"font-size: 12px;\">Polyhedral Sectioning<\/span><\/li>\n<li><span class=\"Apple-style-span\" style=\"font-size: 12px;\">Triangulation&nbsp;<\/span><\/li>\n<li><span class=\"Apple-style-span\" style=\"font-size: 12px;\">Trigonometric Calculation<\/span><\ [...]
+        "jcr:lastModified": "Sun Oct 31 2010 21:49:06 GMT+0100",
+        "sling:resourceType": "foundation/components/text",
+        "textIsRich": "true"
+      },
+      "col_break12825937554040": {
+        "jcr:primaryType": "nt:unstructured",
+        "controlType": "break",
+        "sling:resourceType": "foundation/components/parsys/colctrl"
+      },
+      "image_0": {
+        "jcr:primaryType": "nt:unstructured",
+        "jcr:createdBy": "admin",
+        "fileReference": "/content/dam/sample/offices/clean_room.jpg",
+        "height": "226",
+        "jcr:lastModifiedBy": "admin",
+        "jcr:created": "Mon Aug 23 2010 22:04:46 GMT+0200",
+        "jcr:lastModified": "Fri Nov 05 2010 10:38:15 GMT+0100",
+        "sling:resourceType": "foundation/components/image",
+        "imageRotate": "0",
+        "file": {
+          "jcr:primaryType": "nt:file",
+          "jcr:createdBy": "admin",
+          "jcr:created": "Thu Aug 07 2014 16:32:59 GMT+0200",
+          "jcr:content": {
+            "jcr:primaryType": "nt:resource",
+            "jcr:lastModifiedBy": "anonymous",
+            "jcr:mimeType": "image/jpeg",
+            "jcr:lastModified": "Thu Aug 07 2014 16:32:59 GMT+0200",
+            ":jcr:data": 21142,
+            "jcr:uuid": "6139077f-191f-4337-aaef-55456ebe6784"
+          }
+        }
+      },
+      "title_2": {
+        "jcr:createdBy": "admin",
+        "jcr:title": "Shape Technology",
+        "jcr:lastModifiedBy": "admin",
+        "jcr:created": "Mon Aug 23 2010 22:12:13 GMT+0200",
+        "jcr:lastModified": "Tue Oct 26 2010 21:16:29 GMT+0200",
+        "sling:resourceType": "sample/components/title"
+      },
+      "text_0": {
+        "jcr:primaryType": "nt:unstructured",
+        "jcr:createdBy": "admin",
+        "jcr:lastModifiedBy": "admin",
+        "jcr:created": "Mon Aug 23 2010 22:16:30 GMT+0200",
+        "text": "<p>The Sample investment in R&amp;D has done more than solidify our industry leadership role, we have now outpaced our competitors to such an extent that we are in an altogether new space.<\/p>\n<p>This is why our high quality polygons and polyhedra provide the only turnkey solutions across the whole range of euclidean geometry. And our mathematicians are working on the next generation of fractal curves to bring you shapes that are unthinkable today.<\/p>\n<p><\/p>\n<p>< [...]
+        "jcr:lastModified": "Mon Nov 08 2010 20:39:00 GMT+0100",
+        "sling:resourceType": "foundation/components/text",
+        "textIsRich": "true"
+      },
+      "col_end12825937444810": {
+        "jcr:primaryType": "nt:unstructured",
+        "controlType": "end",
+        "sling:resourceType": "foundation/components/parsys/colctrl"
+      }
+    },
+    "header": {
+      "jcr:primaryType": "nt:unstructured",
+      "jcr:title": "trust our experience\r\nto manage your business",
+      "imageReference": "/content/dam/sample/header.png",
+      "text": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc eget neque. Nunc condimentum ipsum et orci. Aenean est. Cras eget diam. read more",
+      "sling:resourceType": "sample/components/header"
+    },
+    "newslist": {
+      "jcr:primaryType": "nt:unstructured",
+      "headline": "trust our experience\nto manage your business",
+      "text": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc eget neque. Nunc condimentum ipsum et orci. Aenean est. Cras eget diam. read more",
+      "sling:resourceType": "sample/components/listchildren",
+      "listroot": "/content/sample/en/about/news"
+    },
+    "lead": {
+      "jcr:primaryType": "nt:unstructured",
+      "jcr:title": "World Leader in Applied Geometry ",
+      "jcr:lastModifiedBy": "admin",
+      "text": "Lead Text",
+      "title": "Lead Title",
+      "jcr:description": "Sample has been selling and servicing shapes for over 2000 years. From our beginnings as a small vendor of squares and rectangles we have grown our business into a leading global provider of platonic solids and fractals. Join us as we lead geometry into the future.",
+      "jcr:lastModified": "Wed Jan 19 2011 14:35:29 GMT+0100",
+      "sling:resourceType": "sample/components/lead",
+      "app:annotations": {"jcr:primaryType": "nt:unstructured"}
+    },
+    "image": {
+      "jcr:primaryType": "nt:unstructured",
+      "jcr:lastModifiedBy": "admin",
+      "jcr:lastModified": "Wed Oct 27 2010 21:30:59 GMT+0200",
+      "imageRotate": "0"
+    },
+    "carousel": {
+      "jcr:primaryType": "nt:unstructured",
+      "playSpeed": "6000",
+      "jcr:lastModifiedBy": "admin",
+      "pages": [
+        "/content/sample/en/events/techsummit",
+        "/content/sample/en/events/userconf",
+        "/content/sample/en/events/shapecon",
+        "/content/sample/en/events/dsc"
+      ],
+      "jcr:lastModified": "Tue Oct 05 2010 14:14:27 GMT+0200",
+      "transTime": "1000",
+      "sling:resourceType": "foundation/components/carousel",
+      "listFrom": "static"
+    },
+    "rightpar": {
+      "jcr:primaryType": "nt:unstructured",
+      "sling:resourceType": "foundation/components/parsys",
+      "teaser": {
+        "jcr:primaryType": "nt:unstructured",
+        "jcr:createdBy": "admin",
+        "jcr:lastModifiedBy": "admin",
+        "jcr:created": "Tue Jan 25 2011 11:30:09 GMT+0100",
+        "campaignpath": "/content/campaigns/sample",
+        "jcr:lastModified": "Wed Feb 02 2011 08:40:30 GMT+0100",
+        "sling:resourceType": "personalization/components/teaser"
+      }
+    }
+  },
+  "toolbar": {
+    "jcr:primaryType": "app:Page",
+    "jcr:createdBy": "admin",
+    "jcr:created": "Thu Aug 07 2014 16:33:00 GMT+0200",
+    "jcr:content": {
+      "jcr:primaryType": "app:PageContent",
+      "subtitle": "Contains the toolbar",
+      "jcr:createdBy": "admin",
+      "jcr:title": "Toolbar",
+      "app:template": "sample/templates/contentpage",
+      "jcr:created": "Thu Aug 07 2014 16:33:00 GMT+0200",
+      "app:lastModified": "Wed Aug 25 2010 22:51:02 GMT+0200",
+      "hideInNav": "true",
+      "sling:resourceType": "sample/components/contentpage",
+      "app:lastModifiedBy": "admin",
+      "par": {
+        "jcr:primaryType": "nt:unstructured",
+        "sling:resourceType": "foundation/components/parsys"
+      },
+      "rightpar": {
+        "jcr:primaryType": "nt:unstructured",
+        "sling:resourceType": "foundation/components/iparsys",
+        "iparsys_fake_par": {
+          "jcr:primaryType": "nt:unstructured",
+          "sling:resourceType": "foundation/components/iparsys/par"
+        }
+      }
+    },
+    "profiles": {
+      "jcr:primaryType": "app:Page",
+      "jcr:createdBy": "admin",
+      "jcr:created": "Thu Aug 07 2014 16:33:00 GMT+0200",
+      "jcr:content": {
+        "jcr:primaryType": "app:PageContent",
+        "jcr:mixinTypes": ["type1","type2"],
+        "jcr:createdBy": "admin",
+        "jcr:title": "Profiles",
+        "app:template": "sample/templates/contentpage",
+        "jcr:created": "Thu Aug 07 2014 16:33:00 GMT+0200",
+        "app:lastModified": "Thu Nov 05 2009 20:27:13 GMT+0100",
+        "hideInNav": true,
+        "sling:resourceType": "sample/components/contentpage",
+        "app:lastModifiedBy": "admin",
+        "longProp": 1234567890123,
+        "decimalProp": 1.2345,
+        "booleanProp": true,
+        "longPropMulti": [1234567890123,55],
+        "decimalPropMulti": [1.2345,1.1],
+        "booleanPropMulti": [true,false],
+        "stringPropMulti": ["aa","bb","cc"],
+        "par": {
+          "jcr:primaryType": "nt:unstructured",
+          "sling:resourceType": "foundation/components/parsys",
+          "textimage": {
+            "jcr:primaryType": "nt:unstructured",
+            "sling:resourceType": "foundation/components/textimage"
+          },
+          "mygadgets": {
+            "jcr:primaryType": "nt:unstructured",
+            "gadgets": "http://customer.meteogroup.de/meteogroup/gadgets/wetter24.xml\nhttp://germanweatherradar.googlecode.com/svn/trunk/german-weather-radar.xml\nhttp://www.digitalpowered.info/gadget/ski.pictures.xml\nhttp://www.canbuffi.de/gadgets/clock/clock.xml",
+            "sling:resourceType": "personalization/components/mygadgets"
+          }
+        },
+        "rightpar": {
+          "jcr:primaryType": "nt:unstructured",
+          "sling:resourceType": "foundation/components/iparsys",
+          "iparsys_fake_par": {
+            "jcr:primaryType": "nt:unstructured",
+            "sling:resourceType": "foundation/components/iparsys/par"
+          }
+        }
+      }
+    }
+  }
+}
diff --git a/src/test/resources/invalid-test/contentWithObjectList.json b/src/test/resources/invalid-test/contentWithObjectList.json
new file mode 100644
index 0000000..e4527a0
--- /dev/null
+++ b/src/test/resources/invalid-test/contentWithObjectList.json
@@ -0,0 +1,14 @@
+{
+  "prop1": "value1",
+  "childObject": {
+    "prop2": "value2"
+  },
+  "childObjectList": [
+    {
+      "prop1": "value1"
+    },
+    {
+      "prop2": "value2"
+    }
+  ]
+}
diff --git a/src/test/resources/invalid-test/invalid.jcr.xml b/src/test/resources/invalid-test/invalid.jcr.xml
new file mode 100644
index 0000000..7df8a70
--- /dev/null
+++ b/src/test/resources/invalid-test/invalid.jcr.xml
@@ -0,0 +1 @@
+This is invalid xml.
diff --git a/src/test/resources/invalid-test/invalid.json b/src/test/resources/invalid-test/invalid.json
new file mode 100644
index 0000000..59fc86c
--- /dev/null
+++ b/src/test/resources/invalid-test/invalid.json
@@ -0,0 +1 @@
+This is invalid json.

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.