You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sa...@apache.org on 2004/12/10 19:39:15 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/trax DOM2TO.java
santiagopg 2004/12/10 10:39:15
Modified: java/src/org/apache/xalan/xsltc/trax DOM2TO.java
Log:
Patch for Jira 2015. Namespace declarations are now reported on a first pass to avoid the problem described in the bug report.
Revision Changes Path
1.10 +18 -9 xml-xalan/java/src/org/apache/xalan/xsltc/trax/DOM2TO.java
Index: DOM2TO.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/DOM2TO.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DOM2TO.java 20 Feb 2004 19:30:40 -0000 1.9
+++ DOM2TO.java 10 Dec 2004 18:39:15 -0000 1.10
@@ -137,25 +137,34 @@
final String qname = node.getNodeName();
_handler.startElement(null, null, qname);
+ int colon;
String prefix;
final NamedNodeMap map = node.getAttributes();
final int length = map.getLength();
- // Process all other attributes
- NamespaceMappings nm = new NamespaceMappings();
+ // Process all namespace attributes first
for (int i = 0; i < length; i++) {
- int colon;
final Node attr = map.item(i);
final String qnameAttr = attr.getNodeName();
+ // Is this a namespace declaration?
if (qnameAttr.startsWith(XMLNS_PREFIX)) {
final String uriAttr = attr.getNodeValue();
colon = qnameAttr.lastIndexOf(':');
prefix = (colon > 0) ? qnameAttr.substring(colon + 1)
- : EMPTYSTRING;
+ : EMPTYSTRING;
_handler.namespaceAfterStartElement(prefix, uriAttr);
}
- else {
+ }
+
+ // Process all non-namespace attributes next
+ NamespaceMappings nm = new NamespaceMappings();
+ for (int i = 0; i < length; i++) {
+ final Node attr = map.item(i);
+ final String qnameAttr = attr.getNodeName();
+
+ // Is this a regular attribute?
+ if (!qnameAttr.startsWith(XMLNS_PREFIX)) {
final String uriAttr = attr.getNamespaceURI();
// Uri may be implicitly declared
if (uriAttr != null && !uriAttr.equals(EMPTYSTRING) ) {
@@ -171,8 +180,8 @@
prefix = (colon > 0) ? qnameAttr.substring(0, colon)
: newPrefix;
_handler.namespaceAfterStartElement(prefix, uriAttr);
- _handler.addAttribute((prefix + ":" + qnameAttr)
- , attr.getNodeValue());
+ _handler.addAttribute((prefix + ":" + qnameAttr),
+ attr.getNodeValue());
} else {
_handler.addAttribute(qnameAttr, attr.getNodeValue());
}
@@ -185,7 +194,7 @@
// Uri may be implicitly declared
if (uri != null) {
- final int colon = qname.lastIndexOf(':');
+ colon = qname.lastIndexOf(':');
prefix = (colon > 0) ? qname.substring(0, colon) : EMPTYSTRING;
_handler.namespaceAfterStartElement(prefix, uri);
}else {
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org