tuxji commented on code in PR #1060:
URL: https://github.com/apache/daffodil/pull/1060#discussion_r1281839823


##########
daffodil-lib/src/test/scala/org/apache/daffodil/lib/util/TestXMLCatalogAndValidate.scala:
##########
@@ -446,48 +452,56 @@ class SchemaAwareFactoryAdapter() extends 
NoBindingFactoryAdapter {
   f.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true)
   f.setValidating(true)
   val p = f.newSAXParser()
-  val xr = p.getXMLReader()
+  val r = p.getXMLReader()
+
+  // We must use XMLReader setProperty() function to set the entity 
resolver--calling
+  // setEntityResolver with the Xerces XML reader causes validation to fail 
for some
+  // reason. We call the right function below, but unfortunately, scala-xml 
calls
+  // setEntityResolver in loadDocument(), which cannot be disabled and 
scala-xml does not
+  // want to change. To avoid this, we wrap the Xerces XMLReader in an 
XMLFilterImpl and
+  // override setEntityResolver to a no-op. However, XMLFilterImpl parse() 
calls
+  // setEntityResolver() on the XMLReader, which for the same reason as before 
causes
+  // issues. To fix this, we can override parse() to just pass through to the 
parent, but
+  // that means we must override the various set/get handler functions to also 
pass
+  // through to the parent.

Review Comment:
   I'm fine with keeping this test code around as well.  I also wonder if it's 
worth writing a test of the way you want to call the scala xml loader code 
(which doesn't currently work) so that if scala xml does change to support that 
way, the test would detect the change in behavior and alert us?  Maybe not 
worth the time, but just a thought.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to