Sort-of kind-of handle DOM1 by checking if getLocalName returns
null for elements or attributes, and, if it does, use getNodeName.
Joe, I guess we should think about some DOM1 compatibility.
(It's actually not DOM1, but addElement vs. addElementNS, I think).
This is needed to make stylebook run.
(Joe, we must of been drunk when we thought we had fixed it, or,
more likely, I somehow picked up a different version of the jar?)
diff --git a/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java b/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
index 0b5bd8c..5fe41cf 100644
--- a/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
+++ b/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
@@ -177,9 +177,9 @@
int type;
if(NULL==forceNodeType)
- type = node.getNodeType();
+ type = node.getNodeType();
else
- type=forceNodeType;
+ type=forceNodeType;
m_nodes.addElement(node);
@@ -238,6 +238,12 @@
String localName = (type == Node.PROCESSING_INSTRUCTION_NODE) ?
node.getNodeName() :
node.getLocalName();
+
+ // Hack to make DOM1 sort of work...
+ if(((type == Node.ELEMENT_NODE) || (type == Node.ATTRIBUTE_NODE))
+ && null == localName)
+ localName = node.getNodeName(); // -sb
+
ExpandedNameTable exnt = m_expandedNameTable;
// %TBD% Nodes created with the old non-namespace-aware DOM
@@ -1094,7 +1100,7 @@
return node.getNodeValue();
FastStringBuffer buf = StringBufferPool.get();
- buf.append(node.getNodeValue());
+ buf.append(node.getNodeValue());
while(n!=null)
{
buf.append(n.getNodeValue());
@@ -1466,15 +1472,15 @@
int type = getNodeType(nodeHandle);
Node node = getNode(nodeHandle);
dispatchNodeData(node, ch, 0);
- // Text coalition -- a DTM text node may represent multiple
- // DOM nodes.
- if(TEXT_NODE == type || CDATA_SECTION_NODE == type)
- {
- while( null != (node=logicalNextDOMTextNode(node)) )
- {
- dispatchNodeData(node, ch, 0);
- }
- }
+ // Text coalition -- a DTM text node may represent multiple
+ // DOM nodes.
+ if(TEXT_NODE == type || CDATA_SECTION_NODE == type)
+ {
+ while( null != (node=logicalNextDOMTextNode(node)) )
+ {
+ dispatchNodeData(node, ch, 0);
+ }
+ }
}
}
@@ -1523,8 +1529,8 @@
case Node.COMMENT_NODE :
if(0 != depth)
break;
- // NOTE: Because this operation works in the DOM space, it does _not_ attempt
- // to perform Text Coalition. That should only be done in DTM space.
+ // NOTE: Because this operation works in the DOM space, it does _not_ attempt
+ // to perform Text Coalition. That should only be done in DTM space.
case Node.TEXT_NODE :
case Node.CDATA_SECTION_NODE :
case Node.ATTRIBUTE_NODE :