olabusayoT commented on a change in pull request #505:
URL: https://github.com/apache/daffodil/pull/505#discussion_r624071841
##########
File path:
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/SAXInfosetOutputter.scala
##########
@@ -145,18 +145,11 @@ class SAXInfosetOutputter(xmlReader:
DFDL.DaffodilParseXMLReader,
private def doStartPrefixMapping(diElem: DIElement, contentHandler:
ContentHandler): Unit = {
val (nsbStart: NamespaceBinding, nsbEnd: NamespaceBinding) =
getNsbStartAndEnd(diElem)
var n = nsbStart
- var mappingsList: Seq[(String, String)] = Seq()
while (n.ne(nsbEnd) && n.ne(null) && n.ne(scala.xml.TopScope)) {
val prefix = if (n.prefix == null) "" else n.prefix
val uri = if (n.uri == null) "" else n.uri
- // we generate a list here by prepending so can build the prefixMapping
in the
- // same order as it is in minimizedScope when we call
startPrefixMapping; we do this because
- // getPrefix in the contentHandler is order dependent
- mappingsList +:= (prefix, uri)
- n = n.parent
- }
- mappingsList.foreach{ case (prefix, uri) =>
contentHandler.startPrefixMapping(prefix, uri)
+ n = n.parent
Review comment:
Hmm let me mentally parse this out, so if we have the minimizedScope as
mentioned above, with this new order, we'd call startPrefixMapping in the order
below since c is parent of b, which is parent of a
```
contentHandler.startPrefixMapping("a", "baz")
contentHandler.startPrefixMapping("b", "bar")
contentHandler.startPrefixMapping("c", "foo")
```
that will cause currentPrefixMapping to look like:
`NamespaceBinding("c", "foo", NamespaceBinding("b", "bar",
NamespaceBinding("a","baz", null)))`
this order is fixed when we convert to activePrefixMapping, which correctly
reverses the order to a(b(c)), and our look ups are fine. But to any other
content handler what was a(b(c)) in the minimized scope would now have become
c(b(a)), no?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]