1 /* 2 * OpenBOR - http://www.LavaLit.com 3 * ----------------------------------------------------------------------- 4 * Licensed under the BSD license, see LICENSE in OpenBOR root for details. 5 * 6 * Copyright (c) 2004 - 2011 OpenBOR Team 7 */ 8 9 // XmlDocument.h: interface for the CXmlDocument class. 10 // 11 ////////////////////////////////////////////////////////////////////// 12 13 #if !defined(AFX_XMLDOCUMENT_H__D68461F7_E0CE_4FA0_B1C9_0541610164E9__INCLUDED_) 14 #define AFX_XMLDOCUMENT_H__D68461F7_E0CE_4FA0_B1C9_0541610164E9__INCLUDED_ 15 16 #if _MSC_VER > 1000 17 #pragma once 18 #endif // _MSC_VER > 1000 19 20 #define XML_ROOT_NODE 0 21 #define XML_MAX_TAGNAME_SIZE 32 22 #define XML_MAX_INNERTEXT_SIZE 1024 23 24 typedef int XmlNode; 25 typedef void (*XmlNodeCallback) (char* szTag, XmlNode node); 26 27 28 29 class CXmlDocument 30 { 31 public: 32 CXmlDocument(); 33 virtual ~CXmlDocument(); 34 35 void Create(char* szString); 36 int Load(char* szFile); 37 void Close(); 38 39 int GetNodeCount(char* tag); 40 41 void EnumerateNodes(char* szTag, XmlNodeCallback pFunc); 42 43 XmlNode GetChildNode(XmlNode node, char* szTag); 44 XmlNode GetNextNode(XmlNode node); 45 char* GetNodeText(XmlNode node); 46 char* GetNodeTag(XmlNode node); 47 48 private: 49 50 char* m_doc; 51 int m_size; 52 int m_nodes; 53 char m_szTag[XML_MAX_TAGNAME_SIZE]; 54 char m_szText[XML_MAX_INNERTEXT_SIZE]; 55 }; 56 57 #endif // !defined(AFX_XMLDOCUMENT_H__D68461F7_E0CE_4FA0_B1C9_0541610164E9__INCLUDED_) 58