Source code of Windows XP (NT5)
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.

74 lines
1.9 KiB

  1. #if !defined(_FUSION_INC_XMLNS_H_INCLUDED_)
  2. #define _FUSION_INC_XMLNS_H_INCLUDED_
  3. #pragma once
  4. #include <ole2.h>
  5. #include <xmlparser.h>
  6. #include "fusionhash.h"
  7. #include "fusionheap.h"
  8. #include "fusionchartraits.h"
  9. #include "smartptr.h"
  10. class CXMLNamespaceManager
  11. {
  12. public:
  13. CXMLNamespaceManager();
  14. ~CXMLNamespaceManager();
  15. BOOL Initialize();
  16. // To get things to track, call these functions in your IXMLNodeFactory before your own processing.
  17. HRESULT OnCreateNode(IXMLNodeSource *pSource, PVOID pNodeParent, USHORT cNumRecs, XML_NODE_INFO **apNodeInfo);
  18. HRESULT OnBeginChildren(IXMLNodeSource *pSource, XML_NODE_INFO *pNodeInfo);
  19. HRESULT OnEndChildren(IXMLNodeSource *pSource, BOOL fEmpty, XML_NODE_INFO *pNodeInfo);
  20. enum MapFlags
  21. {
  22. eMapFlag_DoNotApplyDefaultNamespace = 0x00000001,
  23. };
  24. HRESULT Map(
  25. DWORD dwMapFlags,
  26. const XML_NODE_INFO *pNodeInfo,
  27. CBaseStringBuffer *pbuffNamespace,
  28. SIZE_T *pcchNamespacePrefix
  29. );
  30. class CNamespacePrefix
  31. {
  32. public:
  33. CNamespacePrefix();
  34. ~CNamespacePrefix();
  35. CNamespacePrefix *m_Previous;
  36. CSmallStringBuffer m_NamespaceURI;
  37. ULONG m_Depth;
  38. SMARTTYPEDEF(CNamespacePrefix);
  39. private:
  40. CNamespacePrefix(const CNamespacePrefix &);
  41. void operator =(const CNamespacePrefix &);
  42. };
  43. protected:
  44. BOOL InsertOrUpdateIfCallback(
  45. CNamespacePrefix *pPrefixNew,
  46. CNamespacePrefix * const &rpPrefixCurrent,
  47. InsertOrUpdateIfDisposition &Disposition
  48. );
  49. CStringPtrTable<CNamespacePrefix, CUnicodeCharTraits> m_NamespacePrefixes;
  50. ULONG m_CurrentDepth;
  51. CNamespacePrefix *m_DefaultNamespacePrefix;
  52. private:
  53. CXMLNamespaceManager(const CXMLNamespaceManager &r);
  54. void operator =(const CXMLNamespaceManager &r);
  55. };
  56. SMARTTYPE(CXMLNamespaceManager::CNamespacePrefix);
  57. #endif // !defined(_FUSION_INC_XMLNS_H_INCLUDED_)