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


##########
daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java:
##########
@@ -1213,4 +1215,81 @@ public void testJavaAPI26() throws IOException, 
ClassNotFoundException, External
         assertTrue(DaffodilXMLEntityResolver.getXMLEntityResolver() != null);
         assertTrue(DaffodilXMLEntityResolver.getLSResourceResolver() != null);
     }
+
+    @Test
+    public void testJavaAPINullXMLTextEscapeStyle() throws IOException, 
ClassNotFoundException {
+        ByteArrayOutputStream xmlBos = new ByteArrayOutputStream();
+        try {
+            XMLTextInfosetOutputter outputter = new 
XMLTextInfosetOutputter(xmlBos, true, null);
+        } catch (Exception e) {
+            String msg = e.getMessage().toLowerCase();
+            assertTrue(msg.contains("unrecognized"));
+            assertTrue(msg.contains("null"));
+            assertTrue(msg.contains("xmltextescapestyle"));
+        }
+    }
+
+    @Test
+    public void testJavaAPICDATA1() throws IOException, ClassNotFoundException 
{
+        String expected = "<![CDATA[NO_WHITESPACE_AT_ALL]]>";
+        String data = "NO_WHITESPACE_AT_ALL$";
+        String schemaType = "string";
+        doXMLTextEscapeStyleTest(expected, data, schemaType);

Review Comment:
   I think this is the right thing to do. It's worth the pass over the data 
before adding escaping of any kind. And this should only ever be needed for 
string data. 



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