mkwan 2003/04/01 10:58:12 Modified: java/src/org/apache/xml/dtm/ref/dom2dtm DOM2DTM.java Log: Merging XSLTC_DTM and common serializer to the head Changes in org.apache.xml.dtm.ref.dom2dtm. Revision Changes Path 1.33 +35 -1 xml-xalan/java/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java Index: DOM2DTM.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- DOM2DTM.java 30 Jan 2003 18:46:18 -0000 1.32 +++ DOM2DTM.java 1 Apr 2003 18:58:12 -0000 1.33 @@ -346,7 +346,7 @@ /** * Get the number of nodes that have been added. */ - protected int getNumberOfNodes() + public int getNumberOfNodes() { return m_nodes.size(); } @@ -894,6 +894,39 @@ } /** + * Determine if the string-value of a node is whitespace + * + * @param nodeHandle The node Handle. + * + * @return Return true if the given node is whitespace. + */ + public boolean isWhitespace(int nodeHandle) + { + int type = getNodeType(nodeHandle); + Node node = getNode(nodeHandle); + if(TEXT_NODE == type || CDATA_SECTION_NODE == type) + { + // If this is a DTM text node, it may be made of multiple DOM text + // nodes -- including navigating into Entity References. DOM2DTM + // records the first node in the sequence and requires that we + // pick up the others when we retrieve the DTM node's value. + // + // %REVIEW% DOM Level 3 is expected to add a "whole text" + // retrieval method which performs this function for us. + FastStringBuffer buf = StringBufferPool.get(); + while(node!=null) + { + buf.append(node.getNodeValue()); + node=logicalNextDOMTextNode(node); + } + boolean b = buf.isWhitespace(0, buf.length()); + StringBufferPool.free(buf); + return b; + } + return false; + } + + /** * Retrieve the text content of a DOM subtree, appending it into a * user-supplied FastStringBuffer object. Note that attributes are * not considered part of the content of an element. @@ -1768,6 +1801,7 @@ { return null; } + }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]