00001 // ################################################################## 00002 // Binx 00003 // $Id: BxDomNodeList_8h-source.html,v 1.1.1.1 2006/04/19 14:19:02 edikt2 Exp $ 00004 // 00005 // BxDomNodeList keeps an ordered list of nodes of the same name. 00006 // ################################################################## 00007 /* 00008 00009 // edikt::BinX 00010 // www.edikt.org 00011 // support@edikt.org 00012 00013 // Copyright (c) 2003 The University of Edinburgh. 00014 00015 */ 00016 00017 #ifndef __BxDomNodeList__ 00018 #define __BxDomNodeList__ 00019 00020 #include "BxObject.h" 00021 #include "BxDomAttributeList.h" 00022 #include <xercesc/dom/DOMNode.hpp> 00023 #include <xercesc/dom/DOMNodeList.hpp> 00024 00025 XERCES_CPP_NAMESPACE_USE 00026 00027 /* 00028 * Class holding a list of BinX XML elements from a DOM parser. 00029 * This class is primarily used by the class BxBinxParser to build 00030 * memory-resident object structures containing the BinX document XML elements 00031 * and attributes. 00032 * An instance of BxDom NodeList holds a list of DOM nodes provided by 00033 * a third party DOM parse (in this implementation the Xerces DOM parser is used). 00034 * XML element names, lists of XML attribute name-value pairs 00035 * as well as nested (child) XML element list can be obtained methods 00036 * implemented by this class. 00037 * <BR><B>Since:</B> BinX version 1.0. 00038 */ 00039 class DECLSPEC BxDomNodeList : public BxObject 00040 { 00041 DOMNodeList * nodeList_; //< the DOMNodeList pointer 00042 DOMNode * currentNode_; //< the referenced node pointer 00043 int numberOfNodes_; //< count of the number of nodes in the list 00044 int currentNo_; //< index to the "current" node in this list 00045 00046 public: 00047 BxDomNodeList(); 00048 BxDomNodeList(DOMNodeList *); // specify node list 00049 BxDomNodeList(BxDomNodeList *); 00050 virtual ~BxDomNodeList(); 00051 00052 bool hasAttributes() const; // whether the current referenced node has any attributes 00053 BxDomAttributeList * getAttributes() const; // get the attribute list for this node if any 00054 char * getAttributeValue(const char * attributeName) const; // get attribute value of currentNode_ 00055 char * getNodeName(); // get node name of currentNode_ 00056 char * getNodeValue(); // get node value for text() node 00057 bool isElementNode(); // whether the currentNode_ is an element node. 00058 BxDomNodeList * getChildren() const; // get children of currentNode_ 00059 00060 void reset(); // clear currentNode and start from the first 00061 bool next(); // pointer to next(first if not visited) and return true/false 00062 }; 00063 00064 #endif
1.3.3