mbeckerle commented on code in PR #1057:
URL: https://github.com/apache/daffodil/pull/1057#discussion_r1483645379


##########
daffodil-tdml-lib/src/test/scala/org/apache/daffodil/tdml/ScalaxbTests.scala:
##########
@@ -0,0 +1,23 @@
+package org.apache.daffodil.tdml
+
+import org.apache.daffodil.tdml.scalaxb.TestSuite
+
+import org.junit.Assert._
+import org.junit.Test
+
+class ScalaxbTests {
+
+  @Test def testReading(): Unit = {
+    val testSuite =
+      _root_.scalaxb.fromXML[TestSuite](
+        scala.xml.XML.load(
+          getClass
+            .getClassLoader()
+            .getResourceAsStream("test-suite/ibm-contributed/dpaext1-2.tdml"),
+        ),
+      )
+
+    assertNotNull(testSuite)
+    assertEquals(Some("dpaext"), testSuite.suiteName)
+  }
+}

Review Comment:
   We have various tools in daffodil-misc/xml/XMLUtils.scala that strip out 
comments, strip out processing instructions, etc. 
   You may need to do that pass first in order to be able to read in TDML.
   
   This is a really common thing in XML processing that people don't 
accommodate comments, which are part of the XML Infoset. As are EntityRefs, 
etc. Somewhere in the daffodil tests we have a DFDL schema that has a comment 
everwhere that a comment is allowed. To make sure we tolerate them in all the 
places they can appear. 
   
   Are you parsing TDML, or reading and writing it back?
   
   Reading one can strip out this stuff, but if you are rewriting the file this 
stuff has to be preserved. TDML is not an object model. Ex: reading and writing 
this:
   ```
   <str><![CDATA[big long string with
   significant whitespace
   inside it.
   ]]></str>
   ```
   And getting it to round trip with that CDATA bracketing in it, all 
whitespace preserved, etc. .... that's going to be tricky.
   



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