stevedlawrence commented on a change in pull request #505:
URL: https://github.com/apache/daffodil/pull/505#discussion_r624167614
##########
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:
Looking at the XML spec, it does look like that last scenario is not
allowed. From https://www.w3.org/TR/xml-names/#uniqAttrs:
> In XML documents conforming to this specification, no tag may contain two
attributes which:
> 1. have identical names, or
> 2. have qualified names with the same local part and with prefixes which
have been bound to namespace names that are identical.
This doesn't specifically call out xmlns attribues which are a little
special, but it seems reasonable that they must follow the same restrictions as
normal attributes and can't be redeclared.
--
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]