SLING-8570 - Extract a generic Content Parser API from org.apache.sling.jcr.contentparser with pluggable implementations

* added parser for JCR-flavoured XML
* made the ParserHelper compatible with both Java 8 and Java 11
* reduced the number of dependencies for all modules
diff --git a/pom.xml b/pom.xml
index 2424af1..8ee015e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -53,7 +53,7 @@
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
             <version>3.8</version>
-            <scope>provided</scope>
+            <scope>compile</scope>
         </dependency>
     </dependencies>
 </project>
diff --git a/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElement.java b/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElement.java
index 37bb5ad..d5bb5ab 100644
--- a/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElement.java
+++ b/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElement.java
@@ -18,35 +18,71 @@
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
 package org.apache.sling.contentparser.testutils.mapsupport;
 
+import java.util.LinkedHashMap;
 import java.util.Map;
 
+import org.apache.commons.lang3.StringUtils;
+
 /**
- * Represents a resource or node in the content hierarchy.
+ * Implements support for a {@link org.apache.sling.contentparser.api.ContentHandler} parsed resource to use during
+ * {@link org.apache.sling.contentparser.api.ContentParser} tests.
  */
-public interface ContentElement {
+public final class ContentElement {
+
+    private final String name;
+    private final Map<String, Object> properties;
+    private final Map<String, ContentElement> children = new LinkedHashMap<>();
+
+    ContentElement(String name, Map<String, Object> properties) {
+        this.name = name;
+        this.properties = properties;
+    }
 
     /**
-     * @return Resource name. The root resource has no name (null).
+     * Returns the name of the resource.
+     *
+     * @return resource name; the root resource has no name (null).
      */
-    String getName();
-    
+    public String getName() {
+        return name;
+    }
+
     /**
      * Properties of this resource.
-     * @return Properties (keys, values)
+     *
+     * @return this resource's properties (keys, values)
      */
-    Map<String, Object> getProperties();
-    
+    public Map<String, Object> getProperties() {
+        return properties;
+    }
+
     /**
-     * Get children of current resource. The Map preserves the ordering of children.
-     * @return Children (child names, child objects)
+     * Returns the children of this resource. The Map preserves the children's ordering.
+     *
+     * @return the children of this resource (child names, child objects)
      */
-    Map<String, ContentElement> getChildren();
-    
+    public Map<String, ContentElement> getChildren() {
+        return children;
+    }
+
     /**
-     * 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
+     * Returns the child with the specified {@code path}.
+     *
+     * @param path relative path to address child or one of its descendants (use "/" as hierarchy separator)
+     * @return child or {@code null} if no child was found for the specified {@code path}
      */
-    ContentElement getChild(String path);
-    
+    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);
+        }
+    }
+
 }
diff --git a/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementHandler.java b/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementHandler.java
index c6e3f54..0714ae7 100644
--- a/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementHandler.java
+++ b/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementHandler.java
@@ -28,7 +28,7 @@
 /**
  * {@link ContentHandler} implementation that produces a tree of {@link ContentElement} items.
  */
-public class ContentElementHandler implements ContentHandler {
+public final class ContentElementHandler implements ContentHandler {
     
     private ContentElement root;
     private Pattern PATH_PATTERN = Pattern.compile("^((/[^/]+)*)(/([^/]+))$"); 
@@ -36,7 +36,7 @@
     @Override
     public void resource(String path, Map<String, Object> properties) {
         if (StringUtils.equals(path, "/")) {
-            root = new ContentElementImpl(null, properties);
+            root = new ContentElement(null, properties);
         }
         else {
             if (root == null) {
@@ -58,7 +58,7 @@
             if (parent == null) {
                 throw new RuntimeException("Parent '" + relativeParentPath + "' does not exist.");
             }
-            parent.getChildren().put(name, new ContentElementImpl(name, properties));
+            parent.getChildren().put(name, new ContentElement(name, properties));
         }
     }
     
diff --git a/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementImpl.java b/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementImpl.java
deleted file mode 100644
index 93ec66e..0000000
--- a/src/main/java/org/apache/sling/contentparser/testutils/mapsupport/ContentElementImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.contentparser.testutils.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);
-        }
-    }
-
-}