Better handling of namespaced attributes

Don't store in the data model using the prefix -- the prefix is
meaningless.  Store by URI and then generate prefixes when serializing.

(cherry picked from commit caf119b5b63bbc61976731c1cd4795d00e6851c9)
This commit is contained in:
Stephen Paul Weber 2024-05-21 18:17:53 -05:00 committed by Arne
parent db7aab2439
commit e38b4d9845

View file

@ -73,12 +73,6 @@ public class XmlReader implements Closeable {
}
tag.setAttribute(name,parser.getAttributeValue(i));
}
int nsStart = parser.getNamespaceCount(parser.getDepth()-1);
int nsEnd = parser.getNamespaceCount(parser.getDepth());
for (int i = nsStart; i < nsEnd; i++) {
final var prefix = parser.getNamespacePrefix(i);
tag.setAttribute("xmlns" + (prefix == null ? "" : ":" + prefix), parser.getNamespaceUri(i));
}
if (xmlns != null) {
tag.setAttribute("xmlns", xmlns);
}