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.

61 lines
2.2 KiB

  1. ////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // File: xml.h
  4. //
  5. // History: 16-Nov-00 markder Created.
  6. //
  7. // Desc: This file contains all object definitions used by the
  8. // XML parsing code.
  9. //
  10. ////////////////////////////////////////////////////////////////////////////////////
  11. #ifndef __XML_H__
  12. #define __XML_H__
  13. #include <msxml.h>
  14. BOOL AddAttribute(IXMLDOMNode* pNode, CString csAttribute, CString csValue);
  15. BOOL GetAttribute(LPCTSTR lpszAttribute, IXMLDOMNodePtr pNode, CString* pcsValue, BOOL bXML = FALSE);
  16. BOOL RemoveAttribute(CString csName, IXMLDOMNodePtr pNode);
  17. BOOL GetChild(LPCTSTR lpszTag, IXMLDOMNode* pParentNode, IXMLDOMNode** ppChildNode);
  18. CString GetText(IXMLDOMNode* pNode);
  19. BOOL GetNodeText(IXMLDOMNode* pNode, CString& csNodeText);
  20. CString GetNodeName(IXMLDOMNode* pNode);
  21. CString GetParentNodeName(IXMLDOMNode* pNode);
  22. CString GetXML(IXMLDOMNode* pNode);
  23. CString GetInnerXML(IXMLDOMNode* pNode);
  24. LANGID MapStringToLangID(CString& csLang);
  25. CString GetInnerXML(IXMLDOMNode* pNode);
  26. BOOL OpenXML(CString csFileOrStream, IXMLDOMNode** ppRootNode, BOOL bStream = FALSE, IXMLDOMDocument** ppDoc = NULL);
  27. BOOL SaveXMLFile(CString csFile, IXMLDOMNode* pNode);
  28. BOOL GenerateIDAttribute(IXMLDOMNode* pNode, CString* pcsGuid, GUID* pGuid);
  29. BOOL ReplaceXMLNode(IXMLDOMNode* pNode, IXMLDOMDocument* pDoc, BSTR bsText);
  30. ////////////////////////////////////////////////////////////////////////////////////
  31. //
  32. // XMLNodeList
  33. //
  34. // This class is a wrapper for the IXMLDOMNodeList interface. It simplifies
  35. // C++ access by exposing functions for executing XQL queries and iterating
  36. // through the elements in a node list.
  37. //
  38. class XMLNodeList
  39. {
  40. private:
  41. LONG m_nSize;
  42. IXMLDOMNodeListPtr m_cpList;
  43. CString m_csXQL;
  44. public:
  45. XMLNodeList();
  46. ~XMLNodeList();
  47. void Clear();
  48. LONG GetSize();
  49. BOOL Query(IXMLDOMNode* pNode, LPCTSTR szXQL);
  50. BOOL GetChildNodes(IXMLDOMNode* pNode);
  51. BOOL GetItem(LONG nIndex, IXMLDOMNode** ppNode);
  52. };
  53. #endif