dbertoni    2003/01/28 21:23:01

  Modified:    c/src/TestXPath NodeNameTreeWalker.cpp
                        NodeNameTreeWalker.hpp TestXPath.cpp
  Log:
  Added support for stopping a traversal, then restarting it.
  
  Revision  Changes    Path
  1.5       +18 -6     xml-xalan/c/src/TestXPath/NodeNameTreeWalker.cpp
  
  Index: NodeNameTreeWalker.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/TestXPath/NodeNameTreeWalker.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NodeNameTreeWalker.cpp    22 Nov 2002 02:28:00 -0000      1.4
  +++ NodeNameTreeWalker.cpp    29 Jan 2003 05:23:01 -0000      1.5
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -120,7 +120,7 @@
   
   
   
  -void
  +bool
   NodeNameTreeWalker::startNode(XalanNode*     node)
   {
        const XalanDOMString&   theNodeName = node->getNodeName();
  @@ -129,27 +129,39 @@
        {
                m_matchingNodes.push_back(node);
        }
  +
  +     return false;
   }
   
   
   
  -void
  +bool
   NodeNameTreeWalker::endNode(XalanNode*       /* node */)
   {
  +     return false;
   }
   
   
   
  -void
  -NodeNameTreeWalker::startNode(const XalanNode*       /* node */)
  +bool
  +NodeNameTreeWalker::startNode(const XalanNode*       node)
   {
  +     const XalanDOMString&   theNodeName = node->getNodeName();
  +
  +     if (equals(theNodeName, m_nodeName) == true)
  +     {
  +             m_matchingNodes.push_back(node);
  +     }
  +
  +     return false;
   }
   
   
   
  -void
  +bool
   NodeNameTreeWalker::endNode(const XalanNode* /* node */)
   {
  +     return false;
   }
   
   
  
  
  
  1.6       +8 -7      xml-xalan/c/src/TestXPath/NodeNameTreeWalker.hpp
  
  Index: NodeNameTreeWalker.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/TestXPath/NodeNameTreeWalker.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- NodeNameTreeWalker.hpp    25 Nov 2002 22:02:53 -0000      1.5
  +++ NodeNameTreeWalker.hpp    29 Jan 2003 05:23:01 -0000      1.6
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -80,9 +80,9 @@
   public:
   
   #if defined(XALAN_NO_STD_NAMESPACE)
  -     typedef vector<XalanNode*>                      NodeVectorType;
  +     typedef vector<const XalanNode*>                NodeVectorType;
   #else
  -     typedef std::vector<XalanNode*>         NodeVectorType;
  +     typedef std::vector<const XalanNode*>   NodeVectorType;
   #endif
   
        NodeNameTreeWalker();
  @@ -120,21 +120,22 @@
   
   protected:
   
  -     virtual void
  +     virtual bool
        startNode(XalanNode*    node);
   
  -     virtual void
  +     virtual bool
        endNode(XalanNode*      node);
   
  -     virtual void
  +     virtual bool
        startNode(const XalanNode*      node);
   
  -     virtual void
  +     virtual bool
        endNode(const XalanNode*        node);
   
   private:
   
        XalanDOMString  m_nodeName;
  +
        NodeVectorType  m_matchingNodes;
   };
   
  
  
  
  1.38      +2 -2      xml-xalan/c/src/TestXPath/TestXPath.cpp
  
  Index: TestXPath.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/TestXPath/TestXPath.cpp,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- TestXPath.cpp     25 Nov 2002 22:02:53 -0000      1.37
  +++ TestXPath.cpp     29 Jan 2003 05:23:01 -0000      1.38
  @@ -343,7 +343,7 @@
   
   XalanDOMString
   GetAttributeFromNode(
  -                     XalanNode*                              theNode,
  +                     const XalanNode*                theNode,
                        const XalanDOMString&   theAttributeName)
   {
        XalanDOMString  theResult;
  @@ -383,7 +383,7 @@
   
        if (theMatchingNodes.size() == 1)
        {
  -             XalanNode* const        theMatchingNode = theMatchingNodes[0];
  +             const XalanNode* const  theMatchingNode = theMatchingNodes[0];
   
                if (theMatchingNode != 0)
                {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to