michael-o commented on code in PR #187:
URL: https://github.com/apache/maven-doxia/pull/187#discussion_r1438663904


##########
doxia-core/src/main/java/org/apache/maven/doxia/util/XmlValidator.java:
##########
@@ -65,57 +86,42 @@ public class XmlValidator {
      */
     public void validate(String content) throws ParseException {
         try {
-            // 1 if there's a doctype
-            boolean hasDoctype = false;
-            Matcher matcher = PATTERN_DOCTYPE.matcher(content);
-            if (matcher.find()) {
-                hasDoctype = true;
-            }
-
-            // 2 check for an xmlns instance
-            boolean hasXsd = false;
-            matcher = PATTERN_TAG.matcher(content);
-            if (matcher.find()) {
-                String value = matcher.group(2);
-
-                if 
(value.contains(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI)) {
-                    hasXsd = true;
-                }
-            }
-
-            // 3 validate content
-            getXmlReader(hasXsd && hasDoctype).parse(new InputSource(new 
StringReader(content)));
-        } catch (IOException | SAXException e) {
+            getXmlReader().parse(new InputSource(new StringReader(content)));
+        } catch (IOException | SAXException | ParserConfigurationException e) {
             throw new ParseException("Error validating the model", e);
         }
     }
 
     /**
-     * @param hasDtdAndXsd to flag the <code>ErrorHandler</code>.
      * @return an xmlReader instance.
      * @throws SAXException if any
+     * @throws ParserConfigurationException
      */
-    private XMLReader getXmlReader(boolean hasDtdAndXsd) throws SAXException {
+    public XMLReader getXmlReader() throws SAXException, 
ParserConfigurationException {
         if (xmlReader == null) {

Review Comment:
   No objections, but that would be a behavioral change and should be a 
separate issue.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to