jw3 commented on a change in pull request #431:
URL: https://github.com/apache/incubator-daffodil/pull/431#discussion_r510190534
##########
File path:
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DataProcessor.scala
##########
@@ -692,40 +699,35 @@ class DataProcessor private (
class ParseResult(dp: DataProcessor, override val resultState: PState)
extends DFDL.ParseResult
with WithDiagnosticsImpl
- with ErrorHandler {
+ with Logging {
/**
- * To be successful here, we need to capture xerces parse/validation
+ * To be successful here, we need to capture parse/validation
* errors and add them to the Diagnostics list in the PState.
*
- * @param state the initial parse state.
+ * @param bytes the parsed Infoset
*/
def validateResult(bytes: Array[Byte]): Unit = {
Assert.usage(resultState.processorStatus eq Success)
- val schemaURIStrings =
resultState.infoset.asInstanceOf[InfosetElement].runtimeData.schemaURIStringsForFullValidation
- try {
- val bis = new java.io.ByteArrayInputStream(bytes)
- Validator.validateXMLSources(schemaURIStrings, bis, this)
- } catch {
- //
- // Some SAX Parse errors are thrown even if you specify an error handler
to the
- // validator.
- //
- // So we also need this catch
- //
- case e: SAXException =>
- resultState.validationErrorNoContext(e)
+
+
+ val v = dp.validationMode match {
+ case ValidationMode.Custom(cv) => cv
+ case _ =>
+ /// todo;; potential corner case (or not corner?) of needing this
dynamic value to configure a validator
+ ///
resultState.infoset.asInstanceOf[InfosetElement].runtimeData.schemaURIStringsForFullValidation.mkString(",")
+ val v =
ConfigValueFactory.fromAnyRef(resultState.infoset.asInstanceOf[InfosetElement].runtimeData.schemaURIStringsForFullValidation)
+ Validators.default.make(
+ Some(ConfigFactory.parseMap(Map(Validators.default.name() ->
v).asJava))
Review comment:
will add a function somewhere to make this a little more sightly.
Would be nice if these schema names could be obtained some other way at some
other point, but I have found that way yet.
----------------------------------------------------------------
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:
[email protected]