sboag 00/12/31 01:23:01
Modified: java/src/org/apache/xml/utils DOMBuilder.java
Log:
Move append back to above the attributes add, to make sure
we don't cause strangeness with other DOMs, that might not like
adding attributes to an unparented node. The entire startElement
method is now overridden by StreeDOMHelper, for various reasons.
Make the m_currentNode and m_elemStack
protected for this reason.
Revision Changes Path
1.4 +10 -5 xml-xalan/java/src/org/apache/xml/utils/DOMBuilder.java
Index: DOMBuilder.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/DOMBuilder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DOMBuilder.java 2000/12/20 00:04:06 1.3
+++ DOMBuilder.java 2000/12/31 09:23:01 1.4
@@ -81,13 +81,13 @@
public Document m_doc;
/** Current node */
- Node m_currentNode = null;
+ protected Node m_currentNode = null;
/** First node of document fragment or null if not a DocumentFragment
*/
public DocumentFragment m_docFrag = null;
/** Vector of element nodes */
- NodeVector m_elemStack = new NodeVector();
+ protected NodeVector m_elemStack = new NodeVector();
/**
* DOMBuilder instance constructor... it will add the DOM nodes
@@ -319,25 +319,30 @@
setIDAttribute(atts.getValue(i), elem);
String attrNS = atts.getURI(i);
+
+ if(attrNS == null)
+ attrNS = ""; // defensive, shouldn't have to do this.
// System.out.println("attrNS: "+attrNS+", localName:
"+atts.getQName(i)
// +", qname: "+atts.getQName(i)+", value:
"+atts.getValue(i));
// Crimson won't let us set an xmlns: attribute on the DOM.
- if ((null == attrNS) || (attrNS.length() == 0) ||
atts.getQName(i).startsWith("xmlns:"))
+ if ((attrNS.length() == 0) || atts.getQName(i).startsWith("xmlns:"))
elem.setAttribute(atts.getQName(i), atts.getValue(i));
else
{
// elem.setAttributeNS(atts.getURI(i), atts.getLocalName(i),
atts.getValue(i));
- elem.setAttributeNS(atts.getURI(i), atts.getQName(i),
- atts.getValue(i));
+ elem.setAttributeNS(attrNS, atts.getQName(i), atts.getValue(i));
}
}
}
+
+ // append(elem);
m_elemStack.push(elem);
m_currentNode = elem;
+
}
/**