You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/09/05 21:33:45 UTC
cvs commit: xml-xalan/c/src/DOMSupport DOMServices.cpp DOMServices.hpp
dbertoni 00/09/05 12:33:41
Modified: c/src/DOMSupport DOMServices.cpp DOMServices.hpp
Log:
Fixed bug with getting data from comment and pi nodes. (conflictres22 and 23)
Revision Changes Path
1.17 +77 -13 xml-xalan/c/src/DOMSupport/DOMServices.cpp
Index: DOMServices.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMServices.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- DOMServices.cpp 2000/09/05 02:24:43 1.16
+++ DOMServices.cpp 2000/09/05 19:33:39 1.17
@@ -64,11 +64,13 @@
#include <XalanDOM/XalanAttr.hpp>
#include <XalanDOM/XalanCDATASection.hpp>
+#include <XalanDOM/XalanComment.hpp>
#include <XalanDOM/XalanDocument.hpp>
#include <XalanDOM/XalanDocumentFragment.hpp>
#include <XalanDOM/XalanElement.hpp>
#include <XalanDOM/XalanNamedNodeMap.hpp>
#include <XalanDOM/XalanNodeList.hpp>
+#include <XalanDOM/XalanProcessingInstruction.hpp>
#include <XalanDOM/XalanText.hpp>
@@ -271,6 +273,30 @@
}
break;
+ case XalanNode::COMMENT_NODE:
+ {
+ const XalanComment& theComment =
+#if defined(XALAN_OLD_STYLE_CASTS)
+ (const XalanComment&)node;
+#else
+ static_cast<const XalanComment&>(node);
+#endif
+ data = getNodeData(theComment);
+ }
+ break;
+
+ case XalanNode::PROCESSING_INSTRUCTION_NODE:
+ {
+ const XalanProcessingInstruction& thePI =
+#if defined(XALAN_OLD_STYLE_CASTS)
+ (const XalanProcessingInstruction&)node;
+#else
+ static_cast<const XalanProcessingInstruction&>(node);
+#endif
+ data = getNodeData(thePI);
+ }
+ break;
+
default:
// ignore
break;
@@ -290,6 +316,14 @@
XalanDOMString
+DOMServices::getNodeData(const XalanComment& comment)
+{
+ return comment.getData();
+}
+
+
+
+XalanDOMString
DOMServices::getNodeData(const XalanDocument& document)
{
XalanDOMString data;
@@ -298,12 +332,19 @@
while(child != 0)
{
- const XalanDOMString nodeData =
- getNodeData(*child);
+ const XalanNode::NodeType theType = child->getNodeType();
- if(0 < length(nodeData))
+ if (theType == XalanNode::ELEMENT_NODE ||
+ theType == XalanNode::TEXT_NODE ||
+ theType == XalanNode::CDATA_SECTION_NODE)
{
- data += nodeData;
+ const XalanDOMString nodeData =
+ getNodeData(*child);
+
+ if(0 < length(nodeData))
+ {
+ data += nodeData;
+ }
}
child = child->getNextSibling();
@@ -326,14 +367,22 @@
for(unsigned int i = 0; i < n; ++i)
{
- assert(nl->item(i) != 0);
+ const XalanNode* const child = nl->item(i);
+ assert(child != 0);
- const XalanDOMString nodeData =
- getNodeData(*nl->item(i));
+ const XalanNode::NodeType theType = child->getNodeType();
- if(0 < length(nodeData))
+ if (theType == XalanNode::ELEMENT_NODE ||
+ theType == XalanNode::TEXT_NODE ||
+ theType == XalanNode::CDATA_SECTION_NODE)
{
- data += nodeData;
+ const XalanDOMString nodeData =
+ getNodeData(*child);
+
+ if(0 < length(nodeData))
+ {
+ data += nodeData;
+ }
}
}
@@ -351,18 +400,33 @@
while(child != 0)
{
- const XalanDOMString nodeData =
- getNodeData(*child);
+ const XalanNode::NodeType theType = child->getNodeType();
- if(0 < length(nodeData))
+ if (theType == XalanNode::ELEMENT_NODE ||
+ theType == XalanNode::TEXT_NODE ||
+ theType == XalanNode::CDATA_SECTION_NODE)
{
- data += nodeData;
+ const XalanDOMString nodeData =
+ getNodeData(*child);
+
+ if(0 < length(nodeData))
+ {
+ data += nodeData;
+ }
}
child = child->getNextSibling();
}
return data;
+}
+
+
+
+XalanDOMString
+DOMServices::getNodeData(const XalanProcessingInstruction& pi)
+{
+ return pi.getData();
}
1.14 +20 -0 xml-xalan/c/src/DOMSupport/DOMServices.hpp
Index: DOMServices.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMServices.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- DOMServices.hpp 2000/09/05 02:24:43 1.13
+++ DOMServices.hpp 2000/09/05 19:33:39 1.14
@@ -75,10 +75,12 @@
class XalanAttr;
+class XalanComment;
class XalanDocument;
class XalanDocumentFragment;
class XalanElement;
class XalanNode;
+class XalanProcessingInstruction;
class XalanText;
@@ -176,6 +178,15 @@
/**
* Retrieves data for node
*
+ * @param attribute DOM node whose data is to be returned
+ * @return a string representation of the node's data
+ */
+ static XalanDOMString
+ getNodeData(const XalanComment& comment);
+
+ /**
+ * Retrieves data for node
+ *
* @param document DOM node whose data is to be returned
* @return a string representation of the node's data
*/
@@ -199,6 +210,15 @@
*/
static XalanDOMString
getNodeData(const XalanElement& element);
+
+ /**
+ * Retrieves data for node
+ *
+ * @param pi DOM node whose data is to be returned
+ * @return a string representation of the node's data
+ */
+ static XalanDOMString
+ getNodeData(const XalanProcessingInstruction& pi);
/**
* Retrieves data for node