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/11/06 15:20:36 UTC

[GitHub] [incubator-daffodil] jw3 opened a new pull request #452: Schematron Validation

jw3 opened a new pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452


   Schematron implementation of the Validator API
   
   DAFFODIL-1807


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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r520277212



##########
File path: daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
##########
@@ -391,7 +402,7 @@ class CLIConf(arguments: Array[String]) extends scallop.ScallopConf(arguments)
     val threads = opt[Int](short = 't', argName = "threads", default = Some(1), descr = "The number of threads to use.")
     val path = opt[String](argName = "path", descr = "path to the node to create parser.")
     val parser = opt[File](short = 'P', argName = "file", descr = "use a previously saved parser.")
-    val validate: ScallopOption[ValidationMode.Type] = opt[ValidationMode.Type](short = 'V', default = Some(ValidationMode.Off), argName = "mode", descr = "the validation mode. 'on', 'limited' or 'off'.")
+    val validate: ScallopOption[ValidationMode.Type] = opt[ValidationMode.Type](short = 'V', default = Some(ValidationMode.Off), argName = "mode", descr = "the validation mode. 'on', 'limited', 'off', or spi name.")

Review comment:
       OK this can be adjusted ... note that this line is a change from PR #431 showing up here because this is based on that one and that one is unmerged.




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



[GitHub] [incubator-daffodil] stevedlawrence commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r532895471



##########
File path: daffodil-schematron/src/main/scala/org/apache/daffodil/validation/ClassPathUriResolver.scala
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.validation

Review comment:
       Should we put the schematron is a separate package, e.g. org.apache.daffodil.validation.schematron? Seems these files are specific to the daffodil-schematron implementation




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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r534234752



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       Yeah saw that java lib.
   
   >  A quick test shows it doesn't even pull in any dependencies
   
   Hmm
   
   https://github.com/schxslt/schxslt-java/blob/master/pom.xml#L93-L109
   
   https://github.com/schxslt/schxslt-java/blob/master/pom.xml#L123-L128
   
   




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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r533322810



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       > Did you add the Apache license or did you get it from Apache Camel like that?
   
   It does look like the Camel project adds the Apache header.  I had only compared the manifest from Camel with the ISO Schematron 2 distribution, not the file contents.  The best way from here is to replace all of these with the files from the official distribution, which only have the MIT header.
   
   The Extract* files are a special case, not part of the distribution.  Will dig deeper for authoritative source on those, I see a couple different versions floating around.  Ill pull those out and put in the next PR, which makes more sense anyways.
   
   > I think you also mentioned some of this came from Apache Camel?
   
   The resources came from over there, but are going to be replaced with the standard distribution, nothing else remains a direct use.  Overall I used their approach to guide the Scala implementation so wanted to give credit in readme, but everything was converted from Java to Scala and structurally changed.
   
   ### todo
   - [x] replace other resources with ISO Sch distribution
   - [x] remove the Extract resources
   - [x] move to schematron package
   - [x] "update the root LICENSE file to include the MIT license and a listing of these files that are MIT licensed"
   - [ ] "We must also add a LICENSE file, similar to the root one but with only the stuff specific to daffodil-schematron to ``daffodil-schematron/src/main/resrouces/METAINF/{LICENSE,NOTICE"
   
   I can address this later today

##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       > Did you add the Apache license or did you get it from Apache Camel like that?
   
   It does look like the Camel project adds the Apache header.  I had only compared the manifest from Camel with the ISO Schematron 2 distribution, not the file contents.  The best way from here is to replace all of these with the files from the official distribution, which only have the MIT header.
   
   The Extract* files are a special case, not part of the distribution.  Will dig deeper for authoritative source on those, I see a couple different versions floating around.  Ill pull those out and put in the next PR, which makes more sense anyways.
   
   > I think you also mentioned some of this came from Apache Camel?
   
   The resources came from over there, but are going to be replaced with the standard distribution, nothing else remains a direct use.  Overall I used their approach to guide the Scala implementation so wanted to give credit in readme, but everything was converted from Java to Scala and structurally changed.
   
   ### todo
   - [x] replace other resources with ISO Sch distribution
   - [x] remove the Extract resources
   - [x] move to schematron package
   - [x] "update the root LICENSE file to include the MIT license and a listing of these files that are MIT licensed"
   - [x] "We must also add a LICENSE file, similar to the root one but with only the stuff specific to daffodil-schematron to ``daffodil-schematron/src/main/resrouces/METAINF/{LICENSE,NOTICE"
   
   I can address this later today




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



[GitHub] [incubator-daffodil] jw3 commented on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-732216876


   Thinking about the project dependencies; I threw a `core -> schematron` dep in there to quickly test things out, but thats not right...


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



[GitHub] [incubator-daffodil] stevedlawrence commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r534239912



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       Weird. When I tested it I added ``"name.dmaus.schxslt" % "schxslt" % "1.5.2"`` as a depenedency in our build.sbt and ran "sbt dependencyTree" and it didn't show any new transitive dependencies. Maybe these dependencies need to be manually added? Not sure. Whatever you think is fine with me.




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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r520277324



##########
File path: daffodil-lib/src/test/resources/META-INF/services/org.apache.daffodil.api.ValidatorFactory
##########
@@ -0,0 +1,17 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more

Review comment:
       This dot keep is deleted in the other PR




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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r528993078



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+    Extract embedded Schematron schemas in W3C XML Schemas schemas    

