tuxji commented on code in PR #905:
URL: https://github.com/apache/daffodil/pull/905#discussion_r1065104303
##########
daffodil-core/src/test/scala/org/apache/daffodil/processor/TestSAXUnparseAPI.scala:
##########
@@ -100,6 +101,26 @@ class TestSAXUnparseAPI {
assertEquals(testData, bao.toString)
}
+ /**
+ * tests the case of unparsing with the namespace features/prefixes set to
+ * false/true, with non-empty prefixes and ignored attributes
+ */
+ @Test def
testUnparseContentHandler_unparse_namespace_prefix_feature_non_empty_prefix():
Unit = {
+ val xmlReader: XMLReader =
DaffodilSAXParserFactory().newSAXParser.getXMLReader
+ val bao = new ByteArrayOutputStream()
+ val wbc = java.nio.channels.Channels.newChannel(bao)
+ val unparseContentHandler = dp.newContentHandlerInstance(wbc)
+ xmlReader.setContentHandler(unparseContentHandler)
+ xmlReader.setFeature(XMLUtils.SAX_NAMESPACES_FEATURE, false)
+ xmlReader.setFeature(XMLUtils.SAX_NAMESPACE_PREFIXES_FEATURE, true)
+ val infoset = <p:list xmlns:p="http://example.com"
ignored="attr"><p:w>9</p:w><p:w>1</p:w><p:w>0</p:w></p:list>
+ val bai = new ByteArrayInputStream(infoset.toString.getBytes)
+ xmlReader.parse(new InputSource(bai))
+ val ur = unparseContentHandler.getUnparseResult
+ assertTrue(!ur.isError)
+ assertEquals(testData, bao.toString)
Review Comment:
I searched this file but I can't find testData's definition. How is
testData defined? Also, please make the comment explain why this test's case
matters compared to the 2 new tests you've already added below:
1. testUnparseContentHandler_unparse_mixed_01 to test the case of unparsing
with mixed content before a start element.
2. testUnparseContentHandler_unparse_mixed_02 to test the case of unparsing
with mixed content before an end element.
--
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]