stevedlawrence commented on code in PR #1650:
URL: https://github.com/apache/daffodil/pull/1650#discussion_r3053253404


##########
daffodil-core/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala:
##########
@@ -644,34 +645,70 @@ object XMLUtils {
 
   private def removeMixedWhitespace(ns: Node): Node = {
     if (!ns.isInstanceOf[Elem]) return ns
-    val e = ns.asInstanceOf[Elem]
-    val children = e.child
-    val noMixedChildren =
-      if (children.exists(_.isInstanceOf[Elem])) {
-        children
-          .filter {
-            case Text(data) if data.matches("""\s*""") => false
-            case Text(data) =>
-              throw new Exception("Element %s contains mixed data: 
%s".format(e.label, data))
-            case _ => true
-          }
-          .map(removeMixedWhitespace)
-      } else {
-        children.filter {
+
+    def dropWhitespace(e: Node): Node = {
+      val children = e.child
+      val noWhitespace = children
+        .filter {
           //
           // So this is a bit strange, but we're dropping nodes that are Empty 
String.
           //
           // In XML we cannot tell <foo></foo> where there is a Text("") 
child, from <foo></foo> with Nil children
           //
           case Text("") => false // drop empty strings
+          case Text(data) if data.matches("""\s*""") => false
           case _ => true
         }
+        .map(dropWhitespace)
+      e match {
+        case elem: Elem => elem.copy(child = noWhitespace)
+        case _ => e
       }
+    }
+
+    ns match {
+      case e @ Elem(
+            null,
+            XMLTextInfoset.stringAsXml,
+            Null,
+            NamespaceBinding(null, null | "", _),
+            _*
+          ) =>
+        dropWhitespace(e)

Review Comment:
   It looks like the `dropWhitespace` function recursively drops all 
whitespace, which I'm not sure we want to do. I would expect that infosets that 
use stringAsXML would want to ensure the stringAsXml portion is exactly the 
same, including whitespace.
   
   Instead, maybe we should only expect the stringAsXml element to have a 
single `Elem` child, and any other children should be empty text nodes or we 
should error--that gives the user an indication that the expected stringAsXml 
messed up (or we have have a buggy infoset outputter).
   
   Maybe instead we want something like:
   
   ```scala
   case e @ Elem(..., stringAsXml, ..., children) => {
     val (elemChildren, otherChildren) = e.filter { _.isInstanceOf[Elem] }
     if (elemChildren.length != 1) ... // throw exception, stringAsXml must 
contain a single child element
     nonElemChildren.foreach { c =>
       case Text(data) if data.matches("""\*""") => // no-op, empty text 
siblings are fine
       case _ => ... // throw exception, c is some kind of mixed content not 
allowed as a stringAsXml child
     }
     c.copy(child = elemChildren)
   }
   ```
   This way the only thing we throw away are sibling whitespace `Text` nodes, 
and it also verfies that there is only single child element. 
   
   It's probably also worth adding a comment here explaining that this is 
specifically for the stringAsXml feature and that we avoid making changes to 
any of its children except removing any surrounding whitespace, requiring that 
stringAsXml in the infoset match results exactly.



##########
daffodil-core/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala:
##########
@@ -804,11 +850,23 @@ object XMLUtils {
    * - Removes unnecessary whitespace
    */
   def normalize(n: Node): Node = {
-    val noComments = removeComments(n)
-    val noPCData = convertPCDataToText(noComments)
-    val combinedText = coalesceAllAdjacentTextNodes(noPCData)
-    val noMixedWS = removeMixedWhitespace(combinedText)
-    noMixedWS
+    n match {
+      case x @ Elem(

Review Comment:
   This function is only called on the root element which is rarely going to be 
the stringAsXml element, so I don't think this case will ever really match in 
practice. I think instead the functions below should all have cases to be 
no-ops for the stringAsXml element, similar to what you have for 
removeAttributes1



##########
daffodil-tdml-processor/src/main/scala/org/apache/daffodil/processor/tdml/DaffodilTDMLDFDLProcessor.scala:
##########
@@ -392,7 +397,6 @@ class DaffodilTDMLDFDLProcessor private[tdml] (
       XMLUtils.compareAndReport(
         dpParseXMLNodeOutput,
         saxParseXMLNodeOutput,
-        checkNamespaces = true,

Review Comment:
   Why do we no longer check namespaces? I guess SAX outputs the same 
namespaces as XMLText but not the same as ScalaXML?
   
   I guess it's probably safe to assume that since `checkPrefixes = true` that 
if the namespace prefixes are the same then so are the namespaces? That said, 
if we aren't validating namespace bindings are the same, maybe compareAndReport 
should at least validate that the prefixes resolve to the same namespace? For 
example since in theory you could have different namespace bindings for the 
same prefix. Maybe a check like this:
   
   ```scala
   if (checkPrefixes && a.scope.getURI(prefixA) != b.scope.getURI(prefixB)) {
     List(...)
   }
   ```



##########
daffodil-tdml-processor/src/main/scala/org/apache/daffodil/processor/tdml/DaffodilTDMLDFDLProcessor.scala:
##########
@@ -308,7 +310,10 @@ class DaffodilTDMLDFDLProcessor private[tdml] (
           xri.parse(sis)
 
           if (!actual.isError && !errorHandler.isError) {
-            verifySameParseOutput(outputter.xmlStream, saxOutputStream)
+            val actualOutputArray = 
outputter.getScalaResult.toString.getBytes("UTF-8")

Review Comment:
   It might be worth a comment here explaining that we use the scala result 
because both the ScalaInfosetOutputter and the SAXInfosetOutputter do not 
implement stringAsXml, which helps to avoid any differences cause by the 
stringAsXml conversions.
   
   If we ever modify ScalaXmlInfosetOuttputer to support stringAsXml, this 
might need to change some how.



##########
daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala:
##########
@@ -2800,7 +2800,7 @@ case class DFDLInfoset(di: Node, parent: Infoset) {
     val testSuite = testCase.parent
     val before = testSuite.loadingExceptions.clone()
 
-    val elem = loader.load(infosetSrc, None) // no schema
+    val elem = loader.load(infosetSrc, None, noNormalizations = true) // no 
schema

Review Comment:
   My only concern with disabling normalizations is that we don't remove things 
like comments now. That's important for string as XML, but I feel like that has 
caused problems in the past with pattern matching in the daffodil compiler (for 
example, expecting a `Seq(Elem("foo")` but the children are actually 
`Seq(Comment(..), Elem(foo))`, but maybe the TDML runner doesn't do any of that 
kind of pattern matching to parse TDML files and just uses XML paths to access 
elements, which ignores things like comments?



##########
daffodil-tdml-processor/src/main/scala/org/apache/daffodil/processor/tdml/TDMLInfosetOutputter.scala:
##########
@@ -116,6 +150,7 @@ trait TDMLInfosetOutputter extends 
api.infoset.InfosetOutputter {
   def xmlStream: ByteArrayOutputStream
 
   def getResult: Node
+  def getScalaResult: Node

Review Comment:
   It would be nice if this wasn't required as part of the API. From an TDML 
API it's not clear what the differnce here would be. Seems like this is really 
only needed as part of the Daffodil TdmlOutputterAll?



##########
daffodil-test/src/test/scala/org/apache/daffodil/infoset/TestStringAsXmlValidatorFactory.scala:
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.infoset
+
+import java.util.Properties
+
+import org.apache.daffodil.api.validation.ValidatorFactory
+
+class TestStringAsXmlNamespacedValidatorFactory extends ValidatorFactory {
+  override def name: String = TestStringAsXmlNamespacedValidator.name
+
+  override def make(config: Properties) = new 
TestStringAsXmlNamespacedValidator
+}
+
+class TestStringAsXmlNoNamespaceValidatorFactory extends ValidatorFactory {
+  override def name: String = TestStringAsXmlNoNamespaceValidator.name
+
+  override def make(config: Properties) = new 
TestStringAsXmlNoNamespaceValidator
+}

Review Comment:
   This is an interesting way to support an alternative validators. I like it! 
And I think this could be very useful since I know of custom test harness that 
want to do much more complex validation (e.g. validate with multiple XSD 
validators). They could implement the logic in a custom validator and things 
should just work.
   
   Thoug, I wonder if we could tweak this to make it a bit more generic and 
maybe scalable? I imagine this might be used a reference, so having a example 
that shows one way to support a bunch of different root schemas with a single 
validator might be useful.
   
   For example, maybe rename it something generic like 
`TestStringAsXmlValidatorFactory`, and instead of having a unique validator it 
extracts the "TestStringAsXmlValidator" property from `config` (which is set to 
the path to the DFDL schema) and modifies that to get the root validation 
schema? E.g.
   
   ```scala
   override def make(config: Properties) = {
     val dfdlSchema = config.getProperty(name)
     // assumes the validation XSD path is in the same as the DFDL schema but 
with a different suffix
     val xsdSchema = dfdlSchema.replace(".dfdl.xsd", "WithXmlPayload.xsd")
     new TestStringAsXmlValidator(xsdSchema)
   }
   ```
   
   I imagine most uses will have a single validation XSD, but if they don't 
(like in our tests) this would be a good way to scalably handle it.



##########
daffodil-test/src/test/scala/org/apache/daffodil/infoset/TestStringAsXmlValidator.scala:
##########
@@ -0,0 +1,61 @@
+/*
+ * 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.infoset
+
+import java.io.InputStream
+import java.net.URL
+
+import org.apache.daffodil.api.validation.ValidationHandler
+import org.apache.daffodil.api.validation.Validator
+import org.apache.daffodil.lib.util.Misc
+import org.apache.daffodil.validation.XercesValidator
+
+object TestStringAsXmlNamespacedValidator {
+  val name = "TestStringAsXmlNamespacedValidator"
+}
+
+class TestStringAsXmlNamespacedValidator extends Validator {
+
+  val schemaURL: URL = Misc
+    .getRequiredResource(
+      
"/org/apache/daffodil/infoset/stringAsXml/namespaced/xsd/binMessageWithXmlPayload.xsd"
+    )
+    .toURL
+
+  override def validateXML(document: InputStream, vh: ValidationHandler): Unit 
= {
+    val v = XercesValidator.fromURL(schemaURL)
+    v.validateXML(document, vh)
+  }
+}
+
+object TestStringAsXmlNoNamespaceValidator {
+  val name = "TestStringAsXmlNoNamespaceValidator"
+}
+
+class TestStringAsXmlNoNamespaceValidator extends Validator {
+
+  val schemaURL: URL = Misc
+    .getRequiredResource(
+      
"/org/apache/daffodil/infoset/stringAsXml/nonamespace/xsd/binMessageWithXmlPayload.xsd"
+    )
+    .toURL
+
+  override def validateXML(document: InputStream, vh: ValidationHandler): Unit 
= {
+    val v = XercesValidator.fromURL(schemaURL)

Review Comment:
   The XercesValidator is thread safe and tries to reuse validators instead of 
creating them everytime. So instead of creating one everytime validateXML is 
called, we should create a single one in the constructor of this class so that 
it can be reused if the same DataProcessor is shared among multiple tests 
(which I think the TDML runner tries to do). So this function should literally 
only contain
   
   ```scala
   v.validateXML(docuent, vh)
   ```



##########
daffodil-test/src/test/scala/org/apache/daffodil/infoset/TestStringAsXmlValidatorFactory.scala:
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.infoset
+
+import java.util.Properties
+
+import org.apache.daffodil.api.validation.ValidatorFactory
+

Review Comment:
   Suggset we combine this file with the TestStringAsXmlValidator.scala file. 
It's small enough that I don't think the separate adds a whole lot. And it's 
nice to have al the custom validation logic in a single file for quick 
reference.



##########
daffodil-tdml-processor/src/main/scala/org/apache/daffodil/processor/tdml/DaffodilTDMLDFDLProcessor.scala:
##########
@@ -238,7 +238,7 @@ class DaffodilTDMLDFDLProcessor private[tdml] (
   ): TDMLUnparseResult = {
     val dafpr = parseResult.asInstanceOf[DaffodilTDMLParseResult]
     val inputter = dafpr.inputter
-    val resNode = dafpr.getResult
+    val resNode = dafpr.getScalaResult

Review Comment:
   What happens if DAFFODIL_TDML_API_INFOSETS is "xml", then I think there 
wont' be a scala result?



##########
daffodil-test/src/test/resources/org/apache/daffodil/infoset/stringAsXML.tdml:
##########
@@ -0,0 +1,89 @@
+<?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.
+-->
+
+<testSuite suiteName="StringAsXML" description="StringAsXML TDML tests"
+                xmlns="http://www.ibm.com/xmlns/dfdl/testData";
+                xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData";
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+                xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/";
+                xmlns:xs="http://www.w3.org/2001/XMLSchema";
+                xmlns:ex="http://example.com";
+                defaultValidation="off">

Review Comment:
   Should we set the default validation so we don't have to repeat it in the 
tests?



##########
daffodil-tdml-processor/src/main/scala/org/apache/daffodil/processor/tdml/DaffodilTDMLDFDLProcessor.scala:
##########
@@ -268,8 +268,10 @@ class DaffodilTDMLDFDLProcessor private[tdml] (
   ): TDMLParseResult = {
     val outputter = if (tdmlApiInfosetsEnv == "all") {
       TDMLInfosetOutputterAll()
-    } else {
+    } else if (tdmlApiInfosetsEnv == "scala") {
       TDMLInfosetOutputterScala()

Review Comment:
   Do we need this outputter? Feels like we really just need the core XML one, 
and then the all one used for CI to makes sure all of our infoset 
inputters/outputters do the same thing.



##########
daffodil-core/src/main/scala/org/apache/daffodil/lib/xml/DaffodilConstructingLoader.scala:
##########
@@ -94,13 +94,15 @@ object Position {
  *                          behavior of normalizing CRLF to LF, and solitary 
CR to LF.
  *                          Defaults to true. Should only be changed in 
special circumstances
  *                          as not normalizing CRLFs is non-standard for XML.
- *
+ * @param noNormalizations True to not remove comments and processing 
instructions and to not normalize
+ *                       CRLF/CR to LF. This is used to keep the XML as close 
to the original as possible

Review Comment:
   I don't love the name `noNormalizations`--setting noNormalizations=false is 
kidnof a double negative and a bit tricky to make sense of, and it also kindof 
makes it so normalizeCRLFtoLF is ignored if true. I would maybe suggest we just 
add additional flags for the specific behaviors (e.g. `removeComments` and 
`removeProcInstr`). It makes it clear exactly what those flags will do and 
gives control to users about exactly what they want to keep. I imagine in most 
cases `normalizeCRLF`, `removeComments`, and `removeProcInstr` will all be set 
to the same thing (a user either wants everything removed or everything kept), 
but it at least gives the option.



##########
daffodil-core/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala:
##########
@@ -953,6 +1011,28 @@ Differences were (path, expected, actual):
         } else if (checkPrefixes && prefixA != prefixB) {
           // different prefix
           List((zPath + "/" + labelA + "@prefix", prefixA, prefixB))
+        } else if (
+          checkPrefixes && prefixA != null && a.getNamespace(prefixA) != 
nsbA.getURI(prefixA)
+        ) {
+          // prefix doesn't resolve to namespace
+          List(
+            (
+              zPath + "/" + labelA + "@prefix-uri",
+              nsbA.getURI(prefixA),
+              a.getNamespace(prefixA)
+            )
+          )
+        } else if (
+          checkPrefixes && prefixB != null && b.getNamespace(prefixB) != 
nsbB.getURI(prefixB)
+        ) {
+          // prefix doesn't resolve to namespace
+          List(
+            (
+              zPath + "/" + labelA + "@prefix-uri",
+              nsbB.getURI(prefixB),
+              b.getNamespace(prefixB)
+            )
+          )

Review Comment:
   Is it possible for these new checks to fail? I thought we validated the 
expected infoset to make sure it was valid, which I think should check to make 
sure namespaces resolve?         



##########
daffodil-tdml-processor/src/main/scala/org/apache/daffodil/processor/tdml/TDMLInfosetInputter.scala:
##########
@@ -100,7 +99,10 @@ class TDMLInfosetInputter(
     }
 
     if (!othersmatch)
-      throw TDMLException("getSimpleText does not match", Some(implString))
+      throw TDMLException(
+        s"getSimpleText does not match for $res 
${others.zip(otherStrings).mkString("\n")}",

Review Comment:
   Do we need a new line after $res? Otherwise the first other/otherStrings 
will be on the same line as res but all the remaining others will be on new 
lines? Shoudl we also do this similar change for the other functions that 
confirm the others are the same? Seems like this is useful information to have 
in general since it usually indicates a bug.



##########
daffodil-tdml-processor/src/main/scala/org/apache/daffodil/processor/tdml/TDMLInfosetOutputter.scala:
##########
@@ -36,31 +35,60 @@ import 
org.apache.daffodil.runtime1.infoset.W3CDOMInfosetOutputter
 import org.apache.daffodil.runtime1.infoset.XMLTextInfosetInputter
 import org.apache.daffodil.runtime1.infoset.XMLTextInfosetOutputter
 
-class TDMLInfosetOutputterScala(scalaOut: ScalaXMLInfosetOutputter)
-  extends TeeInfosetOutputter(Seq(scalaOut)*)
+class TDMLInfosetOutputterScala(
+  scalaOut: ScalaXMLInfosetOutputter,
+  override val xmlStream: ByteArrayOutputStream,
+  xmlOut: XMLTextInfosetOutputter
+) extends TeeInfosetOutputter(Seq(scalaOut, xmlOut)*)
   with TDMLInfosetOutputter {
 
-  override def getResult: Node = scalaOut.getResult()
-
-  override lazy val xmlStream: ByteArrayOutputStream = {
-    val bos = new ByteArrayOutputStream()
-    bos.write(getResult.toString().getBytes(Charset.defaultCharset()))
-    bos
-  }
+  override def getResult: Node =
+    scala.xml.XML.load(new ByteArrayInputStream(xmlStream.toByteArray))
 
   override def toInfosetInputter: TDMLInfosetInputter = {
     val scalaIn = new ScalaXMLInfosetInputter(scalaOut.getResult())
     new TDMLInfosetInputter(scalaIn, Seq())
   }
+
+  override def getScalaResult: Node = scalaOut.getResult()
 }
 
 object TDMLInfosetOutputterScala {
   def apply(): TDMLInfosetOutputterScala = {
     val scalaOut = new ScalaXMLInfosetOutputter()
-    new TDMLInfosetOutputterScala(scalaOut)
+    val baos = new ByteArrayOutputStream()
+    val xmlOut = new XMLTextInfosetOutputter(baos, true)
+    new TDMLInfosetOutputterScala(scalaOut, baos, xmlOut)
+  }
+}
+
+object TDMLInfosetOutputterXML {
+  def apply(): TDMLInfosetOutputterXML = {
+    val baos = new ByteArrayOutputStream()
+    val xmlOut = new XMLTextInfosetOutputter(baos, true)
+    val scalaOut = new ScalaXMLInfosetOutputter()
+    new TDMLInfosetOutputterXML(baos, xmlOut, scalaOut)
   }
 }
 
+class TDMLInfosetOutputterXML(
+  override val xmlStream: ByteArrayOutputStream,
+  xmlOut: XMLTextInfosetOutputter,
+  scalaOut: ScalaXMLInfosetOutputter
+) extends TeeInfosetOutputter(Seq(xmlOut, scalaOut)*)
+  with TDMLInfosetOutputter {
+
+  override def getResult: Node =
+    scala.xml.XML.load(new ByteArrayInputStream(xmlStream.toByteArray))
+
+  override def toInfosetInputter: TDMLInfosetInputter = {
+    val xmlIn = new XMLTextInfosetInputter(new 
ByteArrayInputStream(xmlStream.toByteArray))
+    new TDMLInfosetInputter(xmlIn, Seq())
+  }
+
+  override def getScalaResult: Node = scalaOut.getResult()
+}

Review Comment:
   Is it possible to aoid the XML and Scala XML infoset inputtesr/outputtesr 
needing the other one? We intentionally split the TDMLInfosetOutputter into 
Scala and All variants so that in the common case we could avoid creating 
duplicate infoset outputters that most users won't care about, but it seems 
we're moving back to that. Can we avoid this some how? It's not clear to me why 
we need both the scala and xml infoset inputtesr/outputters in the normal case. 
It makes sense in the ALL case to have something to compare against the sax 
result, but that case is already creating a bunch of infoset 
inputtesr/outputters so it's expected. It feels like getScalaResult only wants 
to be available and used in the All case when comparing against the SAX result.



##########
daffodil-tdml-processor/src/main/scala/org/apache/daffodil/processor/tdml/TDMLInfosetOutputter.scala:
##########
@@ -97,7 +131,7 @@ object TDMLInfosetOutputterAll {
     val jdomOut = new JDOMInfosetOutputter()
     val w3cdomOut = new W3CDOMInfosetOutputter()
     val jsonOut = new JsonInfosetOutputter(jsonStream, false)
-    val xmlOut = new XMLTextInfosetOutputter(xmlStream, false)
+    val xmlOut = new XMLTextInfosetOutputter(xmlStream, true)

Review Comment:
   Is this needed? I think this the the pretty flag? Seems like things should 
still work with not using pretty output.



##########
daffodil-test/src/test/resources/org/apache/daffodil/infoset/stringAsXML.tdml:
##########
@@ -0,0 +1,89 @@
+<?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.
+-->
+
+<testSuite suiteName="StringAsXML" description="StringAsXML TDML tests"
+                xmlns="http://www.ibm.com/xmlns/dfdl/testData";
+                xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData";
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+                xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/";
+                xmlns:xs="http://www.w3.org/2001/XMLSchema";
+                xmlns:ex="http://example.com";
+                defaultValidation="off">
+
+  <parserTestCase name="stringAsXml_01_a" root="binMessage"
+                       
model="/org/apache/daffodil/infoset/stringAsXml/namespaced/xsd/binMessage.dfdl.xsd"
+                       validation="TestStringAsXmlNamespacedValidator">
+    <document>
+      <documentPart 
type="file">stringAsXml/namespaced/binMessage_01.dat</documentPart>
+    </document>
+    <infoset>
+      <dfdlInfoset 
type="file">stringAsXml/namespaced/binMessage_01.dat.xml</dfdlInfoset>
+    </infoset>
+  </parserTestCase>
+  
+  <parserTestCase name="stringAsXml_01_b" root="binMessage"
+                       
model="/org/apache/daffodil/infoset/stringAsXml/namespaced/xsd/binMessage.dfdl.xsd"
+                       validation="on">
+    <document>
+      <documentPart 
type="file">stringAsXml/namespaced/binMessage_01.dat</documentPart>
+    </document>
+    <infoset>
+      <dfdlInfoset 
type="file">stringAsXml/namespaced/binMessage_01.dat.xml</dfdlInfoset>
+    </infoset>
+    <validationErrors>
+      <error>Element 'xmlStr' is a simple type</error>
+    </validationErrors>
+  </parserTestCase>
+
+  <parserTestCase name="stringAsXml_04" root="binMessage"
+                  
model="/org/apache/daffodil/infoset/stringAsXml/namespaced/xsd/binMessage.dfdl.xsd"
+                  validation="on">
+    <document>
+      <documentPart 
type="file">stringAsXml/namespaced/binMessage_03.dat</documentPart>
+    </document>
+    <errors>
+      <error>Unexpected character</error>
+    </errors>
+  </parserTestCase>
+
+  <parserTestCase name="stringAsXml_09" root="binMessage"
+                  
model="/org/apache/daffodil/infoset/stringAsXml/namespaced/xsd/binMessage.dfdl.xsd"
+                  validation="on">

Review Comment:
   Should these use the TestStringAsXmlValidator or just inherit from the 
default if changed above?



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

To unsubscribe, e-mail: [email protected]

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

Reply via email to