Review comment:
       Sounds good.
   
   I have a hacked working version.  Will follow up with draft PR and work on cleaning it up.
   




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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r528903164



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/schematron-skeleton-api.htm
##########
@@ -0,0 +1,757 @@
+<!--

Review comment:
       Looks like this content is available at http://schematron.com/schematron-skeleton-api/
   
   I dont see anything that would require those two files to remain in the resources, will add them in the project level readme and remove the files.




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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r528912729



##########
File path: daffodil-schematron/README.md
##########
@@ -0,0 +1,48 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+Schematron Validation
+===
+
+Daffodil Validator for Schematron
+
+XSLT implementation adapted from the [Camel Schematron Component](https://github.com/apache/camel/tree/master/components/camel-schematron).

Review comment:
       > Adapted in what way?
   
   Adapted as in it was a java implementation that provided the blueprint for loading and constructing the xslt framework.  I converted it to a pure scala implementation.  So maybe "converted" is better than "adapted", I dont know.
   
   The gist of it is I wanted to be sure to point credit back there because I definitely didnt dig into the weeds to understand all of the xslt involved, really just applied heaping amount of scala sugar to their logic.  Which ended up restructuring it quite a bit, but still.
   
   > There are files below that are included (such as a readme.txt) that may not be meaningful in Daffodil context. Were they included by mistake or is there a "include everything" approach
   
   Noted this above in a comment.  I didnt think too hard about it, but I think we can remove them safely after looking over things.
   
   >  .. here where we're only modifying the tree from Camel in minimal ways so as, for example, to facilitate diffs/merges of fixes etc. from Camel to here, or vice versa?
   
   No the "adaptation" here is one-way one-time, any fixes we would notice from their work would be manual ports to ours.




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



[GitHub] [incubator-daffodil] stevedlawrence commented on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-723194622


   Haven't looked at the code yet, just wanted to first verify new dependencies and make sure their licenses allow them to be used/distributed with Daffodil. The new dependencies, including transitive depenencies, and license appear to be:
   
   * ``com.google.code.findbugs:jsr305:3.0.2 (ALv2)``
   * ``com.helger:ph-collection:9.5.1 (ALv2)``
   * ``com.helger:ph-commons:9.5.1 (ALv2)``
   * ``com.helger:ph-jaxb-pom:1.1.0 (ALv2)``
   * ``com.helger:ph-jaxb:9.5.1 (ALv2)``
   * ``com.helger:ph-schematron:5.6.3 (ALv2)``
   * ``com.helger:ph-xml:9.5.1 (ALv2)``
   * ``com.sun.activation:jakarta.activation:1.2.2 (EDL 1.0)``
   * ``com.sun.xml.bind:jaxb-impl:2.3.3 (EDL 1.0)``
   * ``jakarta.xml.bind:jakarta.xml.bind-api:2.3.3 (EDL 1.0)``
   * ``net.sf.saxon:Saxon-HE:10.2 (MPL 2.0)``
   * ``org.slf4j:slf4j-api:1.7.30 (MIT)``
   
   ALv2 is obviously fine to use with Daffodil. EDL and MIT are [category A](https://www.apache.org/legal/resolved.html#category-a), so not a problem to include in both source or binary form. Though, as depedencies, we would only distribute them as a binary.
   
   MPL is [category B](https://www.apache.org/legal/resolved.html#category-b), which is allowed to be distributed, but only in binary form, which should be fine since that's how we would distribute it. Though there are caveats that we include a prominent notice in a README or something.
   
   So from a purely licesning point of view, I think this should all be fine. We will need to inspect all these dependencies to see if they have NOTICE files, and include them in our daffodil-cli/bin.NOTICE. We also need to update the daffodil-cli/bin.LICENSE file with the files that are not Apache license. So there's a decent amount of work to ensure the licensing meetgs Apache standards.
   
   Also, it kindof feels like a lot of extra dependencies that we might not necessarily use, for example slf4j seems maybe unnecessary. It about doubles the size of our dependencies. Daffodil jars are about 24MB, existing deps ware 8.9MB, new deps are 9.1MB (half of that is Saxon-HE). It sort of feels unfortunate to double the size of deps just for schematron. Not sure that's a blocker, but maybe some of these dependencies aren't needed and can be excluded?
   
   Or perhaps there are alternativ implementations that provide the functionality/performance we need? Also, I believe schematron is usually just implemented via XSLT, so could perhaps just be implemented via an XSLT library?


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



[GitHub] [incubator-daffodil] jw3 edited a comment on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 edited a comment on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-732216876


   Thinking about the project dependencies; I threw a `core -> schematron` dep in there to quickly test things out, but thats not right...
   
   A `cli -> schematron % Runtime` might be as much as is needed. (assuming you want schematron available by default on CLI)


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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r528916226



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+    Extract embedded Schematron schemas in W3C XML Schemas schemas    

Review comment:
       Work on this in a follow up PR, or is something needed in this one?




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



[GitHub] [incubator-daffodil] jw3 edited a comment on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 edited a comment on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-726490977


   This looks better dependency wise I think.  Only add was `net.sf.saxon:Saxon-HE:10.2`
   
   Thoughts on bringing the Camel components in this way?  Depending on the artifact would drag in unwanted parts.


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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r533322810



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       > Did you add the Apache license or did you get it from Apache Camel like that?
   
   It does look like the Camel project adds the Apache header.  I had only compared the manifest from Camel with the ISO Schematron 2 distribution, not the file contents.  The best way from here is to replace all of these with the files from the official distribution, which only have the MIT header.
   
   The Extract* files are a special case, not part of the distribution.  Will dig deeper for authoritative source on those, I see a couple different versions floating around.  Ill pull those out and put in the next PR, which makes more sense anyways.
   
   > I think you also mentioned some of this came from Apache Camel?
   
   The resources came from over there, but are going to be replaced with the standard distribution, nothing else remains a direct use.  Overall I used their approach to guide the Scala implementation so wanted to give credit in readme, but everything was converted from Java to Scala and heavily changed.
   
   ### todo
   - [ ] remove the Extract resources
   - [ ] replace other resources with ISO Sch distribution
   
   I can address this later today

##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       > Did you add the Apache license or did you get it from Apache Camel like that?
   
   It does look like the Camel project adds the Apache header.  I had only compared the manifest from Camel with the ISO Schematron 2 distribution, not the file contents.  The best way from here is to replace all of these with the files from the official distribution, which only have the MIT header.
   
   The Extract* files are a special case, not part of the distribution.  Will dig deeper for authoritative source on those, I see a couple different versions floating around.  Ill pull those out and put in the next PR, which makes more sense anyways.
   
   > I think you also mentioned some of this came from Apache Camel?
   
   The resources came from over there, but are going to be replaced with the standard distribution, nothing else remains a direct use.  Overall I used their approach to guide the Scala implementation so wanted to give credit in readme, but everything was converted from Java to Scala and heavily changed.
   
   ### todo
   - [x] remove the Extract resources
   - [ ] replace other resources with ISO Sch distribution
   
   I can address this later today




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



[GitHub] [incubator-daffodil] jw3 edited a comment on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 edited a comment on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-723137209


   Draft based on #431, will rebase once thats merged.
   
   ### draft todo
   - [X] import from [reference impl](https://github.com/ctc-oss/daffodil-schematron-validator)
   - [x] rebase after #431
   - [x] tests
   - [x] todos
   - [x] doc
   


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



[GitHub] [incubator-daffodil] jw3 edited a comment on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 edited a comment on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-723137209






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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r533322810



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       > Did you add the Apache license or did you get it from Apache Camel like that?
   
   It does look like the Camel project adds the Apache header.  I had only compared the manifest from Camel with the ISO Schematron 2 distribution, not the file contents.  The best way from here is to replace all of these with the files from the official distribution, which only have the MIT header.
   
   The Extract* files are a special case, not part of the distribution.  Will dig deeper for authoritative source on those, I see a couple different versions floating around.  Ill pull those out and put in the next PR, which makes more sense anyways.
   
   > I think you also mentioned some of this came from Apache Camel?
   
   The resources came from over there, but are going to be replaced with the standard distribution, nothing else remains a direct use.  Overall I used their approach to guide the Scala implementation so wanted to give credit in readme, but everything was converted from Java to Scala and structurally changed.
   
   ### todo
   - [x] replace other resources with ISO Sch distribution
   - [x] remove the Extract resources
   - [x] move to schematron package
   - [ ] "update the root LICENSE file to include the MIT license and a listing of these files that are MIT licensed"
   - [ ] "We must also add a LICENSE file, similar to the root one but with only the stuff specific to daffodil-schematron to ``daffodil-schematron/src/main/resrouces/METAINF/{LICENSE,NOTICE"
   
   I can address this later today




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



[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r528916956



##########
File path: daffodil-schematron/README.md
##########
@@ -0,0 +1,48 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+Schematron Validation
+===
+
+Daffodil Validator for Schematron
+
+XSLT implementation adapted from the [Camel Schematron Component](https://github.com/apache/camel/tree/master/components/camel-schematron).

Review comment:
       So please add these points to the README.md so that we have captured that this is a scala adaptation.
   
   Probably worth it to capture in here also the exact git hash of the Camel version you took this from, that way we can robustly diff to see if fixes have happened to it, and apply them. 




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



[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r520028596



##########
File path: daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
##########
@@ -391,7 +402,7 @@ class CLIConf(arguments: Array[String]) extends scallop.ScallopConf(arguments)
     val threads = opt[Int](short = 't', argName = "threads", default = Some(1), descr = "The number of threads to use.")
     val path = opt[String](argName = "path", descr = "path to the node to create parser.")
     val parser = opt[File](short = 'P', argName = "file", descr = "use a previously saved parser.")
-    val validate: ScallopOption[ValidationMode.Type] = opt[ValidationMode.Type](short = 'V', default = Some(ValidationMode.Off), argName = "mode", descr = "the validation mode. 'on', 'limited' or 'off'.")
+    val validate: ScallopOption[ValidationMode.Type] = opt[ValidationMode.Type](short = 'V', default = Some(ValidationMode.Off), argName = "mode", descr = "the validation mode. 'on', 'limited', 'off', or spi name.")

Review comment:
       Lines too long. Hard to review.
   "spi name" is just going to confuse. How about "validator extension name" or something like that. 

##########
File path: daffodil-lib/src/test/scala/org/apache/daffodil/validation/TestValidatorsSPI.scala
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.validation
+
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertThrows
+import org.junit.Assert.assertTrue
+import org.junit.Test
+
+class TestValidatorsSPI {
+  val schema = getClass.getResource("/test/validation/testSchema1.dfdl.xsd").toURI.toString
+  val infoset = getClass.getResourceAsStream("/test/validation/testData1Infoset.xml")
+
+  @Test def testValidatorGetNotFoundThrows(): Unit = {
+    assertThrows(classOf[ValidatorNotRegisteredException], () => Validators.get("dont exist"))

Review comment:
       Note/FYI: we also have an Intercept implicit that can be used to do this sort of checking. Search tests for "intercept[".
   Honestly I did not even know of assertThrows until now, but it makes sense that it would be in junit. 

##########
File path: daffodil-lib/src/test/scala/org/apache/daffodil/validation/ValidatorSPISupport.scala
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.validation
+
+import java.io.InputStream
+
+import com.typesafe.config.Config
+import org.apache.daffodil.api.ValidationFailure
+import org.apache.daffodil.api.ValidationResult
+import org.apache.daffodil.api.ValidationWarning
+import org.apache.daffodil.api.Validator
+import org.apache.daffodil.api.ValidatorFactory
+
+class PassingValidatorFactory extends ValidatorFactory {
+  def name(): String = PassingValidator.name
+  def make(config: Config): Validator = new TestingValidatorSPI(Seq.empty, Seq.empty)
+}
+object PassingValidator {
+  val name = "passing-validator"
+}
+
+class FailingValidatorFactory extends ValidatorFactory {
+  def name(): String = FailingValidator.name
+  def make(config: Config): Validator = new TestingValidatorSPI(Seq.empty, Seq(ValFail("boom")))

Review comment:
       I'd swear I'm reading this code the second time now. Didn't we already have this above? Or was that Java code?

##########
File path: daffodil-lib/src/test/resources/META-INF/services/org.apache.daffodil.api.ValidatorFactory
##########
@@ -0,0 +1,17 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more

Review comment:
       Comment about the .keep file above that this interface won't let me put a comment on.
   
   I think we don't need this .keep file. 

##########
File path: daffodil-sapi/src/main/scala/org/apache/daffodil/sapi/Daffodil.scala
##########
@@ -105,6 +106,10 @@ object ValidationMode extends Enumeration {
   val Off = Value(10)
   val Limited = Value(20)
   val Full = Value(30)
+
+  case class Custom(v: Validator) extends ValidationMode {

Review comment:
       After this Validator stuff, we have to figure out how to get rid of the redundancy this API/JAPI/SAPI stuff creates. There is way too much stuff to keep in sync, and way too much duplication, and it gets in the way of easy-extensibility terribly. 

##########
File path: daffodil-schematron/src/test/scala/org/apache/daffodil/validation/ConvertSch.scala
##########
@@ -0,0 +1,14 @@
+package org.apache.daffodil.validation
+//import org.scalatest.{Matchers, WordSpec}
+//
+//
+//class ConvertSch extends WordSpec with Matchers {

Review comment:
       Why commented out?




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



[GitHub] [incubator-daffodil] jw3 edited a comment on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 edited a comment on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-723137209


   Draft based on #431, will rebase once thats merged.
   
   todo
   - [X] implementation
   - [ ] tests
   - [ ] doc
   - [ ] rebase after #431
   


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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r528976036



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+    Extract embedded Schematron schemas in W3C XML Schemas schemas    

Review comment:
       Took a pass at it, doesnt seem like a quick patch... here is a reference http://www.topologi.com/resources/schtrn_xsd_paper.html




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



[GitHub] [incubator-daffodil] stevedlawrence commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r532894014



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       Looks like this and other xsl files are licensed as both MIT and Apache? I'm not sure if that's correct. Did you add the Apache license or did you get it from Apache Camel like that?
   
   If this is actually MIT licensed and the Apache header was incorrectly added, because we're including this in source, we must also update the root LICENSE file to include the MIT license and a listing of these files that are MIT licensed (see the "subcomponent" stuff near the end. We must also add a LICENSE file, similar to the root one but with only the stuff specific to daffodil-schematron to  ``daffodil-schematron/src/main/resrouces/METAINF/{LICENSE,NOTICE}. This license/notice is included in the compiled jar and so is specific to it.
   
   We must also update the daffodil-cli/bin.LICENSE and daffodil-cli/bin.NOTICE files if the daffodil-schematron jar (and it's dependencies) will will be bundled in that CLI zip/tar/rpm/msi.
   
   I think you also mentioned some of this came from Apache Camel? If so, we need to add the camel NOTICE information to the root NOTICE file, and the NOTICE file in ``daffodil-schemtron/src/main/resources/METAINF/NOTICE``. But it feels like maybe Apache Camel did not do the licesning correctly? We can't simply add an Apache license to something that is already MIT licensed.




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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r520273091



##########
File path: daffodil-schematron/src/test/scala/org/apache/daffodil/validation/ConvertSch.scala
##########
@@ -0,0 +1,14 @@
+package org.apache.daffodil.validation
+//import org.scalatest.{Matchers, WordSpec}
+//
+//
+//class ConvertSch extends WordSpec with Matchers {

Review comment:
       Its a scalatest spec from the other repo.  Tests are still on the todo here...




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



[GitHub] [incubator-daffodil] jw3 edited a comment on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 edited a comment on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-723137209


   Draft based on #431, will rebase once thats merged.
   
   todo
   - [X] import from [reference impl](https://github.com/ctc-oss/daffodil-schematron-validator)
   - [ ] tests
   - [ ] doc
   - [ ] rebase after #431
   


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



[GitHub] [incubator-daffodil] jw3 commented on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-724703496


   So the concern is for the additional 9MB of dependencies incurred on the Daffodil development side?  Since the client side would be opt-in and would incur the cost regardless of how you maintain this. 
   
   Weigh the cost of 9MB of artifacts vs the overhead of another repo to integrate this.... and there are likely a list of both pros and cons to either approach, could go either way.
   
   I dont have strong opinions, but am happy to shuffle this code however is best for the overall project.


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



[GitHub] [incubator-daffodil] mbeckerle commented on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
mbeckerle commented on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-728366905


   The camel schematron appears to support schematron rules embedded in XML Schema, which is the preferred thing vs. just a pure schematron file. So that would be cool. 
   
   Nevertheless I would not hold back this change for that enhancement vs. the more basic *.sch file behvior. The schematron-in-XSD way can come later. 


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



[GitHub] [incubator-daffodil] jw3 edited a comment on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 edited a comment on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-723137209


   Draft based on #431, will rebase once thats merged.
   
   draft todo
   - [X] import from [reference impl](https://github.com/ctc-oss/daffodil-schematron-validator)
   - [ ] tests
   - [ ] doc
   - [ ] rebase after #431
   


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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r533322810



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       > Did you add the Apache license or did you get it from Apache Camel like that?
   
   It does look like the Camel project adds the Apache header.  I had only compared the manifest from Camel with the ISO Schematron 2 distribution, not the file contents.  The best way from here is to replace all of these with the files from the official distribution, which only have the MIT header.
   
   The Extract* files are a special case, not part of the distribution.  Will dig deeper for authoritative source on those, I see a couple different versions floating around.  Ill pull those out and put in the next PR, which makes more sense anyways.
   
   > I think you also mentioned some of this came from Apache Camel?
   
   The resources came from over there, but are going to be replaced with the standard distribution, nothing else remains a direct use.  Overall I used their approach to guide the Scala implementation so wanted to give credit in readme, but everything was converted from Java to Scala and structurally changed.
   
   ### todo
   - [x] remove the Extract resources
   - [ ] replace other resources with ISO Sch distribution
   
   I can address this later today




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



[GitHub] [incubator-daffodil] jw3 commented on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-726490977


   This looks better dependency wise I think.  Only add was `net.sf.saxon:Saxon-HE:10.2`
   
   Still a ways to go, some additional parsing work to get things flowing again.
   
   Thoughts on bringing the Camel components in this way?  Depending on the artifact would drag in unwanted parts.


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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r530057069



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+    Extract embedded Schematron schemas in W3C XML Schemas schemas    

Review comment:
       #463 




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



[GitHub] [incubator-daffodil] stevedlawrence commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r534228919



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       Yeah, I'd say it's safest to just get things directly from the source. Following your link, it looks like https://github.com/schxslt/schxslt has become the latest for the XSLT schematron implementation. That doesn't mention anything about Apache license, but it's MIT which is fine as long as we update the various LICENSE files appropriately. Let me know if anything is unclear about where to make license updates.
   
   Though, looking some more at schxslt, it looks like there's also some java classes for it:
   
   https://github.com/schxslt/schxslt-java
   
   Which appears to be available on maven:
   
   https://search.maven.org/artifact/name.dmaus.schxslt/schxslt/1.5.2/jar
   
   That's also MIT licensed--it might be worth using that library to replace some the code in this commit. The less we have to maintain the better.  A quick test shows it doesn't even pull in any dependencies I think, which is nice.




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



[GitHub] [incubator-daffodil] jw3 commented on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-723137209


   Draft based on #431, will rebase once thats merged.


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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r533672416



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       The schematron readme and site does say it is available under MIT _and_ Apache licenses
   
   https://schematron.com/front-page/the-schematron-skeleton-implementation/
   
   and in the schematron repo there are various parts that are licensed under apache 2.0, but not these resources.
   
   Im not sure what it all means, but still seems like the simplest thing to do is replace all the files using the distro zip.
   

##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       > Did you add the Apache license or did you get it from Apache Camel like that?
   
   It does look like the Camel project adds the Apache header.  I had only compared the manifest from Camel with the ISO Schematron 2 distribution, not the file contents.  The best way from here is to replace all of these with the files from the official distribution, which only have the MIT header.
   
   The Extract* files are a special case, not part of the distribution.  Will dig deeper for authoritative source on those, I see a couple different versions floating around.  Ill pull those out and put in the next PR, which makes more sense anyways.
   
   > I think you also mentioned some of this came from Apache Camel?
   
   The resources came from over there, but are going to be replaced with the standard distribution, nothing else remains a direct use.  Overall I used their approach to guide the Scala implementation so wanted to give credit in readme, but everything was converted from Java to Scala and structurally changed.
   
   ### todo
   - [x] replace other resources with ISO Sch distribution
   - [x] remove the Extract resources
   - [x] move to schematron package
   
   I can address this later today




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



[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r528877817



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/schematron-skeleton-api.htm
##########
@@ -0,0 +1,757 @@
+<!--

Review comment:
       Do we need this file in our schematron embodiment. Can we instead just reference doc in some location for iso schematron?

##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+    Extract embedded Schematron schemas in W3C XML Schemas schemas    

Review comment:
       So this makes me think this implementation can handle schematron rules embedded in the DFDL schema, but I didn't see tests for this. 
   
   That's ok for now, but this is very (very) desirable to centralize the schematron rules in the DFDL schema in many cases, so we should add tests for this to illustrate how it works, and if for some reason it does not, add a JIRA ticket for activating/fixing that feature. 

##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/readme.txt
##########
@@ -0,0 +1,100 @@
+<h1>ISO SCHEMATRON 2010</h1>

Review comment:
       In the context of Daffodil, this file is a bit misleading. I understand including it purely for completeness (include all of it, to be clear nothing subset-wise is going on.) Is that the rationale for including this? 
   
   If so then I would suggest the daffodil-schematron/README.md file contain explanation about including *everything* without exception, vs. picking and choosing just what is required. 

##########
File path: daffodil-schematron/src/main/scala/org/apache/daffodil/validation/Schematron.scala
##########
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.validation
+
+import java.io.InputStream
+import java.io.StringWriter
+
+import javax.xml.parsers.ParserConfigurationException
+import javax.xml.parsers.SAXParserFactory
+import javax.xml.transform.Source
+import javax.xml.transform.Templates
+import javax.xml.transform.TransformerFactory
+import javax.xml.transform.URIResolver
+import javax.xml.transform.dom.DOMResult
+import javax.xml.transform.dom.DOMSource
+import javax.xml.transform.sax.SAXSource
+import javax.xml.transform.stream.StreamResult
+import javax.xml.transform.stream.StreamSource
+import org.apache.daffodil.api.ValidatorInitializationException
+import org.xml.sax.InputSource
+import org.xml.sax.SAXException
+import org.xml.sax.XMLReader
+
+
+/**
+ * Schematron engine implementation
+ */
+object Schematron {
+  val templatesRootDir = "iso-schematron-xslt2"
+  private val templatesPipeline = Array("iso_dsdl_include.xsl",
+                                        "iso_abstract_expand.xsl",
+                                        "iso_svrl_for_xslt2.xsl")
+
+  def fromRules(rules: Templates) = new Schematron(xmlReader.get(), rules)
+
+  def templatesFor(sch: InputStream, tf: TransformerFactory): Templates = tf.newTemplates(
+    templatesPipeline.foldLeft(new StreamSource(sch): Source) {
+      (source, template) =>
+        val xsl = getClass.getClassLoader.getResourceAsStream(s"$templatesRootDir/$template")
+        val result: DOMResult = new DOMResult
+        tf.newTransformer(new StreamSource(xsl)).transform(source, result)
+        new DOMSource(result.getNode)
+    }
+  )
+
+  def isoTemplateResolver(child: Option[URIResolver]) = new ClassPathUriResolver(Schematron.templatesRootDir, child)
+
+  // reduce overhead by caching the xml reader, but the SAXParser class is not thread safe so use a thread local
+  private val xmlReader = new ThreadLocal[XMLReader] {
+    override def initialValue(): XMLReader = {
+      val fac = SAXParserFactory.newInstance
+      try {
+        fac.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true)
+        fac.setFeature("http://xml.org/sax/features/external-general-entities", false)
+        fac.setFeature("http://xml.org/sax/features/external-parameter-entities", false)
+        fac.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
+      } catch {
+        case ex@(_: ParserConfigurationException | _: SAXException) =>
+          throw ValidatorInitializationException(s"Error setting feature on parser: ${ex.getMessage}")
+      }
+      fac.setValidating(false)
+      fac.newSAXParser.getXMLReader
+    }
+  }
+}
+
+final class Schematron private(reader: XMLReader, templates: Templates) {
+  private lazy val transformer = templates.newTransformer
+
+  def validate(is: InputStream): String = {
+    val writer = new StringWriter
+    transformer.transform(new SAXSource(reader, new InputSource(is)), new StreamResult(writer))

Review comment:
       Sweet. All the overhead is compile/startup/first-use time, and at parse time we do this one call, then extract diagnostics from its output. Nice. 

##########
File path: daffodil-schematron/README.md
##########
@@ -0,0 +1,48 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+Schematron Validation
+===
+
+Daffodil Validator for Schematron
+
+XSLT implementation adapted from the [Camel Schematron Component](https://github.com/apache/camel/tree/master/components/camel-schematron).

Review comment:
       Adapted in what way?
   There are files below that are included (such as a readme.txt) that may not be meaningful in Daffodil context. Were they included by mistake or is there a "include everything" approach here where we're only modifying the tree from Camel in minimal ways so as, for example, to facilitate diffs/merges of fixes etc. from Camel to here, or vice versa?




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



[GitHub] [incubator-daffodil] stevedlawrence commented on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-724852072


   > So the concern is for the additional 9MB of dependencies incurred on the Daffodil development side? Since the client side would be opt-in and would incur the cost regardless of how you maintain this.
   > 
   > Weigh the cost of 9MB of artifacts vs the overhead of another repo to integrate this.... and there are likely a list of both pros and cons to either approach, could go either way.
   
   I'm not all that concerened about 9MB. I'm really just curious if there is a solution that uses our existing dependencies (e.g. xerces) or something Java or Apache provided. It seems that an XSLT solution, which my understanding is how Schematron is actually implemented, would be more likely to be able to use existing dependencies without loss in functionality.


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



[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r528990618



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+    Extract embedded Schematron schemas in W3C XML Schemas schemas    

Review comment:
       Let's put it off then. No reason to hold this up. 




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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r528922221



##########
File path: daffodil-schematron/README.md
##########
@@ -0,0 +1,48 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+Schematron Validation
+===
+
+Daffodil Validator for Schematron
+
+XSLT implementation adapted from the [Camel Schematron Component](https://github.com/apache/camel/tree/master/components/camel-schematron).

Review comment:
       > So maybe "converted" is better than "adapted", I dont know
   
   I avoided that wordsmithing all together in the latest.
   
   `Scala implementation based on the [Camel Schematron Component]...`




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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r528976036



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+    Extract embedded Schematron schemas in W3C XML Schemas schemas    

Review comment:
       Took a quick pass at it, doesnt seem like a quick patch... here is a reference http://www.topologi.com/resources/schtrn_xsd_paper.html




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



[GitHub] [incubator-daffodil] jw3 commented on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-725454915


   The Camel Schematron implementation might provide a blueprint
   
   https://github.com/apache/camel/tree/master/components/camel-schematron
   
   Ill make some time to put together an implementation that follows their approach for comparison.
   


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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r528926624



##########
File path: daffodil-schematron/README.md
##########
@@ -0,0 +1,48 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+Schematron Validation
+===
+
+Daffodil Validator for Schematron
+
+XSLT implementation adapted from the [Camel Schematron Component](https://github.com/apache/camel/tree/master/components/camel-schematron).

Review comment:
       > Probably worth it to capture in here also the exact git hash of the Camel version you took this from, that way we can robustly diff to see if fixes have happened to it, and apply them.
   
   yep good call.  done.




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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r533323434



##########
File path: daffodil-schematron/src/main/scala/org/apache/daffodil/validation/ClassPathUriResolver.scala
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.validation

Review comment:
       Can do.  Makes sense.




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



[GitHub] [incubator-daffodil] jw3 edited a comment on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 edited a comment on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-723137209






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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r520277711



##########
File path: daffodil-lib/src/test/scala/org/apache/daffodil/validation/ValidatorSPISupport.scala
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.validation
+
+import java.io.InputStream
+
+import com.typesafe.config.Config
+import org.apache.daffodil.api.ValidationFailure
+import org.apache.daffodil.api.ValidationResult
+import org.apache.daffodil.api.ValidationWarning
+import org.apache.daffodil.api.Validator
+import org.apache.daffodil.api.ValidatorFactory
+
+class PassingValidatorFactory extends ValidatorFactory {
+  def name(): String = PassingValidator.name
+  def make(config: Config): Validator = new TestingValidatorSPI(Seq.empty, Seq.empty)
+}
+object PassingValidator {
+  val name = "passing-validator"
+}
+
+class FailingValidatorFactory extends ValidatorFactory {
+  def name(): String = FailingValidator.name
+  def make(config: Config): Validator = new TestingValidatorSPI(Seq.empty, Seq(ValFail("boom")))

Review comment:
       This was a change from the other PR, and yeah there were two similar sets of tests, one in JAPI and one in SAPI.




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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r528905842



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/readme.txt
##########
@@ -0,0 +1,100 @@
+<h1>ISO SCHEMATRON 2010</h1>

Review comment:
       Yeah, this and the htm are in the official distribution of iso schematron, so I just left it in there without looking too hard.
   
   Looking now I dont see any reason it has to remain.  IMO we can point to the online version of the htm and remove this txt.




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



[GitHub] [incubator-daffodil] jw3 edited a comment on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 edited a comment on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-732216876






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



[GitHub] [incubator-daffodil] jw3 edited a comment on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 edited a comment on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-723137209


   Draft based on #431, will rebase once thats merged.
   
   ### draft todo
   - [X] import from [reference impl](https://github.com/ctc-oss/daffodil-schematron-validator)
   - [ ] tests
   - [ ] doc
   - [ ] rebase after #431
   


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



[GitHub] [incubator-daffodil] jw3 edited a comment on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 edited a comment on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-725454915


   The Camel Schematron project might provide a blueprint
   
   https://github.com/apache/camel/tree/master/components/camel-schematron
   
   Ill make some time to put together an implementation that follows their approach for comparison.
   


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



[GitHub] [incubator-daffodil] stevedlawrence commented on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-737361470


   +1 Changes look good!


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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r528904422



##########
File path: daffodil-schematron/src/main/scala/org/apache/daffodil/validation/Schematron.scala
##########
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.validation
+
+import java.io.InputStream
+import java.io.StringWriter
+
+import javax.xml.parsers.ParserConfigurationException
+import javax.xml.parsers.SAXParserFactory
+import javax.xml.transform.Source
+import javax.xml.transform.Templates
+import javax.xml.transform.TransformerFactory
+import javax.xml.transform.URIResolver
+import javax.xml.transform.dom.DOMResult
+import javax.xml.transform.dom.DOMSource
+import javax.xml.transform.sax.SAXSource
+import javax.xml.transform.stream.StreamResult
+import javax.xml.transform.stream.StreamSource
+import org.apache.daffodil.api.ValidatorInitializationException
+import org.xml.sax.InputSource
+import org.xml.sax.SAXException
+import org.xml.sax.XMLReader
+
+
+/**
+ * Schematron engine implementation
+ */
+object Schematron {
+  val templatesRootDir = "iso-schematron-xslt2"
+  private val templatesPipeline = Array("iso_dsdl_include.xsl",
+                                        "iso_abstract_expand.xsl",
+                                        "iso_svrl_for_xslt2.xsl")
+
+  def fromRules(rules: Templates) = new Schematron(xmlReader.get(), rules)
+
+  def templatesFor(sch: InputStream, tf: TransformerFactory): Templates = tf.newTemplates(
+    templatesPipeline.foldLeft(new StreamSource(sch): Source) {
+      (source, template) =>
+        val xsl = getClass.getClassLoader.getResourceAsStream(s"$templatesRootDir/$template")
+        val result: DOMResult = new DOMResult
+        tf.newTransformer(new StreamSource(xsl)).transform(source, result)
+        new DOMSource(result.getNode)
+    }
+  )
+
+  def isoTemplateResolver(child: Option[URIResolver]) = new ClassPathUriResolver(Schematron.templatesRootDir, child)
+
+  // reduce overhead by caching the xml reader, but the SAXParser class is not thread safe so use a thread local
+  private val xmlReader = new ThreadLocal[XMLReader] {
+    override def initialValue(): XMLReader = {
+      val fac = SAXParserFactory.newInstance
+      try {
+        fac.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true)
+        fac.setFeature("http://xml.org/sax/features/external-general-entities", false)
+        fac.setFeature("http://xml.org/sax/features/external-parameter-entities", false)
+        fac.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
+      } catch {
+        case ex@(_: ParserConfigurationException | _: SAXException) =>
+          throw ValidatorInitializationException(s"Error setting feature on parser: ${ex.getMessage}")
+      }
+      fac.setValidating(false)
+      fac.newSAXParser.getXMLReader
+    }
+  }
+}
+
+final class Schematron private(reader: XMLReader, templates: Templates) {
+  private lazy val transformer = templates.newTransformer
+
+  def validate(is: InputStream): String = {
+    val writer = new StringWriter
+    transformer.transform(new SAXSource(reader, new InputSource(is)), new StreamResult(writer))

Review comment:
       :+1: 




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



[GitHub] [incubator-daffodil] jw3 edited a comment on pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 edited a comment on pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#issuecomment-726490977


   This looks better dependency wise I think.  Only add was `net.sf.saxon:Saxon-HE:10.2`
   
   Ported the Camel component to Scala, simply depending on the artifact would drag in unwanted parts.


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



[GitHub] [incubator-daffodil] stevedlawrence merged pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
stevedlawrence merged pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452


   


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



[GitHub] [incubator-daffodil] jw3 commented on a change in pull request #452: Schematron Validation

Posted by GitBox <gi...@apache.org>.
jw3 commented on a change in pull request #452:
URL: https://github.com/apache/incubator-daffodil/pull/452#discussion_r533322810



##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       > Did you add the Apache license or did you get it from Apache Camel like that?
   
   It does look like the Camel project adds the Apache header.  I had only compared the manifest from Camel with the ISO Schematron 2 distribution, not the file contents.  The best way from here is to replace all of these with the files from the official distribution, which only have the MIT header.
   
   The Extract* files are a special case, not part of the distribution.  Will dig deeper for authoritative source on those, I see a couple different versions floating around.  Ill pull those out and put in the next PR, which makes more sense anyways.
   
   > I think you also mentioned some of this came from Apache Camel?
   
   The resources came from over there, but are going to be replaced with the standard distribution, nothing else remains a direct use.  Overall I used their approach to guide the Scala implementation so wanted to give credit in readme, but everything was converted from Java to Scala and structurally changed.
   
   ### todo
   - [x] remove the Extract resources
   - [ ] replace other resources with ISO Sch distribution
   - [ ] move to schematron package
   
   I can address this later today

##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       > Did you add the Apache license or did you get it from Apache Camel like that?
   
   It does look like the Camel project adds the Apache header.  I had only compared the manifest from Camel with the ISO Schematron 2 distribution, not the file contents.  The best way from here is to replace all of these with the files from the official distribution, which only have the MIT header.
   
   The Extract* files are a special case, not part of the distribution.  Will dig deeper for authoritative source on those, I see a couple different versions floating around.  Ill pull those out and put in the next PR, which makes more sense anyways.
   
   > I think you also mentioned some of this came from Apache Camel?
   
   The resources came from over there, but are going to be replaced with the standard distribution, nothing else remains a direct use.  Overall I used their approach to guide the Scala implementation so wanted to give credit in readme, but everything was converted from Java to Scala and structurally changed.
   
   ### todo
   - [x] remove the Extract resources
   - [ ] replace other resources with ISO Sch distribution
   - [x] move to schematron package
   
   I can address this later today

##########
File path: daffodil-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
##########
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!--
+	Stylesheet for extracting Schematron information from a RELAX-NG schema.
+	Based on the stylesheet for extracting Schematron information from W3C XML Schema.
+	
+	For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html
+	
+	Created by Eddie Robertsson 2002/06/01
+	Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14
+	MIT licensed 2010-07-10
+-->
+

Review comment:
       > Did you add the Apache license or did you get it from Apache Camel like that?
   
   It does look like the Camel project adds the Apache header.  I had only compared the manifest from Camel with the ISO Schematron 2 distribution, not the file contents.  The best way from here is to replace all of these with the files from the official distribution, which only have the MIT header.
   
   The Extract* files are a special case, not part of the distribution.  Will dig deeper for authoritative source on those, I see a couple different versions floating around.  Ill pull those out and put in the next PR, which makes more sense anyways.
   
   > I think you also mentioned some of this came from Apache Camel?
   
   The resources came from over there, but are going to be replaced with the standard distribution, nothing else remains a direct use.  Overall I used their approach to guide the Scala implementation so wanted to give credit in readme, but everything was converted from Java to Scala and structurally changed.
   
   ### todo
   - [ ] replace other resources with ISO Sch distribution
   - [x] remove the Extract resources
   - [x] move to schematron package
   
   I can address this later today




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