Loading... (original) (raw)

Node.getNodeValue() should return NULL values for Element node type [1].
8032908 fix changed that behavior incorrectly. The

JDK-8032908

fix should be revisited.
getTextContent() calls getNodeValue() which is incorrect:
java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/DTMNodeProxy.java
@@ -2116,7 +2116,7 @@
*/
@Override
public String getTextContent() throws DOMException {
- return getNodeValue(); // overriden in some subclasses
+ return dtm.getStringValue(node).toString();
}

/**

8032908 fix should be reverted:
java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SAX2DTM2.java
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SAX2DTM2.java Thu May 21 16:21:00 2015 -0700
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SAX2DTM2.java Thu May 28 15:36:38 2015 +0300
@@ -3145,11 +3145,7 @@
m_data.elementAt(-dataIndex+1));
}
}
- else if (DTM.ELEMENT_NODE == type)
- {
- return getStringValueX(nodeHandle);
- }
- else if (DTM.DOCUMENT_FRAGMENT_NODE == type
+ else if (DTM.ELEMENT_NODE == type || DTM.DOCUMENT_FRAGMENT_NODE == type
|| DTM.DOCUMENT_NODE == type)
{
return null;

Few tests should be updated to use the proper functions: 8032908 and 8062518

[1] Table in "Interface Node->Definition group NodeType" section: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247