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


##########
daffodil-tdml-lib/src/test/scala/org/apache/daffodil/tdml/JaxbTests.scala:
##########
@@ -0,0 +1,20 @@
+package org.apache.daffodil.tdml
+
+import org.junit.Assert._
+import org.junit.Test
+
+import javax.xml.bind.JAXBContext
+
+class JaxbTests {
+
+  @Test def testReading(): Unit = {
+    val testSuite = JAXBContext
+      .newInstance(classOf[TestSuite])
+      .createUnmarshaller()
+      
.unmarshal(getClass.getClassLoader().getResourceAsStream("test-suite/ibm-contributed/dpaext1-2.tdml"))
+      .asInstanceOf[TestSuite]
+
+    assertNotNull(testSuite)
+    assertEquals("dpaext", testSuite.suiteName)

Review Comment:
   I'm curious what the `dfdInfoset` part unmarshalls to, since that can 
contain random XML (or a string for `type="file"`) that isn't defined by the 
schema, it's just an XSD `any` element. Is it made available as a string, some 
sort of XML DOM, or is it just ignored? If ignored, that's likely a problem 
since users of this will probably want access to the infoset part of a TDML 
file.
   
   It might be useful to modify this test to examine some of the things we 
think we'll need (like `dfdlnfoset`) to make sure they are unmarshalling in 
usable ways. And maybe also act as a reference for using this.
   
   A related thought, if XSD `any` does parse to something useful like a string 
or DOM, could XSD `any` also be used to support the `defineSchema` and 
`defineConfig` elements? For example, what if we added a new `tdml-jaxb.xsd` 
file that did something like:
   
   ```xml
   ...
   <xsd:include schemaLocation="tdml-core.xsd"/>
   
   <element name="defineSchema" type="tns:defineSchemaType" 
substitutionGroup="tns:testSuiteChoices"/>
   <complexType name="defineSchemaType">
     <sequence>
       <any namespace="##any" processContents="lax" minOccurs="0" 
maxOccurs="unbounded"/>
     </sequence>
   </comlexType>
   ...
   ```
   
   So very similar to how `dfdlInfoset` is already defined. We can configure 
xjc to generate code based on this new jaxb specific tdml file, and the 
`defineSchema` just becomes a string or DOM or however it treats XSD `any`, 
just like `dfdlInfoset` does.
   
   Doesn't mean we necessarily have to support embedded configs and schemas in 
the vscode tool where this is planned to be used, but it at least makes it 
possible. And also makes it more possible to combin the existing TDML runner 
with the new jaxb stuff.



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