Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.3 KiB

  1. #ifndef _XMLTREE_H_
  2. #define _XMLTREE_H_
  3. struct IXMLDOMNode;
  4. struct XMLAttribute {
  5. char *pszName;
  6. char *pszValue;
  7. XMLAttribute *pNext;
  8. XMLAttribute() : pszName(NULL),
  9. pszValue(NULL),
  10. pNext(NULL) {}
  11. };
  12. extern const char *EmptyString;
  13. class TreeNode {
  14. public:
  15. TreeNode();
  16. const char *attribute(const char *pszAttrName);
  17. inline const char *text() { return pszContents; }
  18. inline const char *tagname() { return (nodetype==NODE_ELEMENT) ?
  19. pszContents :
  20. EmptyString; }
  21. inline TreeNode *sibling() { return pSibling; }
  22. inline TreeNode *child() { return pDescendant; }
  23. ~TreeNode();
  24. /* find first node with given element name */
  25. TreeNode *find(const char *pszElemName, unsigned int maxDepth=INFINITE);
  26. protected:
  27. void defineAttribute(const char *pszName, const char *pszValue);
  28. void setContent(const char *pszData);
  29. private:
  30. TreeNode *pDescendant, *pSibling, *pParent;
  31. char *pszContents;
  32. int nodetype;
  33. XMLAttribute *pAttribute;
  34. friend class XMLTree;
  35. friend TreeNode *createXMLtree(IXMLDOMNode *pXMLnode, TreeNode *pParent);
  36. friend int defineAttributes(TreeNode *pCurrent, IXMLDOMNode *pXMLnode);
  37. };
  38. #endif