You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ar...@locus.apache.org on 2000/02/04 02:49:38 UTC
cvs commit: xml-xerces/c/src/dom TreeWalkerImpl.hpp TreeWalkerImpl.cpp TextImpl.hpp TextImpl.cpp NodeVector.hpp NodeVector.cpp NodeListImpl.hpp NodeIteratorImpl.hpp NodeIteratorImpl.cpp NodeImpl.hpp NodeImpl.cpp NamedNodeMapImpl.hpp NamedNodeMapImpl.cpp EntityReferenceImpl.hpp EntityReferenceImpl.cpp DOM_TreeWalker.hpp DOM_TreeWalker.cpp DOM_Text.hpp DOM_Text.cpp DOM_NodeList.hpp DOM_NodeList.cpp DOM_NodeIterator.hpp DOM_NodeIterator.cpp DOM_NodeFilter.hpp DOM_NodeFilter.cpp DOM_NamedNodeMap.hpp DOM_NamedNodeMap.cpp DOM_Document.hpp DOM_Document.cpp DOM_CharacterData.hpp DOM_CharacterData.cpp DocumentImpl.hpp DocumentImpl.cpp DeepNodeListImpl.hpp DeepNodeListImpl.cpp CharacterDataImpl.hpp CharacterDataImpl.cpp
aruna1 00/02/03 17:49:37
Modified: c/src/dom TreeWalkerImpl.hpp TreeWalkerImpl.cpp TextImpl.hpp
TextImpl.cpp NodeVector.hpp NodeVector.cpp
NodeListImpl.hpp NodeIteratorImpl.hpp
NodeIteratorImpl.cpp NodeImpl.hpp NodeImpl.cpp
NamedNodeMapImpl.hpp NamedNodeMapImpl.cpp
EntityReferenceImpl.hpp EntityReferenceImpl.cpp
DOM_TreeWalker.hpp DOM_TreeWalker.cpp DOM_Text.hpp
DOM_Text.cpp DOM_NodeList.hpp DOM_NodeList.cpp
DOM_NodeIterator.hpp DOM_NodeIterator.cpp
DOM_NodeFilter.hpp DOM_NodeFilter.cpp
DOM_NamedNodeMap.hpp DOM_NamedNodeMap.cpp
DOM_Document.hpp DOM_Document.cpp
DOM_CharacterData.hpp DOM_CharacterData.cpp
DocumentImpl.hpp DocumentImpl.cpp
DeepNodeListImpl.hpp DeepNodeListImpl.cpp
CharacterDataImpl.hpp CharacterDataImpl.cpp
Log:
TreeWalker and NodeIterator changes
Revision Changes Path
1.2 +32 -19 xml-xerces/c/src/dom/TreeWalkerImpl.hpp
Index: TreeWalkerImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/TreeWalkerImpl.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TreeWalkerImpl.hpp 1999/11/09 01:09:20 1.1
+++ TreeWalkerImpl.hpp 2000/02/04 01:49:24 1.2
@@ -56,9 +56,12 @@
/**
* $Log: TreeWalkerImpl.hpp,v $
- * Revision 1.1 1999/11/09 01:09:20 twl
- * Initial revision
+ * Revision 1.2 2000/02/04 01:49:24 aruna1
+ * TreeWalker and NodeIterator changes
*
+ * Revision 1.1.1.1 1999/11/09 01:09:20 twl
+ * Initial checkin
+ *
* Revision 1.3 1999/11/08 20:44:34 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -81,71 +84,78 @@
// implementation will still work.
/** Public constructor */
- TreeWalkerImpl (DOM_Node root, int whatToShow, DOM_NodeFilter nodeFilter, NodeFilterImpl* nfi);
+ TreeWalkerImpl (
+ DOM_Node root,
+ unsigned long whatToShow,
+ DOM_NodeFilter* nodeFilter,
+ bool expandEntityRef);
TreeWalkerImpl (const TreeWalkerImpl& twi);
TreeWalkerImpl& operator= (const TreeWalkerImpl& twi);
/** Return the whatToShow value */
- virtual int getWhatToShow ();
+ unsigned long getWhatToShow ();
/** Return the NodeFilter */
- virtual DOM_NodeFilter getFilter ();
+ DOM_NodeFilter* getFilter ();
- virtual void detach ();
+ void detach ();
/** Return the current DOM_Node. */
- virtual DOM_Node getCurrentNode ();
+ DOM_Node getCurrentNode ();
/** Return the current Node. */
- virtual void setCurrentNode (DOM_Node node);
+ void setCurrentNode (DOM_Node node);
/** Return the parent Node from the current node,
* after applying filter, whatToshow.
* If result is not null, set the current Node.
*/
- virtual DOM_Node parentNode ();
+ DOM_Node parentNode ();
/** Return the first child Node from the current node,
* after applying filter, whatToshow.
* If result is not null, set the current Node.
*/
- virtual DOM_Node firstChild ();
+ DOM_Node firstChild ();
/** Return the last child Node from the current node,
* after applying filter, whatToshow.
* If result is not null, set the current Node.
*/
- virtual DOM_Node lastChild ();
+ DOM_Node lastChild ();
/** Return the previous sibling Node from the current node,
* after applying filter, whatToshow.
* If result is not null, set the current Node.
*/
- virtual DOM_Node previousSibling ();
+ DOM_Node previousSibling ();
/** Return the next sibling Node from the current node,
* after applying filter, whatToshow.
* If result is not null, set the current Node.
*/
- virtual DOM_Node nextSibling ();
+ DOM_Node nextSibling ();
/** Return the previous Node from the current node,
* after applying filter, whatToshow.
* If result is not null, set the current Node.
*/
- virtual DOM_Node previousNode ();
+ DOM_Node previousNode ();
/** Return the next Node from the current node,
* after applying filter, whatToshow.
* If result is not null, set the current Node.
*/
- virtual DOM_Node nextNode ();
+ DOM_Node nextNode ();
- virtual void unreferenced ();
+ void unreferenced ();
+
+ /** Get the expandEntity reference flag. */
+ bool getExpandEntityReferences();
- protected:
+protected:
/** Internal function.
* Return the parent Node, from the input node
@@ -185,19 +195,22 @@
/** The node is accepted if it passes the whatToShow and the filter. */
short acceptNode (DOM_Node node);
-
- private:
+
+private:
/** The whatToShow mask. */
- int fWhatToShow;
+ unsigned long fWhatToShow;
/** The NodeFilter reference. */
- DOM_NodeFilter fNodeFilter;
+ DOM_NodeFilter* fNodeFilter;
/** The current Node. */
DOM_Node fCurrentNode;
/** The root Node. */
DOM_Node fRoot;
+
+ /** The expandEntity reference flag. */
+ bool fExpandEntityReferences;
bool fDetached;
};
1.4 +64 -50 xml-xerces/c/src/dom/TreeWalkerImpl.cpp
Index: TreeWalkerImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/TreeWalkerImpl.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TreeWalkerImpl.cpp 1999/11/30 21:16:26 1.3
+++ TreeWalkerImpl.cpp 2000/02/04 01:49:25 1.4
@@ -56,6 +56,9 @@
/**
* $Log: TreeWalkerImpl.cpp,v $
+ * Revision 1.4 2000/02/04 01:49:25 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.3 1999/11/30 21:16:26 roddey
* Changes to add the transcode() method to DOMString, which returns a transcoded
* version (to local code page) of the DOM string contents. And I changed all of the
@@ -79,39 +82,42 @@
/** constructor */
-TreeWalkerImpl::TreeWalkerImpl (DOM_Node root, int whatToShow, DOM_NodeFilter nodeFilter, NodeFilterImpl* twi) {
- fCurrentNode = root;
- fRoot = root;
- fWhatToShow = whatToShow;
- fNodeFilter = nodeFilter;
- nodeRefCount = 0;
- fDetached = false;
-
- if (twi != 0L) {
- DOM_NodeFilter nf(twi);
- fNodeFilter = nf;
- }
+TreeWalkerImpl::TreeWalkerImpl (
+ DOM_Node root,
+ unsigned long whatToShow,
+ DOM_NodeFilter* nodeFilter,
+ bool expandEntityRef)
+: fCurrentNode(root),
+ fRoot(root),
+ fWhatToShow(whatToShow),
+ fNodeFilter(nodeFilter),
+ fDetached(false),
+ fExpandEntityReferences(expandEntityRef)
+
+{
}
-TreeWalkerImpl::TreeWalkerImpl (const TreeWalkerImpl& twi) {
- fCurrentNode = twi.fCurrentNode;
- fRoot = twi.fRoot;
- fWhatToShow = twi.fWhatToShow;
- fNodeFilter = twi.fNodeFilter;
- nodeRefCount = 0;
- fDetached = false;
+TreeWalkerImpl::TreeWalkerImpl (const TreeWalkerImpl& twi)
+: fCurrentNode(twi.fCurrentNode),
+ fRoot(twi.fRoot),
+ fWhatToShow(twi.fWhatToShow),
+ fNodeFilter(twi.fNodeFilter),
+ fDetached(false),
+ fExpandEntityReferences(twi.fExpandEntityReferences)
+{
}
TreeWalkerImpl& TreeWalkerImpl::operator= (const TreeWalkerImpl& twi) {
if (this != &twi)
{
- fCurrentNode = twi.fCurrentNode;
- fRoot = twi.fRoot;
- fWhatToShow = twi.fWhatToShow;
- fNodeFilter = twi.fNodeFilter;
- fDetached = twi.fDetached;
+ fCurrentNode = twi.fCurrentNode;
+ fRoot = twi.fRoot;
+ fWhatToShow = twi.fWhatToShow;
+ fNodeFilter = twi.fNodeFilter;
+ fDetached = twi.fDetached;
+ fExpandEntityReferences = twi.fExpandEntityReferences;
}
return *this;
@@ -150,16 +156,22 @@
/** Return the whatToShow value */
-int TreeWalkerImpl::getWhatToShow () {
+unsigned long TreeWalkerImpl::getWhatToShow () {
return fWhatToShow;
}
/** Return the NodeFilter */
-DOM_NodeFilter TreeWalkerImpl::getFilter () {
+DOM_NodeFilter* TreeWalkerImpl::getFilter () {
return fNodeFilter;
}
+/** Get the expandEntity reference flag. */
+bool TreeWalkerImpl::getExpandEntityReferences() {
+ return fExpandEntityReferences;
+}
+
+
/** Return the current Node. */
DOM_Node TreeWalkerImpl::getCurrentNode () {
@@ -387,9 +399,9 @@
DOM_Node newNode = node.getParentNode();
if (newNode.isNull()) return result;
- int accept = acceptNode(newNode);
+ short accept = acceptNode(newNode);
- if (accept == DOM_NodeFilter::ACCEPT)
+ if (accept == DOM_NodeFilter::FILTER_ACCEPT)
return newNode;
else
{
@@ -421,21 +433,21 @@
if (newNode.isNull() || node == fRoot) return result;
- int parentAccept = acceptNode(newNode);
+ short parentAccept = acceptNode(newNode);
- if (parentAccept == DOM_NodeFilter::SKIP) {
+ if (parentAccept == DOM_NodeFilter::FILTER_SKIP) {
return getNextSibling(newNode);
}
return result;
}
- int accept = acceptNode(newNode);
+ short accept = acceptNode(newNode);
- if (accept == DOM_NodeFilter::ACCEPT)
+ if (accept == DOM_NodeFilter::FILTER_ACCEPT)
return newNode;
else
- if (accept == DOM_NodeFilter::SKIP) {
+ if (accept == DOM_NodeFilter::FILTER_SKIP) {
DOM_Node fChild = getFirstChild(newNode);
if (fChild.isNull()) {
return getNextSibling(newNode);
@@ -470,21 +482,21 @@
newNode = node.getParentNode();
if (newNode.isNull() || node == fRoot) return result;
- int parentAccept = acceptNode(newNode);
+ short parentAccept = acceptNode(newNode);
- if (parentAccept == DOM_NodeFilter::SKIP) {
+ if (parentAccept == DOM_NodeFilter::FILTER_SKIP) {
return getPreviousSibling(newNode);
}
return result;
}
- int accept = acceptNode(newNode);
+ short accept = acceptNode(newNode);
- if (accept == DOM_NodeFilter::ACCEPT)
+ if (accept == DOM_NodeFilter::FILTER_ACCEPT)
return newNode;
else
- if (accept == DOM_NodeFilter::SKIP) {
+ if (accept == DOM_NodeFilter::FILTER_SKIP) {
DOM_Node fChild = getLastChild(newNode);
if (fChild.isNull()) {
return getPreviousSibling(newNode);
@@ -516,12 +528,12 @@
DOM_Node newNode = node.getFirstChild();
if (newNode.isNull()) return result;
- int accept = acceptNode(newNode);
+ short accept = acceptNode(newNode);
- if (accept == DOM_NodeFilter::ACCEPT)
+ if (accept == DOM_NodeFilter::FILTER_ACCEPT)
return newNode;
else
- if (accept == DOM_NodeFilter::SKIP
+ if (accept == DOM_NodeFilter::FILTER_SKIP
&& newNode.hasChildNodes())
{
return getFirstChild(newNode);
@@ -550,12 +562,12 @@
DOM_Node newNode = node.getLastChild();
if (newNode.isNull()) return result;
- int accept = acceptNode(newNode);
+ short accept = acceptNode(newNode);
- if (accept == DOM_NodeFilter::ACCEPT)
+ if (accept == DOM_NodeFilter::FILTER_ACCEPT)
return newNode;
else
- if (accept == DOM_NodeFilter::SKIP
+ if (accept == DOM_NodeFilter::FILTER_SKIP
&& newNode.hasChildNodes())
{
return getLastChild(newNode);
@@ -578,22 +590,22 @@
if (fNodeFilter == 0) {
if ( ( fWhatToShow & (1 << (node.getNodeType() - 1))) != 0)
{
- return DOM_NodeFilter::ACCEPT;
+ return DOM_NodeFilter::FILTER_ACCEPT;
}
else
{
- return DOM_NodeFilter::SKIP;
+ return DOM_NodeFilter::FILTER_SKIP;
}
} else {
// REVISIT: This logic is unclear from the spec!
if ((fWhatToShow & (1 << (node.getNodeType() - 1))) != 0 ) {
- return fNodeFilter.acceptNode(node);
+ return fNodeFilter->acceptNode(node);
} else {
// what to show has failed!
- if (fNodeFilter.acceptNode(node) == DOM_NodeFilter::REJECT) {
- return DOM_NodeFilter::REJECT;
+ if (fNodeFilter->acceptNode(node) == DOM_NodeFilter::FILTER_REJECT) {
+ return DOM_NodeFilter::FILTER_REJECT;
} else {
- return DOM_NodeFilter::SKIP;
+ return DOM_NodeFilter::FILTER_SKIP;
}
}
}
1.3 +8 -1 xml-xerces/c/src/dom/TextImpl.hpp
Index: TextImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/TextImpl.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TextImpl.hpp 1999/12/21 07:47:07 1.2
+++ TextImpl.hpp 2000/02/04 01:49:25 1.3
@@ -56,6 +56,9 @@
/**
* $Log: TextImpl.hpp,v $
+ * Revision 1.3 2000/02/04 01:49:25 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.2 1999/12/21 07:47:07 robweir
* Patches to support Xalan, where we need to create a
* "special" DOM with subclassed Nodes.
@@ -95,7 +98,7 @@
virtual ~TextImpl();
virtual NodeImpl *cloneNode(bool deep);
virtual bool isTextImpl();
- virtual TextImpl *splitText(int offset);
+ virtual TextImpl *splitText(unsigned int offset);
};
#endif
1.3 +8 -2 xml-xerces/c/src/dom/TextImpl.cpp
Index: TextImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/TextImpl.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TextImpl.cpp 1999/11/30 21:16:26 1.2
+++ TextImpl.cpp 2000/02/04 01:49:25 1.3
@@ -56,6 +56,9 @@
/**
* $Log: TextImpl.cpp,v $
+ * Revision 1.3 2000/02/04 01:49:25 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.2 1999/11/30 21:16:26 roddey
* Changes to add the transcode() method to DOMString, which returns a transcoded
* version (to local code page) of the DOM string contents. And I changed all of the
@@ -107,12 +110,13 @@
};
-TextImpl *TextImpl::splitText(int offset)
+TextImpl *TextImpl::splitText(unsigned int offset)
{
if (readOnly)
throw DOM_DOMException(
DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
- if (offset < 0 || offset > value.length() - 1)
+ unsigned int len = value.length(); //assert(value.length() >= 0)
+ if (offset < 0 || offset >= len)
throw DOM_DOMException(DOM_DOMException::INDEX_SIZE_ERR, null);
TextImpl *newText =
1.2 +12 -9 xml-xerces/c/src/dom/NodeVector.hpp
Index: NodeVector.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/NodeVector.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NodeVector.hpp 1999/11/09 01:09:17 1.1
+++ NodeVector.hpp 2000/02/04 01:49:25 1.2
@@ -58,9 +58,12 @@
/**
* $Log: NodeVector.hpp,v $
- * Revision 1.1 1999/11/09 01:09:17 twl
- * Initial revision
+ * Revision 1.2 2000/02/04 01:49:25 aruna1
+ * TreeWalker and NodeIterator changes
*
+ * Revision 1.1.1.1 1999/11/09 01:09:17 twl
+ * Initial checkin
+ *
* Revision 1.2 1999/11/08 20:44:31 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -83,23 +86,23 @@
class NodeVector {
private:
NodeImpl **data;
- int allocatedSize;
- int nextFreeSlot;
- void init(int size);
+ unsigned int allocatedSize;
+ unsigned int nextFreeSlot;
+ void init(unsigned int size);
void checkSpace();
public:
NodeVector();
- NodeVector(int size);
+ NodeVector(unsigned int size);
~NodeVector();
- int size();
- NodeImpl *elementAt(int index);
+ unsigned int size();
+ NodeImpl *elementAt(unsigned int index);
NodeImpl *lastElement();
void addElement(NodeImpl *);
- void insertElementAt(NodeImpl *, int index);
- void setElementAt(NodeImpl *val, int index);
- void removeElementAt(int index);
+ void insertElementAt(NodeImpl *, unsigned int index);
+ void setElementAt(NodeImpl *val, unsigned int index);
+ void removeElementAt(unsigned int index);
void reset();
};
1.2 +16 -13 xml-xerces/c/src/dom/NodeVector.cpp
Index: NodeVector.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/NodeVector.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NodeVector.cpp 1999/11/09 01:09:17 1.1
+++ NodeVector.cpp 2000/02/04 01:49:25 1.2
@@ -56,9 +56,12 @@
/**
* $Log: NodeVector.cpp,v $
- * Revision 1.1 1999/11/09 01:09:17 twl
- * Initial revision
+ * Revision 1.2 2000/02/04 01:49:25 aruna1
+ * TreeWalker and NodeIterator changes
*
+ * Revision 1.1.1.1 1999/11/09 01:09:17 twl
+ * Initial checkin
+ *
* Revision 1.3 1999/11/08 20:44:31 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -81,12 +84,12 @@
init(10);
};
-NodeVector::NodeVector(int size) {
+NodeVector::NodeVector(unsigned int size) {
init(size);
};
-void NodeVector::init(int size) {
+void NodeVector::init(unsigned int size) {
assert(size > 0);
data = new NodeImpl *[size];
assert(data != 0);
@@ -109,12 +112,12 @@
void NodeVector::checkSpace() {
if (nextFreeSlot == allocatedSize) {
- int grow= allocatedSize/2;
- if (grow < 50) grow = 50;
- int newAllocatedSize = allocatedSize + grow;
+ unsigned int grow = allocatedSize/2;
+ if (grow < 50) grow = 50;
+ unsigned int newAllocatedSize = allocatedSize + grow;
NodeImpl **newData = new NodeImpl *[newAllocatedSize];
assert(newData != 0);
- for (int i=0; i<allocatedSize; i++) {
+ for (unsigned int i=0; i<allocatedSize; i++) {
newData[i] = data[i];
};
delete [] data;
@@ -124,7 +127,7 @@
};
-NodeImpl *NodeVector::elementAt(int index) {
+NodeImpl *NodeVector::elementAt(unsigned int index) {
return data[index];
};
@@ -135,8 +138,8 @@
};
-void NodeVector::insertElementAt(NodeImpl *elem, int index) {
- int i;
+void NodeVector::insertElementAt(NodeImpl *elem, unsigned int index) {
+ unsigned int i;
assert(index <= nextFreeSlot);
assert(index >= 0);
@@ -151,10 +154,10 @@
};
-void NodeVector::removeElementAt(int index) {
+void NodeVector::removeElementAt(unsigned int index) {
assert (index >= 0);
assert(index < nextFreeSlot);
- for (int i=index; i<nextFreeSlot-1; ++i) {
+ for (unsigned int i=index; i<nextFreeSlot-1; ++i) {
data[i] = data[i+1];
}
--nextFreeSlot;
@@ -164,14 +167,14 @@
nextFreeSlot = 0;
};
-void NodeVector::setElementAt(NodeImpl *elem, int index) {
+void NodeVector::setElementAt(NodeImpl *elem, unsigned int index) {
assert(index >= 0);
assert(index < nextFreeSlot);
data[index] = elem;
};
-int NodeVector::size() {
+unsigned int NodeVector::size() {
return nextFreeSlot;
};
1.4 +5 -2 xml-xerces/c/src/dom/NodeListImpl.hpp
Index: NodeListImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/NodeListImpl.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NodeListImpl.hpp 2000/01/22 01:38:30 1.3
+++ NodeListImpl.hpp 2000/02/04 01:49:26 1.4
@@ -58,6 +58,9 @@
/**
* $Log: NodeListImpl.hpp,v $
+ * Revision 1.4 2000/02/04 01:49:26 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.3 2000/01/22 01:38:30 andyh
* Remove compiler warnings in DOM impl classes
*
@@ -97,8 +100,8 @@
NodeListImpl();
public:
virtual ~NodeListImpl();
- virtual NodeImpl * item(unsigned long index) = 0;
- virtual int getLength() = 0;
+ virtual NodeImpl * item(unsigned int index) = 0;
+ virtual unsigned int getLength() = 0;
};
#endif
1.2 +34 -19 xml-xerces/c/src/dom/NodeIteratorImpl.hpp
Index: NodeIteratorImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/NodeIteratorImpl.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NodeIteratorImpl.hpp 1999/11/09 01:09:16 1.1
+++ NodeIteratorImpl.hpp 2000/02/04 01:49:26 1.2
@@ -56,9 +56,12 @@
/**
* $Log: NodeIteratorImpl.hpp,v $
- * Revision 1.1 1999/11/09 01:09:16 twl
- * Initial revision
+ * Revision 1.2 2000/02/04 01:49:26 aruna1
+ * TreeWalker and NodeIterator changes
*
+ * Revision 1.1.1.1 1999/11/09 01:09:16 twl
+ * Initial checkin
+ *
* Revision 1.2 1999/11/08 20:44:30 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -83,25 +86,33 @@
public:
virtual ~NodeIteratorImpl ();
- NodeIteratorImpl (DOM_Node root, int whatToShow, DOM_NodeFilter nodeFilter, NodeFilterImpl* fi);
- NodeIteratorImpl& operator= (const NodeIteratorImpl& other);
- virtual int getWhatToShow ();
- virtual DOM_NodeFilter getFilter ();
-
- void setWhatToShow (int what);
- void setFilter (DOM_NodeFilter filter);
-
- virtual DOM_Node nextNode ();
- virtual DOM_Node previousNode ();
- virtual bool acceptNode (DOM_Node node);
- virtual DOM_Node matchNodeOrParent (DOM_Node node);
- virtual DOM_Node nextNode (DOM_Node node, bool visitChildren);
- virtual DOM_Node previousNode (DOM_Node node);
- virtual void removeNode (DOM_Node node);
+ NodeIteratorImpl (
+ DOM_Node root,
+ unsigned long whatToShow,
+ DOM_NodeFilter* nodeFilter,
+ bool expandEntityRef);
+
+ NodeIteratorImpl ( const NodeIteratorImpl& toCopy);
+
+ NodeIteratorImpl& operator= (const NodeIteratorImpl& other);
+
+ unsigned long getWhatToShow ();
+ DOM_NodeFilter* getFilter ();
+
+ DOM_Node nextNode ();
+ DOM_Node previousNode ();
+ bool acceptNode (DOM_Node node);
+ DOM_Node matchNodeOrParent (DOM_Node node);
+ DOM_Node nextNode (DOM_Node node, bool visitChildren);
+ DOM_Node previousNode (DOM_Node node);
+ void removeNode (DOM_Node node);
+
+ void unreferenced();
- virtual void unreferenced();
+ void detach ();
- virtual void detach ();
+ /** Get the expandEntity reference flag. */
+ bool getExpandEntityReferences();
private:
@@ -112,11 +123,14 @@
DOM_Node fRoot;
/** The whatToShow mask. */
- int fWhatToShow;
+ unsigned long fWhatToShow;
/** The NodeFilter reference. */
- DOM_NodeFilter fNodeFilter;
+ DOM_NodeFilter* fNodeFilter;
+ /** The expandEntity reference flag. */
+ bool fExpandEntityReferences;
+
bool fDetached;
//
@@ -140,6 +154,7 @@
* </pre>
*/
bool fForward;
+
};
1.5 +46 -33 xml-xerces/c/src/dom/NodeIteratorImpl.cpp
Index: NodeIteratorImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/NodeIteratorImpl.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NodeIteratorImpl.cpp 1999/11/30 21:16:25 1.4
+++ NodeIteratorImpl.cpp 2000/02/04 01:49:26 1.5
@@ -56,6 +56,9 @@
/**
* $Log: NodeIteratorImpl.cpp,v $
+ * Revision 1.5 2000/02/04 01:49:26 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.4 1999/11/30 21:16:25 roddey
* Changes to add the transcode() method to DOMString, which returns a transcoded
* version (to local code page) of the DOM string contents. And I changed all of the
@@ -89,9 +92,10 @@
//////////////////////////////////////////////////////////////////////
NodeIteratorImpl::NodeIteratorImpl ()
+: fDetached(false),
+ fNodeFilter(0)
{
- fDetached = false;
-}
+}
NodeIteratorImpl::~NodeIteratorImpl ()
{
@@ -105,31 +109,43 @@
}
-NodeIteratorImpl::NodeIteratorImpl (DOM_Node root, int whatToShow, DOM_NodeFilter nodeFilter, NodeFilterImpl* fi)
+NodeIteratorImpl::NodeIteratorImpl (
+ DOM_Node root,
+ unsigned long whatToShow,
+ DOM_NodeFilter* nodeFilter,
+ bool expandEntityRef)
+: fDetached(false),
+ fRoot(root),
+ fCurrentNode(0),
+ fWhatToShow(whatToShow),
+ fNodeFilter(nodeFilter),
+ fForward(true),
+ fExpandEntityReferences(expandEntityRef)
{
- fDetached = false;
- fRoot = root;
- fCurrentNode = 0;
- fWhatToShow = whatToShow;
- fNodeFilter = nodeFilter;
-
- if (fi != 0L) {
- DOM_NodeFilter nf(fi);
- fNodeFilter = nf;
- }
+
+}
- fForward = true;
+
+NodeIteratorImpl::NodeIteratorImpl ( const NodeIteratorImpl& toCopy)
+ : fDetached(toCopy.fDetached),
+ fRoot(toCopy.fRoot),
+ fCurrentNode(toCopy.fCurrentNode),
+ fWhatToShow(toCopy.fWhatToShow),
+ fNodeFilter(toCopy.fNodeFilter),
+ fForward(toCopy.fForward),
+ fExpandEntityReferences(toCopy.fExpandEntityReferences)
+{
}
NodeIteratorImpl& NodeIteratorImpl::operator= (const NodeIteratorImpl& other) {
- fRoot = other.fRoot;
- fCurrentNode = other.fRoot;
- fWhatToShow = other.fWhatToShow;
- fNodeFilter = other.fNodeFilter;
- fForward = other.fForward;
- fDetached = other.fDetached;
-
+ fRoot = other.fRoot;
+ fCurrentNode = other.fRoot;
+ fWhatToShow = other.fWhatToShow;
+ fNodeFilter = other.fNodeFilter;
+ fForward = other.fForward;
+ fDetached = other.fDetached;
+ fExpandEntityReferences = other.fExpandEntityReferences;
return *this;
}
@@ -141,28 +157,23 @@
/** Return the whatToShow value */
-int NodeIteratorImpl::getWhatToShow () {
+unsigned long NodeIteratorImpl::getWhatToShow () {
return fWhatToShow;
}
/** Return the filter */
-DOM_NodeFilter NodeIteratorImpl::getFilter () {
+DOM_NodeFilter* NodeIteratorImpl::getFilter () {
return fNodeFilter;
}
-
-
-void NodeIteratorImpl::setWhatToShow (int what) {
- fWhatToShow = what;
-}
-
-void NodeIteratorImpl::setFilter (DOM_NodeFilter filter) {
- fNodeFilter = filter;
+/** Get the expandEntity reference flag. */
+bool NodeIteratorImpl::getExpandEntityReferences()
+{
+ return fExpandEntityReferences;
}
-
/** Return the next DOM_Node in the Iterator. The node is the next node in
* depth-first order which also passes the filter, and whatToShow.
* A null return means either that
@@ -270,7 +281,7 @@
return ((fWhatToShow & ((1 << node.getNodeType()) - 1)) != 0);
} else {
return ((fWhatToShow & ((1 << node.getNodeType()) - 1)) != 0 )
- && fNodeFilter.acceptNode(node) == DOM_NodeFilter::ACCEPT;
+ && fNodeFilter->acceptNode(node) == DOM_NodeFilter::FILTER_ACCEPT;
}
}
1.5 +5 -2 xml-xerces/c/src/dom/NodeImpl.hpp
Index: NodeImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/NodeImpl.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NodeImpl.hpp 2000/01/22 01:38:30 1.4
+++ NodeImpl.hpp 2000/02/04 01:49:26 1.5
@@ -59,6 +59,9 @@
/**
* $Log: NodeImpl.hpp,v $
+ * Revision 1.5 2000/02/04 01:49:26 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.4 2000/01/22 01:38:30 andyh
* Remove compiler warnings in DOM impl classes
*
@@ -166,7 +169,7 @@
virtual NodeListImpl *getChildNodes();
virtual NodeImpl * getFirstChild();
virtual NodeImpl * getLastChild();
- virtual int getLength();
+ virtual unsigned int getLength();
virtual NodeImpl * getNextSibling();
virtual DOMString getNodeName();
virtual short getNodeType();
@@ -178,7 +181,7 @@
virtual bool hasChildNodes();
virtual NodeImpl *insertBefore(NodeImpl *newChild, NodeImpl *refChild);
static bool isKidOK(NodeImpl *parent, NodeImpl *child);
- virtual NodeImpl *item(unsigned long index);
+ virtual NodeImpl *item(unsigned int index);
virtual void referenced();
virtual NodeImpl * removeChild(NodeImpl *oldChild);
virtual NodeImpl *replaceChild(NodeImpl *newChild, NodeImpl *oldChild);
1.9 +32 -21 xml-xerces/c/src/dom/NodeImpl.cpp
Index: NodeImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/NodeImpl.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- NodeImpl.cpp 2000/01/22 01:38:30 1.8
+++ NodeImpl.cpp 2000/02/04 01:49:26 1.9
@@ -56,6 +56,9 @@
/**
* $Log: NodeImpl.cpp,v $
+* Revision 1.9 2000/02/04 01:49:26 aruna1
+* TreeWalker and NodeIterator changes
+*
* Revision 1.8 2000/01/22 01:38:30 andyh
* Remove compiler warnings in DOM impl classes
*
@@ -102,12 +105,18 @@
#include "DOM_Node.hpp"
#include "DOM_DOMImplementation.hpp"
#include "DOMString.hpp"
+#include "DStringPool.hpp"
#include "DocumentImpl.hpp"
#include "stdio.h"
#include <util/XMLString.hpp>
#include <util/XMLUni.hpp>
#include "TextImpl.hpp"
+static DOMString *s_xml = null;
+static DOMString *s_xmlURI = null;
+static DOMString *s_xmlns = null;
+static DOMString *s_xmlnsURI = null;
+
NodeImpl::NodeImpl(DocumentImpl *ownerDoc,
const DOMString &nam, short nTyp,
bool isLeafNod, const DOMString &initValue)
@@ -143,7 +152,8 @@
const DOMString &fNamespaceURI, const DOMString &qualifiedName, short nTyp,
bool isLeafNod, const DOMString &initValue)
{
- static const DOMString xmlns("xmlns"); //need to revisit static initializer
+ DOMString xmlns = DStringPool::getStaticString("xmlns", &s_xmlns);
+ DOMString xmlnsURI = DStringPool::getStaticString("http://www.w3.org/2000/xmlns/", &s_xmlnsURI);
// Do we want to add isLeafNode to this? How about initial value?
this->ownerDocument=ownerDoc;
@@ -160,10 +170,14 @@
if (qNameLen == 0 || count > 1 || index == 0 || index == qNameLen-1)
throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
+ bool xmlnsAlone = false; //true if attribute name is "xmlns"
if (count == 0) { //count == 0 && index == -1
- if (nType == DOM_Node::ATTRIBUTE_NODE && this->name.equals(xmlns) &&
- fNamespaceURI != null && fNamespaceURI.length() != 0)
- throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
+ if (nTyp == DOM_Node::ATTRIBUTE_NODE && this->name.equals(xmlns)) {
+ if (fNamespaceURI != null && fNamespaceURI.length() != 0 &&
+ !fNamespaceURI.equals(xmlnsURI))
+ throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
+ xmlnsAlone = true;
+ }
this -> prefix = null;
this -> localName = this -> name;
} else { //count == 1 && 0 < index < qNameLen-1
@@ -171,7 +185,7 @@
this -> localName = this->name.substringData(index+1, qNameLen-index-1);
}
- const DOMString& URI = mapPrefix(prefix, fNamespaceURI, nTyp);
+ const DOMString& URI = xmlnsAlone ? xmlnsURI : mapPrefix(prefix, fNamespaceURI, nTyp);
this -> namespaceURI = URI == null ? DOMString(null) : URI.clone();
this->nType=nTyp;
@@ -329,8 +343,8 @@
};
-int NodeImpl::getLength() {
- int count = 0;
+unsigned int NodeImpl::getLength() {
+ unsigned int count = 0;
NodeImpl *node = firstChild;
while(node != null)
{
@@ -543,9 +557,9 @@
- NodeImpl *NodeImpl::item(unsigned long index) {
+ NodeImpl *NodeImpl::item(unsigned int index) {
NodeImpl *node = firstChild;
- for(unsigned long i=0; i<index && node!=null; ++i)
+ for(unsigned int i=0; i<index && node!=null; ++i)
node = node->nextSibling;
return node;
};
@@ -725,9 +739,9 @@
void NodeImpl::setPrefix(const DOMString &fPrefix)
{
- static const DOMString xml("xml");
- static const DOMString xmlURI("http://www.w3.org/XML/1998/namespace");
- static const DOMString xmlns("xmlns");
+ DOMString xml = DStringPool::getStaticString("xml", &s_xml);
+ DOMString xmlURI = DStringPool::getStaticString("http://www.w3.org/XML/1998/namespace", &s_xmlURI);
+ DOMString xmlns = DStringPool::getStaticString("xmlns", &s_xmlns);
if (readOnly)
throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
@@ -765,23 +779,20 @@
const DOMString& NodeImpl::mapPrefix(const DOMString &prefix,
const DOMString &namespaceURI, short nType)
{
- //The constants below are duplicates of those in setPrefix().
- //However, there is a static initializer problem if they are
- //defined outside of each function. Need to work on this later.
- static const DOMString xml("xml");
- static const DOMString xmlURI("http://www.w3.org/XML/1998/namespace");
- static const DOMString xmlns("xmlns");
- static const DOMString xmlnsURI("http://www.w3.org/2000/xmlns/");
+ DOMString xml = DStringPool::getStaticString("xml", &s_xml);
+ DOMString xmlURI = DStringPool::getStaticString("http://www.w3.org/XML/1998/namespace", &s_xmlURI);
+ DOMString xmlns = DStringPool::getStaticString("xmlns", &s_xmlns);
+ DOMString xmlnsURI = DStringPool::getStaticString("http://www.w3.org/2000/xmlns/", &s_xmlnsURI);
if (prefix == null)
return namespaceURI;
if (prefix.equals(xml)) {
if (namespaceURI == null || namespaceURI.length() == 0 || namespaceURI.equals(xmlURI))
- return xmlURI;
+ return *s_xmlURI;
throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
} else if (nType == DOM_Node::ATTRIBUTE_NODE && prefix.equals(xmlns)) {
if (namespaceURI == null || namespaceURI.length() == 0 || namespaceURI.equals(xmlnsURI))
- return xmlnsURI;
+ return *s_xmlnsURI;
throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
} else
return namespaceURI;
1.5 +5 -2 xml-xerces/c/src/dom/NamedNodeMapImpl.hpp
Index: NamedNodeMapImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/NamedNodeMapImpl.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NamedNodeMapImpl.hpp 2000/01/22 01:38:30 1.4
+++ NamedNodeMapImpl.hpp 2000/02/04 01:49:26 1.5
@@ -59,6 +59,9 @@
/**
* $Log: NamedNodeMapImpl.hpp,v $
+ * Revision 1.5 2000/02/04 01:49:26 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.4 2000/01/22 01:38:30 andyh
* Remove compiler warnings in DOM impl classes
*
@@ -123,9 +126,9 @@
virtual NamedNodeMapImpl *cloneMap();
static void addRef(NamedNodeMapImpl *);
virtual int findNamePoint(const DOMString &name);
- virtual int getLength();
+ virtual unsigned int getLength();
virtual NodeImpl *getNamedItem(const DOMString &name);
- virtual NodeImpl *item(unsigned long index);
+ virtual NodeImpl *item(unsigned int index);
virtual void removeAll();
virtual NodeImpl *removeNamedItem(const DOMString &name);
static void removeRef(NamedNodeMapImpl *);
1.7 +9 -6 xml-xerces/c/src/dom/NamedNodeMapImpl.cpp
Index: NamedNodeMapImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/NamedNodeMapImpl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- NamedNodeMapImpl.cpp 2000/01/22 01:38:30 1.6
+++ NamedNodeMapImpl.cpp 2000/02/04 01:49:26 1.7
@@ -56,6 +56,9 @@
/**
* $Log: NamedNodeMapImpl.cpp,v $
+ * Revision 1.7 2000/02/04 01:49:26 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.6 2000/01/22 01:38:30 andyh
* Remove compiler warnings in DOM impl classes
*
@@ -141,7 +144,7 @@
if (nodes != null)
{
newmap->nodes = new NodeVector(nodes->size());
- for (int i = 0; i < nodes->size(); ++i)
+ for (unsigned int i = 0; i < nodes->size(); ++i)
{
NodeImpl *n = nodes->elementAt(i)->cloneNode(deep);
n->owned = true;
@@ -231,7 +234,7 @@
-int NamedNodeMapImpl::getLength()
+unsigned int NamedNodeMapImpl::getLength()
{
reconcileDefaults();
return (nodes != null) ? nodes->size() : 0;
@@ -263,11 +266,11 @@
-NodeImpl * NamedNodeMapImpl::item(unsigned long index)
+NodeImpl * NamedNodeMapImpl::item(unsigned int index)
{
reconcileDefaults();
- return (nodes != null && index < (unsigned long) nodes->size()) ?
- (NodeImpl *) (nodes->elementAt((int) index)) : null;
+ return (nodes != null && index < nodes->size()) ?
+ (NodeImpl *) (nodes->elementAt(index)) : null;
};
@@ -496,7 +499,7 @@
if (nodes != null)
{
newmap->nodes = new NodeVector(nodes->size());
- for (int i = 0; i < nodes->size(); ++i)
+ for (unsigned int i = 0; i < nodes->size(); ++i)
{
NodeImpl *n = docImpl->importNode(nodes->elementAt(i), deep);
n->owned = true;
1.4 +6 -2 xml-xerces/c/src/dom/EntityReferenceImpl.hpp
Index: EntityReferenceImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/EntityReferenceImpl.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- EntityReferenceImpl.hpp 2000/01/24 23:35:18 1.3
+++ EntityReferenceImpl.hpp 2000/02/04 01:49:27 1.4
@@ -59,6 +59,9 @@
/**
* $Log: EntityReferenceImpl.hpp,v $
+ * Revision 1.4 2000/02/04 01:49:27 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.3 2000/01/24 23:35:18 rahulj
* Fixed the compiler warning generated under Solaris.
* Matched the api signature in the base class NodeImpl.hpp.
@@ -103,10 +106,10 @@
virtual NodeListImpl *getChildNodes();
virtual NodeImpl *getFirstChild();
virtual NodeImpl *getLastChild();
- virtual int getLength();
+ virtual unsigned int getLength();
virtual bool hasChildNodes();
virtual bool isEntityReference();
- virtual NodeImpl *item(unsigned long index);
+ virtual NodeImpl *item(unsigned int index);
virtual void setNodeValue(const DOMString &);
virtual void setReadOnly(bool readOnly,bool deep);
virtual void synchronize();
1.5 +7 -3 xml-xerces/c/src/dom/EntityReferenceImpl.cpp
Index: EntityReferenceImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/EntityReferenceImpl.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- EntityReferenceImpl.cpp 2000/01/24 23:35:18 1.4
+++ EntityReferenceImpl.cpp 2000/02/04 01:49:27 1.5
@@ -56,6 +56,9 @@
/**
* $Log: EntityReferenceImpl.cpp,v $
+* Revision 1.5 2000/02/04 01:49:27 aruna1
+* TreeWalker and NodeIterator changes
+*
* Revision 1.4 2000/01/24 23:35:18 rahulj
* Fixed the compiler warning generated under Solaris.
* Matched the api signature in the base class NodeImpl.hpp.
@@ -222,9 +225,9 @@
*
* @return org.w3c.dom.NodeList
*/
-int EntityReferenceImpl::getLength()
+unsigned int EntityReferenceImpl::getLength()
{
- int length = NodeImpl::getLength();
+ unsigned int length = NodeImpl::getLength();
#if (0) // Till we add entity nodes to the doc root element.
@@ -280,7 +283,7 @@
*
* @return org.w3c.dom.NodeList
*/
-NodeImpl *EntityReferenceImpl::item(unsigned long index) {
+NodeImpl *EntityReferenceImpl::item(unsigned int index) {
synchronize();
return NodeImpl::item(index);
}
1.2 +28 -38 xml-xerces/c/src/dom/DOM_TreeWalker.hpp
Index: DOM_TreeWalker.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_TreeWalker.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DOM_TreeWalker.hpp 1999/11/09 01:09:05 1.1
+++ DOM_TreeWalker.hpp 2000/02/04 01:49:27 1.2
@@ -56,9 +56,12 @@
/**
* $Log: DOM_TreeWalker.hpp,v $
- * Revision 1.1 1999/11/09 01:09:05 twl
- * Initial revision
+ * Revision 1.2 2000/02/04 01:49:27 aruna1
+ * TreeWalker and NodeIterator changes
*
+ * Revision 1.1.1.1 1999/11/09 01:09:05 twl
+ * Initial checkin
+ *
* Revision 1.3 1999/11/08 20:44:22 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -76,45 +79,32 @@
class CDOM_EXPORT DOM_TreeWalker {
public:
- // Constants for whatToShow
- static const int SHOW_ALL;
- static const int SHOW_ELEMENT;
- static const int SHOW_ATTRIBUTE;
- static const int SHOW_TEXT;
- static const int SHOW_CDATA_SECTION;
- static const int SHOW_ENTITY_REFERENCE;
- static const int SHOW_ENTITY;
- static const int SHOW_PROCESSING_INSTRUCTION;
- static const int SHOW_COMMENT;
- static const int SHOW_DOCUMENT;
- static const int SHOW_DOCUMENT_TYPE;
- static const int SHOW_DOCUMENT_FRAGMENT;
- static const int SHOW_NOTATION;
-
- DOM_TreeWalker ();
- DOM_TreeWalker (TreeWalkerImpl* impl);
- DOM_TreeWalker(const DOM_TreeWalker &other);
- DOM_TreeWalker & operator = (const DOM_TreeWalker &other);
- DOM_TreeWalker & operator = (const DOM_NullPtr *val);
- ~DOM_TreeWalker();
- bool operator == (const DOM_TreeWalker & other)const;
- bool operator == (const DOM_NullPtr *other) const;
- bool operator != (const DOM_TreeWalker & other) const;
- bool operator != (const DOM_NullPtr * other) const;
-
- virtual int getWhatToShow();
- virtual DOM_NodeFilter getFilter();
- virtual DOM_Node getCurrentNode();
- virtual void setCurrentNode(DOM_Node currentNode);
- virtual DOM_Node parentNode();
- virtual DOM_Node firstChild();
- virtual DOM_Node lastChild();
- virtual DOM_Node previousSibling();
- virtual DOM_Node nextSibling();
- virtual DOM_Node previousNode();
- virtual DOM_Node nextNode();
+
+
+ DOM_TreeWalker ();
+ DOM_TreeWalker (TreeWalkerImpl* impl);
+ DOM_TreeWalker(const DOM_TreeWalker &other);
+ DOM_TreeWalker & operator = (const DOM_TreeWalker &other);
+ DOM_TreeWalker & operator = (const DOM_NullPtr *val);
+ ~DOM_TreeWalker();
+ bool operator == (const DOM_TreeWalker & other)const;
+ bool operator == (const DOM_NullPtr *other) const;
+ bool operator != (const DOM_TreeWalker & other) const;
+ bool operator != (const DOM_NullPtr * other) const;
+
+ unsigned long getWhatToShow();
+ DOM_NodeFilter* getFilter();
+ DOM_Node getCurrentNode();
+ void setCurrentNode(DOM_Node currentNode);
+ DOM_Node parentNode();
+ DOM_Node firstChild();
+ DOM_Node lastChild();
+ DOM_Node previousSibling();
+ DOM_Node nextSibling();
+ DOM_Node previousNode();
+ DOM_Node nextNode();
- virtual void detach();
+ void detach();
private:
TreeWalkerImpl* fImpl;
1.2 +5 -15 xml-xerces/c/src/dom/DOM_TreeWalker.cpp
Index: DOM_TreeWalker.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_TreeWalker.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DOM_TreeWalker.cpp 1999/11/09 01:09:05 1.1
+++ DOM_TreeWalker.cpp 2000/02/04 01:49:27 1.2
@@ -56,9 +56,12 @@
/**
* $Log: DOM_TreeWalker.cpp,v $
- * Revision 1.1 1999/11/09 01:09:05 twl
- * Initial revision
+ * Revision 1.2 2000/02/04 01:49:27 aruna1
+ * TreeWalker and NodeIterator changes
*
+ * Revision 1.1.1.1 1999/11/09 01:09:05 twl
+ * Initial checkin
+ *
* Revision 1.2 1999/11/08 20:44:22 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -69,19 +72,6 @@
#include "TreeWalkerImpl.hpp"
-const int DOM_TreeWalker::SHOW_ALL = 0x0000FFFF;
-const int DOM_TreeWalker::SHOW_ELEMENT = 0x00000001;
-const int DOM_TreeWalker::SHOW_ATTRIBUTE = 0x00000002;
-const int DOM_TreeWalker::SHOW_TEXT = 0x00000004;
-const int DOM_TreeWalker::SHOW_CDATA_SECTION = 0x00000008;
-const int DOM_TreeWalker::SHOW_ENTITY_REFERENCE = 0x00000010;
-const int DOM_TreeWalker::SHOW_ENTITY = 0x00000020;
-const int DOM_TreeWalker::SHOW_PROCESSING_INSTRUCTION = 0x00000040;
-const int DOM_TreeWalker::SHOW_COMMENT = 0x00000080;
-const int DOM_TreeWalker::SHOW_DOCUMENT = 0x00000100;
-const int DOM_TreeWalker::SHOW_DOCUMENT_TYPE = 0x00000200;
-const int DOM_TreeWalker::SHOW_DOCUMENT_FRAGMENT = 0x00000400;
-const int DOM_TreeWalker::SHOW_NOTATION = 0x00000800;
@@ -160,12 +150,12 @@
-int DOM_TreeWalker::getWhatToShow() {
+unsigned long DOM_TreeWalker::getWhatToShow() {
return fImpl->getWhatToShow();
}
-DOM_NodeFilter DOM_TreeWalker::getFilter() {
+DOM_NodeFilter* DOM_TreeWalker::getFilter() {
return fImpl->getFilter();
}
1.3 +4 -1 xml-xerces/c/src/dom/DOM_Text.hpp
Index: DOM_Text.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_Text.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DOM_Text.hpp 2000/01/05 01:16:08 1.2
+++ DOM_Text.hpp 2000/02/04 01:49:27 1.3
@@ -56,6 +56,9 @@
/**
* $Log: DOM_Text.hpp,v $
+ * Revision 1.3 2000/02/04 01:49:27 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.2 2000/01/05 01:16:08 andyh
* DOM Level 2 core, namespace support added.
*
@@ -173,7 +176,7 @@
* than the number of characters in <code>data</code>.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
- DOM_Text splitText(int offset);
+ DOM_Text splitText(unsigned int offset);
//@}
protected:
1.2 +4 -1 xml-xerces/c/src/dom/DOM_Text.cpp
Index: DOM_Text.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_Text.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DOM_Text.cpp 1999/11/09 01:09:04 1.1
+++ DOM_Text.cpp 2000/02/04 01:49:27 1.2
@@ -56,9 +56,12 @@
/**
* $Log: DOM_Text.cpp,v $
- * Revision 1.1 1999/11/09 01:09:04 twl
- * Initial revision
+ * Revision 1.2 2000/02/04 01:49:27 aruna1
+ * TreeWalker and NodeIterator changes
*
+ * Revision 1.1.1.1 1999/11/09 01:09:04 twl
+ * Initial checkin
+ *
* Revision 1.2 1999/11/08 20:44:22 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -104,7 +107,7 @@
};
-DOM_Text DOM_Text::splitText(int offset)
+DOM_Text DOM_Text::splitText(unsigned int offset)
{
return DOM_Text(((TextImpl *)fImpl)->splitText(offset));
};
1.4 +5 -2 xml-xerces/c/src/dom/DOM_NodeList.hpp
Index: DOM_NodeList.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_NodeList.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DOM_NodeList.hpp 2000/01/22 01:38:29 1.3
+++ DOM_NodeList.hpp 2000/02/04 01:49:27 1.4
@@ -56,6 +56,9 @@
/**
* $Log: DOM_NodeList.hpp,v $
+ * Revision 1.4 2000/02/04 01:49:27 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.3 2000/01/22 01:38:29 andyh
* Remove compiler warnings in DOM impl classes
*
@@ -186,14 +189,14 @@
* <code>NodeList</code>, or <code>null</code> if that is not a valid
* index.
*/
- DOM_Node item(unsigned long index) const;
+ DOM_Node item(unsigned int index) const;
/**
* Returns the number of nodes in the list.
*
* The range of valid child node indices is 0 to <code>length-1</code> inclusive.
*/
- int getLength() const;
+ unsigned int getLength() const;
//@}
protected:
1.3 +5 -2 xml-xerces/c/src/dom/DOM_NodeList.cpp
Index: DOM_NodeList.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_NodeList.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DOM_NodeList.cpp 2000/01/22 01:38:29 1.2
+++ DOM_NodeList.cpp 2000/02/04 01:49:27 1.3
@@ -56,6 +56,9 @@
/**
* $Log: DOM_NodeList.cpp,v $
+ * Revision 1.3 2000/02/04 01:49:27 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.2 2000/01/22 01:38:29 andyh
* Remove compiler warnings in DOM impl classes
*
@@ -145,13 +148,13 @@
-DOM_Node DOM_NodeList::item(unsigned long index) const
+DOM_Node DOM_NodeList::item(unsigned int index) const
{
return DOM_Node(fImpl->item(index));
};
-int DOM_NodeList::getLength() const
+unsigned int DOM_NodeList::getLength() const
{
return fImpl->getLength();
};
1.2 +13 -20 xml-xerces/c/src/dom/DOM_NodeIterator.hpp
Index: DOM_NodeIterator.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_NodeIterator.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DOM_NodeIterator.hpp 1999/11/09 01:09:01 1.1
+++ DOM_NodeIterator.hpp 2000/02/04 01:49:28 1.2
@@ -56,9 +56,12 @@
/**
* $Log: DOM_NodeIterator.hpp,v $
- * Revision 1.1 1999/11/09 01:09:01 twl
- * Initial revision
+ * Revision 1.2 2000/02/04 01:49:28 aruna1
+ * TreeWalker and NodeIterator changes
*
+ * Revision 1.1.1.1 1999/11/09 01:09:01 twl
+ * Initial checkin
+ *
* Revision 1.3 1999/11/08 20:44:20 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -76,21 +79,7 @@
{
public:
// Constants for whatToShow...
-
- static const int SHOW_ALL;
- static const int SHOW_ELEMENT;
- static const int SHOW_ATTRIBUTE;
- static const int SHOW_TEXT;
- static const int SHOW_CDATA_SECTION;
- static const int SHOW_ENTITY_REFERENCE;
- static const int SHOW_ENTITY;
- static const int SHOW_PROCESSING_INSTRUCTION;
- static const int SHOW_COMMENT;
- static const int SHOW_DOCUMENT;
- static const int SHOW_DOCUMENT_TYPE;
- static const int SHOW_DOCUMENT_FRAGMENT;
- static const int SHOW_NOTATION;
-
+
DOM_NodeIterator ();
DOM_NodeIterator (NodeIteratorImpl* impl);
DOM_NodeIterator(const DOM_NodeIterator &other);
@@ -101,13 +90,17 @@
bool operator == (const DOM_NullPtr *other) const;
bool operator != (const DOM_NodeIterator & other) const;
bool operator != (const DOM_NullPtr * other) const;
+
+ unsigned long getWhatToShow();
+
+ DOM_NodeFilter* getFilter();
+ DOM_Node nextNode();
+ DOM_Node previousNode();
+ void detach();
- virtual int getWhatToShow();
+ /** Get the expandEntity reference flag. */
+ bool getExpandEntityReferences();
- virtual DOM_NodeFilter getFilter();
- virtual DOM_Node nextNode();
- virtual DOM_Node previousNode();
- virtual void detach();
private:
NodeIteratorImpl* fImpl;
1.2 +13 -20 xml-xerces/c/src/dom/DOM_NodeIterator.cpp
Index: DOM_NodeIterator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_NodeIterator.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DOM_NodeIterator.cpp 1999/11/09 01:09:01 1.1
+++ DOM_NodeIterator.cpp 2000/02/04 01:49:28 1.2
@@ -56,9 +56,12 @@
/**
* $Log: DOM_NodeIterator.cpp,v $
- * Revision 1.1 1999/11/09 01:09:01 twl
- * Initial revision
+ * Revision 1.2 2000/02/04 01:49:28 aruna1
+ * TreeWalker and NodeIterator changes
*
+ * Revision 1.1.1.1 1999/11/09 01:09:01 twl
+ * Initial checkin
+ *
* Revision 1.2 1999/11/08 20:44:20 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -70,25 +73,7 @@
-// Constants for whatToShow...
-
-const int DOM_NodeIterator::SHOW_ALL = 0xFFFF;
-const int DOM_NodeIterator::SHOW_ELEMENT = 0x00000001;
-const int DOM_NodeIterator::SHOW_ATTRIBUTE = 0x00000002;
-const int DOM_NodeIterator::SHOW_TEXT = 0x00000004;
-const int DOM_NodeIterator::SHOW_CDATA_SECTION = 0x00000008;
-const int DOM_NodeIterator::SHOW_ENTITY_REFERENCE = 0x00000010;
-const int DOM_NodeIterator::SHOW_ENTITY = 0x00000020;
-const int DOM_NodeIterator::SHOW_PROCESSING_INSTRUCTION = 0x00000040;
-const int DOM_NodeIterator::SHOW_COMMENT = 0x00000080;
-const int DOM_NodeIterator::SHOW_DOCUMENT = 0x00000100;
-const int DOM_NodeIterator::SHOW_DOCUMENT_TYPE = 0x00000200;
-const int DOM_NodeIterator::SHOW_DOCUMENT_FRAGMENT = 0x00000400;
-const int DOM_NodeIterator::SHOW_NOTATION = 0x00000800;
-
-
-
DOM_NodeIterator::DOM_NodeIterator()
{
fImpl = 0;
@@ -170,14 +155,22 @@
-int DOM_NodeIterator::getWhatToShow ()
+unsigned long DOM_NodeIterator::getWhatToShow ()
{
return fImpl->getWhatToShow();
}
-DOM_NodeFilter DOM_NodeIterator::getFilter() {
+DOM_NodeFilter* DOM_NodeIterator::getFilter() {
return fImpl->getFilter();
+}
+
+/** Get the expandEntity reference flag. */
+bool DOM_NodeIterator::getExpandEntityReferences()
+{
+ if (fImpl !=0)
+ return fImpl->getExpandEntityReferences();
+ return false;
}
1.2 +23 -12 xml-xerces/c/src/dom/DOM_NodeFilter.hpp
Index: DOM_NodeFilter.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_NodeFilter.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DOM_NodeFilter.hpp 1999/11/09 01:09:00 1.1
+++ DOM_NodeFilter.hpp 2000/02/04 01:49:28 1.2
@@ -56,9 +56,12 @@
/**
* $Log: DOM_NodeFilter.hpp,v $
- * Revision 1.1 1999/11/09 01:09:00 twl
- * Initial revision
+ * Revision 1.2 2000/02/04 01:49:28 aruna1
+ * TreeWalker and NodeIterator changes
*
+ * Revision 1.1.1.1 1999/11/09 01:09:00 twl
+ * Initial checkin
+ *
* Revision 1.2 1999/11/08 20:44:19 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -86,25 +89,33 @@
class CDOM_EXPORT DOM_NodeFilter
{
public:
- enum FilterAction {ACCEPT, REJECT, SKIP};
-
- DOM_NodeFilter (NodeFilterImpl* refCountedFilter);
+ enum FilterAction {FILTER_ACCEPT, FILTER_REJECT, FILTER_SKIP};
+ enum ShowType {
+ SHOW_ALL = 0x0000FFFF,
+ SHOW_ELEMENT = 0x00000001,
+ SHOW_ATTRIBUTE = 0x00000002,
+ SHOW_TEXT = 0x00000004,
+ SHOW_CDATA_SECTION = 0x00000008,
+ SHOW_ENTITY_REFERENCE = 0x00000010,
+ SHOW_ENTITY = 0x00000020,
+ SHOW_PROCESSING_INSTRUCTION = 0x00000040,
+ SHOW_COMMENT = 0x00000080,
+ SHOW_DOCUMENT = 0x00000100,
+ SHOW_DOCUMENT_TYPE = 0x00000200,
+ SHOW_DOCUMENT_FRAGMENT = 0x00000400,
+ SHOW_NOTATION = 0x00000800
+ };
DOM_NodeFilter();
+ virtual ~DOM_NodeFilter();
+ virtual short acceptNode (DOM_Node node) =0;
+
+private:
DOM_NodeFilter(const DOM_NodeFilter &other);
DOM_NodeFilter & operator = (const DOM_NodeFilter &other);
- DOM_NodeFilter & operator = (const DOM_NullPtr *val);
- ~DOM_NodeFilter();
bool operator == (const DOM_NodeFilter &other) const;
bool operator != (const DOM_NodeFilter &other) const;
- bool operator == (const DOM_NullPtr *nullPtr) const;
- bool operator != (const DOM_NullPtr *nullPtr) const;
-
- virtual FilterAction acceptNode (DOM_Node node);
-
- private:
- NodeFilterImpl* fImpl;
};
#endif
1.2 +5 -58 xml-xerces/c/src/dom/DOM_NodeFilter.cpp
Index: DOM_NodeFilter.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_NodeFilter.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DOM_NodeFilter.cpp 1999/11/09 01:09:00 1.1
+++ DOM_NodeFilter.cpp 2000/02/04 01:49:28 1.2
@@ -56,9 +56,12 @@
/**
* $Log: DOM_NodeFilter.cpp,v $
- * Revision 1.1 1999/11/09 01:09:00 twl
- * Initial revision
+ * Revision 1.2 2000/02/04 01:49:28 aruna1
+ * TreeWalker and NodeIterator changes
*
+ * Revision 1.1.1.1 1999/11/09 01:09:00 twl
+ * Initial checkin
+ *
* Revision 1.2 1999/11/08 20:44:19 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -69,71 +72,15 @@
//////////////////////////////////////////////////////////////////////
#include "DOM_NodeFilter.hpp"
-#include "NodeFilterImpl.hpp"
DOM_NodeFilter::DOM_NodeFilter() {
- fImpl = 0;
-}
-
-
-DOM_NodeFilter::DOM_NodeFilter(NodeFilterImpl *impl) {
- fImpl = impl;
- RefCountedImpl::addRef(fImpl);
-}
-
-
-DOM_NodeFilter::DOM_NodeFilter(const DOM_NodeFilter &other){
- fImpl = other.fImpl;
- RefCountedImpl::addRef(fImpl);
-}
-
-
-DOM_NodeFilter & DOM_NodeFilter::operator = (const DOM_NodeFilter &other) {
- if (this->fImpl != other.fImpl)
- {
- RefCountedImpl::removeRef(this->fImpl);
- this->fImpl = other.fImpl;
- RefCountedImpl::addRef(this->fImpl);
- }
- return *this;
-}
-
-
-DOM_NodeFilter & DOM_NodeFilter::operator = (const DOM_NullPtr *other) {
- RefCountedImpl::removeRef(this->fImpl);
- this->fImpl = 0;
- return *this;
+
}
DOM_NodeFilter::~DOM_NodeFilter() {
- RefCountedImpl::removeRef(this->fImpl);
- fImpl = 0;
+
}
-bool DOM_NodeFilter::operator == (const DOM_NodeFilter &other) const {
- return this->fImpl == other.fImpl;
-}
-
-
-bool DOM_NodeFilter::operator != (const DOM_NodeFilter &other) const {
- return this->fImpl != other.fImpl;
-}
-
-
-bool DOM_NodeFilter::operator == (const DOM_NullPtr *nullPtr) const
-{
- return this->fImpl == 0;
-}
-
-
-bool DOM_NodeFilter::operator != (const DOM_NullPtr *nullPtr) const {
- return this->fImpl != 0;
-}
-
-
-DOM_NodeFilter::FilterAction DOM_NodeFilter::acceptNode (DOM_Node node) {
- return this->fImpl->acceptNode(node);
-}
1.4 +5 -2 xml-xerces/c/src/dom/DOM_NamedNodeMap.hpp
Index: DOM_NamedNodeMap.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_NamedNodeMap.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DOM_NamedNodeMap.hpp 2000/01/22 01:38:29 1.3
+++ DOM_NamedNodeMap.hpp 2000/02/04 01:49:28 1.4
@@ -56,6 +56,9 @@
/**
* $Log: DOM_NamedNodeMap.hpp,v $
+ * Revision 1.4 2000/02/04 01:49:28 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.3 2000/01/22 01:38:29 andyh
* Remove compiler warnings in DOM impl classes
*
@@ -203,7 +206,7 @@
* <code>NamedNodeMap</code>, or <code>null</code> if that is not a valid
* index.
*/
- DOM_Node item(unsigned long index);
+ DOM_Node item(unsigned int index);
//@}
/** @name Get functions. */
@@ -225,7 +228,7 @@
* The range of valid child node indices is
* 0 to <code>length-1</code> inclusive.
*/
- int getLength();
+ unsigned int getLength() const;
//@}
/** @name Functions to change the node collection. */
1.4 +5 -2 xml-xerces/c/src/dom/DOM_NamedNodeMap.cpp
Index: DOM_NamedNodeMap.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_NamedNodeMap.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DOM_NamedNodeMap.cpp 2000/01/22 01:38:29 1.3
+++ DOM_NamedNodeMap.cpp 2000/02/04 01:49:28 1.4
@@ -56,6 +56,9 @@
/**
* $Log: DOM_NamedNodeMap.cpp,v $
+ * Revision 1.4 2000/02/04 01:49:28 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.3 2000/01/22 01:38:29 andyh
* Remove compiler warnings in DOM impl classes
*
@@ -163,13 +166,13 @@
};
-DOM_Node DOM_NamedNodeMap::item(unsigned long index)
+DOM_Node DOM_NamedNodeMap::item(unsigned int index)
{
return DOM_Node(fImpl->item(index));
};
-int DOM_NamedNodeMap::getLength()
+unsigned int DOM_NamedNodeMap::getLength() const
{
return fImpl->getLength();
};
1.5 +7 -16 xml-xerces/c/src/dom/DOM_Document.hpp
Index: DOM_Document.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_Document.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DOM_Document.hpp 2000/01/22 01:38:29 1.4
+++ DOM_Document.hpp 2000/02/04 01:49:28 1.5
@@ -56,6 +56,9 @@
/**
* $Log: DOM_Document.hpp,v $
+ * Revision 1.5 2000/02/04 01:49:28 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.4 2000/01/22 01:38:29 andyh
* Remove compiler warnings in DOM impl classes
*
@@ -349,28 +352,16 @@
/**
* Creates a NodeIterator object. (DOM2)
*/
-
- static DOM_NodeIterator createNodeIterator(DOM_Node root, short whatToShow, DOM_NodeFilter filter);
- // Same as above, but conveniently allows a pointer to an implementation of a filter to be passed. This filter will be
- // wrapped internally by a DOM_NodeFilter, and when you get the filter from the interator/walker, you will get a
- // DOM_NodeFilter object.
- static DOM_NodeIterator createNodeIterator(DOM_Node root, short whatToShow, NodeFilterImpl* filterThatWillBeAdopted);
+ DOM_NodeIterator createNodeIterator(DOM_Node root, unsigned long whatToShow, DOM_NodeFilter* filter, bool entityReferenceExpansion);
-
- /**
+ /**
* Creates a TreeWalker object. (DOM2)
*/
- static DOM_TreeWalker createTreeWalker(DOM_Node root, short whatToShow, DOM_NodeFilter filter);
+ DOM_TreeWalker createTreeWalker(DOM_Node root, unsigned long whatToShow, DOM_NodeFilter* filter, bool entityReferenceExpansion);
- // Same as above, but conveniently allows a pointer to an implementation of a filter to be passed. This filter will be
- // wrapped internally by a DOM_NodeFilter, and when you get the filter from the interator/walker, you will get a
- // DOM_NodeFilter object.
- static DOM_TreeWalker createTreeWalker(DOM_Node root, short whatToShow, NodeFilterImpl* filterThatWillBeAdopted);
-
-
- //@}
+ //@}
/** @name Getter functions */
//@{
/**
1.4 +7 -15 xml-xerces/c/src/dom/DOM_Document.cpp
Index: DOM_Document.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_Document.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DOM_Document.cpp 2000/01/05 01:16:07 1.3
+++ DOM_Document.cpp 2000/02/04 01:49:29 1.4
@@ -56,6 +56,9 @@
/**
* $Log: DOM_Document.cpp,v $
+ * Revision 1.4 2000/02/04 01:49:29 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.3 2000/01/05 01:16:07 andyh
* DOM Level 2 core, namespace support added.
*
@@ -203,26 +206,15 @@
return DOM_EntityReference(((DocumentImpl *)fImpl)->createEntityReference(name));
};
-
-DOM_NodeIterator DOM_Document::createNodeIterator(DOM_Node root, short whatToShow, DOM_NodeFilter filter) {
- return DOM_NodeIterator(DocumentImpl::createNodeIterator(root, whatToShow, filter, 0L));
-};
-
-DOM_TreeWalker DOM_Document::createTreeWalker(DOM_Node root, short whatToShow, DOM_NodeFilter filter) {
- return DOM_TreeWalker(DocumentImpl::createTreeWalker(root, whatToShow, filter, 0L));
+DOM_NodeIterator DOM_Document::createNodeIterator(DOM_Node root, unsigned long whatToShow, DOM_NodeFilter* filter, bool entityReferenceExpansion) {
+ return DOM_NodeIterator(DocumentImpl::createNodeIterator(root, whatToShow, filter, entityReferenceExpansion));
};
-DOM_NodeIterator DOM_Document::createNodeIterator(DOM_Node root, short whatToShow, NodeFilterImpl* filterThatWillBeAdopted) {
- return DOM_NodeIterator(DocumentImpl::createNodeIterator(root, whatToShow, 0, filterThatWillBeAdopted));
+DOM_TreeWalker DOM_Document::createTreeWalker(DOM_Node root, unsigned long whatToShow, DOM_NodeFilter* filter, bool entityReferenceExpansion) {
+ return DOM_TreeWalker(DocumentImpl::createTreeWalker(root, whatToShow, filter, entityReferenceExpansion));
};
-
-
-DOM_TreeWalker DOM_Document::createTreeWalker(DOM_Node root, short whatToShow, NodeFilterImpl* filterThatWillBeAdopted) {
- return DOM_TreeWalker(DocumentImpl::createTreeWalker(root, whatToShow, 0, filterThatWillBeAdopted));
-};
-
DOM_NodeList DOM_Document::getElementsByTagName(const DOMString &tagname) const {
1.2 +11 -8 xml-xerces/c/src/dom/DOM_CharacterData.hpp
Index: DOM_CharacterData.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_CharacterData.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DOM_CharacterData.hpp 1999/11/09 01:08:49 1.1
+++ DOM_CharacterData.hpp 2000/02/04 01:49:29 1.2
@@ -56,9 +56,12 @@
/**
* $Log: DOM_CharacterData.hpp,v $
- * Revision 1.1 1999/11/09 01:08:49 twl
- * Initial revision
+ * Revision 1.2 2000/02/04 01:49:29 aruna1
+ * TreeWalker and NodeIterator changes
*
+ * Revision 1.1.1.1 1999/11/09 01:08:49 twl
+ * Initial checkin
+ *
* Revision 1.2 1999/11/08 20:44:13 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -166,7 +169,7 @@
* This may have the value
* zero, i.e., <code>CharacterData</code> nodes may be empty.
*/
- int getLength() const;
+ unsigned int getLength() const;
/**
* Extracts a range of data from the node.
*
@@ -182,8 +185,8 @@
* <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text does not
* fit into a <code>DOMString</code>.
*/
- DOMString substringData(int offset,
- int count) const;
+ DOMString substringData(unsigned int offset,
+ unsigned int count) const;
//@}
/** @name Functions that set or change data. */
//@{
@@ -207,7 +210,7 @@
* than the number of characters in <code>data</code>.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
- void insertData(int offset, const DOMString &arg);
+ void insertData(unsigned int offset, const DOMString &arg);
/**
* Remove a range of characters from the node.
*
@@ -224,8 +227,8 @@
* specified <code>count</code> is negative.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
- void deleteData(int offset,
- int count);
+ void deleteData(unsigned int offset,
+ unsigned int count);
/**
* Replace the characters starting at the specified character offset with
* the specified string.
@@ -244,8 +247,8 @@
* specified <code>count</code> is negative.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
- void replaceData(int offset,
- int count,
+ void replaceData(unsigned int offset,
+ unsigned int count,
const DOMString &arg);
/**
1.3 +12 -5 xml-xerces/c/src/dom/DOM_CharacterData.cpp
Index: DOM_CharacterData.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_CharacterData.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DOM_CharacterData.cpp 1999/12/03 00:11:22 1.2
+++ DOM_CharacterData.cpp 2000/02/04 01:49:29 1.3
@@ -56,6 +56,9 @@
/**
* $Log: DOM_CharacterData.cpp,v $
+ * Revision 1.3 2000/02/04 01:49:29 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.2 1999/12/03 00:11:22 andyh
* Added DOMString.clone() to node parameters in and out of the DOM,
* where they had been missed.
@@ -118,14 +121,14 @@
-int DOM_CharacterData::getLength() const
+unsigned int DOM_CharacterData::getLength() const
{
return ((CharacterDataImpl *)fImpl)->getCharDataLength();
};
-DOMString DOM_CharacterData::substringData(int offset, int count) const
+DOMString DOM_CharacterData::substringData(unsigned int offset, unsigned int count) const
{
return ((CharacterDataImpl *)fImpl)->substringData(offset, count);
};
@@ -139,20 +142,20 @@
-void DOM_CharacterData::insertData(int offset, const DOMString &arg){
+void DOM_CharacterData::insertData(unsigned int offset, const DOMString &arg){
((CharacterDataImpl *)fImpl)->insertData(offset, arg);
};
-void DOM_CharacterData::deleteData(int offset, int count)
+void DOM_CharacterData::deleteData(unsigned int offset, unsigned int count)
{
((CharacterDataImpl *)fImpl)->deleteData(offset, count);
};
-void DOM_CharacterData::replaceData(int offset, int count, const DOMString &arg)
+void DOM_CharacterData::replaceData(unsigned int offset, unsigned int count, const DOMString &arg)
{
((CharacterDataImpl *)fImpl)->replaceData(offset, count, arg);
};
1.4 +5 -2 xml-xerces/c/src/dom/DocumentImpl.hpp
Index: DocumentImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DocumentImpl.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DocumentImpl.hpp 2000/01/05 01:16:08 1.3
+++ DocumentImpl.hpp 2000/02/04 01:49:30 1.4
@@ -59,6 +59,9 @@
/**
* $Log: DocumentImpl.hpp,v $
+ * Revision 1.4 2000/02/04 01:49:30 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.3 2000/01/05 01:16:08 andyh
* DOM Level 2 core, namespace support added.
*
@@ -157,8 +160,8 @@
virtual NodeImpl *removeChild(NodeImpl *oldChild);
virtual void setNodeValue(const DOMString & x);
virtual void unreferenced();
- static NodeIteratorImpl* createNodeIterator(DOM_Node root, short whatToShow, DOM_NodeFilter filter, NodeFilterImpl* fi);
- static TreeWalkerImpl* createTreeWalker(DOM_Node root, short whatToShow, DOM_NodeFilter filter, NodeFilterImpl* fi);
+ static NodeIteratorImpl* createNodeIterator(DOM_Node root, unsigned long whatToShow, DOM_NodeFilter* filter, bool entityReferenceExpansion);
+ static TreeWalkerImpl* createTreeWalker(DOM_Node root, unsigned long whatToShow, DOM_NodeFilter* filter, bool entityReferenceExpansion);
//Introduced in DOM Level 2
virtual NodeImpl *importNode(NodeImpl *source, bool deep);
1.7 +8 -5 xml-xerces/c/src/dom/DocumentImpl.cpp
Index: DocumentImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DocumentImpl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DocumentImpl.cpp 2000/01/22 01:38:30 1.6
+++ DocumentImpl.cpp 2000/02/04 01:49:30 1.7
@@ -56,6 +56,9 @@
/**
* $Log: DocumentImpl.cpp,v $
+ * Revision 1.7 2000/02/04 01:49:30 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.6 2000/01/22 01:38:30 andyh
* Remove compiler warnings in DOM impl classes
*
@@ -302,14 +305,14 @@
};
-NodeIteratorImpl* DocumentImpl::createNodeIterator (DOM_Node root, short whatToShow, DOM_NodeFilter filter, NodeFilterImpl* fi)
+NodeIteratorImpl* DocumentImpl::createNodeIterator (DOM_Node root, unsigned long whatToShow, DOM_NodeFilter* filter, bool entityReferenceExpansion)
{
// Create the node iterator implementation object.
// Add it to the vector of iterators that must be synchronized when a node is deleted.
// The vector of iterators is kept in the "owner document" if there is one. If there isn't one, I assume that root is the
// owner document.
- NodeIteratorImpl* iter = new NodeIteratorImpl(root, whatToShow, filter, fi);
+ NodeIteratorImpl* iter = new NodeIteratorImpl(root, whatToShow, filter, entityReferenceExpansion);
DOM_Document doc = root.getOwnerDocument();
DocumentImpl* impl;
@@ -328,11 +331,11 @@
}
-TreeWalkerImpl* DocumentImpl::createTreeWalker (DOM_Node root, short whatToShow, DOM_NodeFilter filter, NodeFilterImpl* fi)
+TreeWalkerImpl* DocumentImpl::createTreeWalker (DOM_Node root, unsigned long whatToShow, DOM_NodeFilter* filter, bool entityReferenceExpansion)
{
// See notes for createNodeIterator...
- TreeWalkerImpl* twi = new TreeWalkerImpl(root, whatToShow, filter, fi);
+ TreeWalkerImpl* twi = new TreeWalkerImpl(root, whatToShow, filter, entityReferenceExpansion);
DOM_Document doc = root.getOwnerDocument();
DocumentImpl* impl;
@@ -486,7 +489,7 @@
newelement = createElementNS(source->getNamespaceURI(), source->getNodeName());
NamedNodeMapImpl *srcattr=source->getAttributes();
if(srcattr!=null)
- for(int i=0;i<srcattr->getLength();++i)
+ for(unsigned int i=0;i<srcattr->getLength();++i)
{
AttrImpl *attr = (AttrImpl *) srcattr->item(i);
if (attr -> getSpecified()) //not a default attribute
1.4 +5 -2 xml-xerces/c/src/dom/DeepNodeListImpl.hpp
Index: DeepNodeListImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DeepNodeListImpl.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DeepNodeListImpl.hpp 2000/01/22 01:38:29 1.3
+++ DeepNodeListImpl.hpp 2000/02/04 01:49:30 1.4
@@ -59,6 +59,9 @@
/**
* $Log: DeepNodeListImpl.hpp,v $
+ * Revision 1.4 2000/02/04 01:49:30 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.3 2000/01/22 01:38:29 andyh
* Remove compiler warnings in DOM impl classes
*
@@ -113,8 +116,8 @@
DeepNodeListImpl(NodeImpl *rootNode, //DOM Level 2
const DOMString &namespaceURI, const DOMString &localName);
virtual ~DeepNodeListImpl();
- virtual int getLength();
- virtual NodeImpl *item(unsigned long index);
+ virtual unsigned int getLength();
+ virtual NodeImpl *item(unsigned int index);
private:
virtual NodeImpl *nextMatchingElementAfter(NodeImpl *current);
virtual void unreferenced();
1.3 +7 -4 xml-xerces/c/src/dom/DeepNodeListImpl.cpp
Index: DeepNodeListImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/DeepNodeListImpl.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DeepNodeListImpl.cpp 2000/01/22 01:38:29 1.2
+++ DeepNodeListImpl.cpp 2000/02/04 01:49:30 1.3
@@ -56,6 +56,9 @@
/**
* $Log: DeepNodeListImpl.cpp,v $
+ * Revision 1.3 2000/02/04 01:49:30 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.2 2000/01/22 01:38:29 andyh
* Remove compiler warnings in DOM impl classes
*
@@ -110,7 +113,7 @@
};
-int DeepNodeListImpl::getLength()
+unsigned int DeepNodeListImpl::getLength()
{
// Preload all matching elements. (Stops when we run out of subtree!)
item(INT_MAX);
@@ -129,7 +132,7 @@
// irrelevant ones. Doing so in a really useful manner would seem
// to involve a tree-walk in its own right, or maintaining our data
// in a parallel tree.
-NodeImpl *DeepNodeListImpl::item(unsigned long index)
+NodeImpl *DeepNodeListImpl::item(unsigned int index)
{
NodeImpl *thisNode;
@@ -139,7 +142,7 @@
changes=rootNode->changes;
}
- if(index< (unsigned long) nodes->size()) // In the cache
+ if(index< nodes->size()) // In the cache
return nodes->elementAt((int) index);
else // Not yet seen
{
@@ -148,7 +151,7 @@
else
thisNode=nodes->lastElement();
- while(thisNode!=null && index >= (unsigned long) nodes->size() && thisNode!=null)
+ while(thisNode!=null && index >= nodes->size() && thisNode!=null)
{
thisNode=nextMatchingElementAfter(thisNode);
if(thisNode!=null)
1.4 +12 -5 xml-xerces/c/src/dom/CharacterDataImpl.hpp
Index: CharacterDataImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/CharacterDataImpl.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CharacterDataImpl.hpp 1999/12/21 07:47:06 1.3
+++ CharacterDataImpl.hpp 2000/02/04 01:49:30 1.4
@@ -59,6 +59,9 @@
/**
* $Log: CharacterDataImpl.hpp,v $
+ * Revision 1.4 2000/02/04 01:49:30 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.3 1999/12/21 07:47:06 robweir
* Patches to support Xalan, where we need to create a
* "special" DOM with subclassed Nodes.
@@ -104,13 +107,13 @@
virtual ~CharacterDataImpl();
virtual void appendData(const DOMString &data);
virtual NodeImpl *cloneNode(bool deep);
- virtual void deleteData(int offset, int count);
+ virtual void deleteData(unsigned int offset, unsigned int count);
virtual DOMString &getData();
- virtual int getCharDataLength();
- virtual void insertData(int offset, const DOMString &data);
- virtual void replaceData(int offset, int count, const DOMString &data);
+ virtual unsigned int getCharDataLength();
+ virtual void insertData(unsigned int offset, const DOMString &data);
+ virtual void replaceData(unsigned int offset, unsigned int count, const DOMString &data);
virtual void setData(const DOMString &arg);
- virtual DOMString substringData(int offset, int count);
+ virtual DOMString substringData(unsigned int offset, unsigned int count);
};
1.4 +18 -9 xml-xerces/c/src/dom/CharacterDataImpl.cpp
Index: CharacterDataImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/CharacterDataImpl.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CharacterDataImpl.cpp 1999/12/03 00:11:22 1.3
+++ CharacterDataImpl.cpp 2000/02/04 01:49:30 1.4
@@ -56,6 +56,9 @@
/**
* $Log: CharacterDataImpl.cpp,v $
+ * Revision 1.4 2000/02/04 01:49:30 aruna1
+ * TreeWalker and NodeIterator changes
+ *
* Revision 1.3 1999/12/03 00:11:22 andyh
* Added DOMString.clone() to node parameters in and out of the DOM,
* where they had been missed.
@@ -113,7 +116,7 @@
};
-void CharacterDataImpl::deleteData(int offset, int count)
+void CharacterDataImpl::deleteData(unsigned int offset, unsigned int count)
{
if (readOnly)
throw DOM_DOMException(
@@ -131,7 +134,7 @@
//{
// throw DOM_DOMException(DOMException.INDEX_SIZE_ERR, null);
- int len = value.length();
+ unsigned int len = value.length(); //assert(value.length() >= 0)
if (offset < 0 || offset >= len)
throw DOM_DOMException(DOM_DOMException::INDEX_SIZE_ERR, null);
@@ -156,21 +159,22 @@
// all of the names are correct from an external API
// point of view.
//
-int CharacterDataImpl::getCharDataLength()
+unsigned int CharacterDataImpl::getCharDataLength()
{
- return value.length();
+ return value.length(); //assert(value.length() >= 0)
};
-void CharacterDataImpl::insertData(int offset, const DOMString &data)
+void CharacterDataImpl::insertData(unsigned int offset, const DOMString &data)
{
if (readOnly)
throw DOM_DOMException(
DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
- if (offset<0 || offset>value.length())
+ unsigned int len = value.length(); //assert(value.length() >= 0)
+ if (offset<0 || offset>len)
throw DOM_DOMException(DOM_DOMException::INDEX_SIZE_ERR, null);
value.insertData(offset, data);
@@ -178,7 +182,7 @@
-void CharacterDataImpl::replaceData(int offset, int count, const DOMString &data)
+void CharacterDataImpl::replaceData(unsigned int offset, unsigned int count, const DOMString &data)
{
if (readOnly)
throw DOM_DOMException(
@@ -201,10 +205,11 @@
-DOMString CharacterDataImpl::substringData(int offset, int count)
+DOMString CharacterDataImpl::substringData(unsigned int offset, unsigned int count)
{
- if(count < 0 || offset < 0 || offset > value.length()-1)
+ unsigned int len = value.length(); //assert(value.length() >= 0)
+ if(count < 0 || offset < 0 || offset >= len)
throw DOM_DOMException(DOM_DOMException::INDEX_SIZE_ERR,null);
return value.substringData(offset, count);
Re: cvs commit: xml-xerces/c/src/dom TreeWalkerImpl.hpp TreeWalkerImpl.cpp TextImpl.hpp TextImpl.cpp NodeVector.hpp NodeVector.cpp NodeListImpl.hpp NodeIteratorImpl.hpp NodeIteratorImpl.cpp NodeImpl.hpp NodeImpl.cpp NamedNodeMapImpl.hpp NamedNodeMapImpl.
Posted by Andy Heninger <he...@us.ibm.com>.
In addition to fixes to DOM Iterators and Treewalkers, this set of commits
also changes all offset and count variables in the public DOM API from int
to unsigned int.
This fact was accidently left out of the commit message.
-- Andy
----- Original Message -----
From: <ar...@locus.apache.org>
To: <xm...@apache.org>
Sent: Thursday, February 03, 2000 5:49 PM
Subject: cvs commit: xml-xerces/c/src/dom TreeWalkerImpl.hpp
TreeWalkerImpl.cpp TextImpl.hpp TextImpl.cpp NodeVector.hpp NodeVector.cpp
NodeListImpl.hpp NodeIteratorImpl.hpp NodeIteratorImpl.cpp NodeImpl.hpp
NodeImpl.cpp NamedNodeMapImpl.hpp NamedNodeMapImpl.cpp
EntityReferenceImpl.hpp EntityReferenceImpl.cpp DOM_TreeWalker.hpp
DOM_TreeWalker.cpp DOM_Text.hpp DOM_Text.cpp DOM_NodeList.hpp
DOM_NodeList.cpp DOM_NodeIterator.hpp DOM_NodeIterator.cpp
DOM_NodeFilter.hpp DOM_NodeFilter.cpp DOM_NamedNodeMap.hpp
DOM_NamedNodeMap.cpp DOM_Document.hpp DOM_Document.cpp DOM_CharacterData.hpp
DOM_CharacterData.cpp DocumentImpl.hpp DocumentImpl.cpp DeepNodeListImpl.hpp
DeepNodeListImpl.cpp CharacterDataImpl.hpp CharacterDataImpl.cpp
> aruna1 00/02/03 17:49:37
>
> Modified: c/src/dom TreeWalkerImpl.hpp TreeWalkerImpl.cpp
TextImpl.hpp
> TextImpl.cpp NodeVector.hpp NodeVector.cpp
> NodeListImpl.hpp NodeIteratorImpl.hpp
> NodeIteratorImpl.cpp NodeImpl.hpp NodeImpl.cpp
> NamedNodeMapImpl.hpp NamedNodeMapImpl.cpp
> EntityReferenceImpl.hpp EntityReferenceImpl.cpp
> DOM_TreeWalker.hpp DOM_TreeWalker.cpp DOM_Text.hpp
> DOM_Text.cpp DOM_NodeList.hpp DOM_NodeList.cpp
> DOM_NodeIterator.hpp DOM_NodeIterator.cpp
> DOM_NodeFilter.hpp DOM_NodeFilter.cpp
> DOM_NamedNodeMap.hpp DOM_NamedNodeMap.cpp
> DOM_Document.hpp DOM_Document.cpp
> DOM_CharacterData.hpp DOM_CharacterData.cpp
> DocumentImpl.hpp DocumentImpl.cpp
> DeepNodeListImpl.hpp DeepNodeListImpl.cpp
> CharacterDataImpl.hpp CharacterDataImpl.cpp