sboag 00/12/31 01:28:07
Modified: java/src/org/apache/xml/utils TreeWalker.java
Log:
Fix MAJOR bug where empty strings were always being passed for both
the uri and the local name. Leftover, I guess, from the original
SAX2 conversion, though I can't believe this hasn't showed up
until now.
Revision Changes Path
1.4 +14 -2 xml-xalan/java/src/org/apache/xml/utils/TreeWalker.java
Index: TreeWalker.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/TreeWalker.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TreeWalker.java 2000/12/07 19:58:27 1.3
+++ TreeWalker.java 2000/12/31 09:28:07 1.4
@@ -235,14 +235,17 @@
case Node.ELEMENT_NODE :
NamedNodeMap atts = ((Element) node).getAttributes();
int nAttrs = atts.getLength();
+ // System.out.println("TreeWalker#startNode: "+node.getNodeName());
for (int i = 0; i < nAttrs; i++)
{
Node attr = atts.item(i);
String attrName = attr.getNodeName();
+ // System.out.println("TreeWalker#startNode: attr["+i+"] =
"+attrName+", "+attr.getNodeValue());
if (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
{
+ // System.out.println("TreeWalker#startNode: attr["+i+"] =
"+attrName+", "+attr.getNodeValue());
int index;
// Use "" instead of null, as Xerces likes "" for the
// name of the default namespace. Fix attributed
@@ -253,11 +256,15 @@
this.m_contentHandler.startPrefixMapping(prefix,
attr.getNodeValue());
}
+
}
// System.out.println("m_dh.getNamespaceOfNode(node):
"+m_dh.getNamespaceOfNode(node));
// System.out.println("m_dh.getLocalNameOfNode(node):
"+m_dh.getLocalNameOfNode(node));
- this.m_contentHandler.startElement(m_dh.getNamespaceOfNode(node),
+ String ns = m_dh.getNamespaceOfNode(node);
+ if(null == ns)
+ ns = "";
+ this.m_contentHandler.startElement(ns,
m_dh.getLocalNameOfNode(node),
node.getNodeName(),
new AttList(atts, m_dh));
@@ -358,7 +365,12 @@
this.m_contentHandler.endDocument();
break;
case Node.ELEMENT_NODE :
- this.m_contentHandler.endElement("", "", node.getNodeName());
+ String ns = m_dh.getNamespaceOfNode(node);
+ if(null == ns)
+ ns = "";
+ this.m_contentHandler.endElement(ns,
+ m_dh.getLocalNameOfNode(node),
+ node.getNodeName());
NamedNodeMap atts = ((Element) node).getAttributes();
int nAttrs = atts.getLength();