docbook-schemas 5.2 compatibility (although it's not out yet, so we still use 5.1)
diff --git a/freemarker-docgen-core/pom.xml b/freemarker-docgen-core/pom.xml
index c67591c..979d131 100644
--- a/freemarker-docgen-core/pom.xml
+++ b/freemarker-docgen-core/pom.xml
@@ -58,7 +58,8 @@
             <groupId>org.docbook</groupId>
             <artifactId>docbook-schemas</artifactId>
             <version>5.1-1</version>
-            <!-- We just need the docbook.rng resource from this artifact, so we exclude all dependencies: -->
+            <!-- We just need the docbook.rng resource from this artifact, so we exclude all dependencies. -->
+            <!-- These exclusions can be removed starting from 5.2. -->
             <exclusions>
                 <exclusion>
                     <groupId>org.apache.logging.log4j</groupId>
diff --git a/freemarker-docgen-core/src/main/java/org/freemarker/docgen/core/RelaxNGValidator.java b/freemarker-docgen-core/src/main/java/org/freemarker/docgen/core/RelaxNGValidator.java
index c6f9843..161e5ec 100644
--- a/freemarker-docgen-core/src/main/java/org/freemarker/docgen/core/RelaxNGValidator.java
+++ b/freemarker-docgen-core/src/main/java/org/freemarker/docgen/core/RelaxNGValidator.java
@@ -20,6 +20,8 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.net.URL;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
@@ -101,10 +103,11 @@
         SchemaReader scemaReader = new AutoSchemaReader();
         Schema schema;
         try {
+            URL rngUrl = getRequiredResource(
+                    "/org/docbook/schemas/5.0/rng/docbook.rng",
+                    "/schema/5.0/rng/docbook.rng");
             schema = scemaReader.createSchema(
-                    ValidationDriver.uriOrFileInputSource(
-                            RelaxNGValidator.class.getResource(
-                                "/schema/5.0/rng/docbook.rng").toString()),
+                    ValidationDriver.uriOrFileInputSource(rngUrl.toString()),
                     schemaProps.toPropertyMap());
         } catch (IncorrectSchemaException e) {
             throw new BugException(
@@ -185,5 +188,15 @@
         
         return domBuilder.getDocument();
     }
-    
+
+    private static URL getRequiredResource(String... resourceAndFallbacks) throws IOException {
+        for (String attemptedResource : resourceAndFallbacks) {
+            URL url = RelaxNGValidator.class.getResource(attemptedResource);
+            if (url != null) {
+                return url;
+            }
+        }
+        throw new IOException("Resource was not found on any of these locations: " + Arrays.asList(resourceAndFallbacks));
+    }
+
 }