You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by GitBox <gi...@apache.org> on 2020/09/03 16:17:41 UTC

[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #408: Implement SAX Parsing

mbeckerle commented on a change in pull request #408:
URL: https://github.com/apache/incubator-daffodil/pull/408#discussion_r483100087



##########
File path: daffodil-lib/src/main/scala/org/apache/daffodil/util/Validator.scala
##########
@@ -85,5 +82,22 @@ object Validator extends NoBindingFactoryAdapter {
     val documentSource = new StreamSource(document)
     validator.validate(documentSource)
   }
+
+  def initializeValidator(validator: javax.xml.validation.Validator, errHandler: ErrorHandler, resolver: DFDLCatalogResolver):
+    javax.xml.validation.Validator = {
+    validator.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true)
+    //
+    validator.setFeature("http://xml.org/sax/features/validation", true)
+
+    // If you enable the feature below, it seems to do no validation at all. Just passes.
+    //          validator.setFeature("http://apache.org/xml/features/validation/dynamic", true)
+
+    validator.setFeature("http://apache.org/xml/features/validation/schema", true)
+    validator.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true)
+    validator.setErrorHandler(errHandler)
+    validator.setResourceResolver(resolver)
+    validator

Review comment:
       Is a validator a serializable object? Is it a stateful object? I am wondering if we can compute this once-only and save as a member of the SchemaSetRuntimeData, or if that isn't possible, compute it once-only at runtime and reuse it for multiple validations. 




----------------------------------------------------------------
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.

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