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.

67 lines
1.5 KiB

  1. #pragma once
  2. //
  3. // Per BryanT, either do not use #import, or checkin what it produces.
  4. //
  5. //#pragma warning(disable:4192) // automatically excluding 'IErrorInfo' while importing type library 'msxml3.dll'
  6. //#import "msxml3.dll"
  7. #include "fusion_msxml3.tlh"
  8. namespace F
  9. {
  10. void ThrowHresult(HRESULT hr);
  11. class CXmlAttributes
  12. //
  13. // This class combines the interface pointers to one object.
  14. //
  15. {
  16. public:
  17. ~CXmlAttributes() { Release(); }
  18. CXmlAttributes()
  19. {
  20. HRESULT hr = 0;
  21. if (FAILED(hr = this->IMXAttributes.CreateInstance(const_cast<PWSTR>(L"Msxml2.SAXAttributes.3.0"))))
  22. ThrowHresult(hr);
  23. this->ISAXAttributes = this->IMXAttributes;
  24. }
  25. void Release()
  26. {
  27. if (this->IMXAttributes != NULL)
  28. {
  29. this->IMXAttributes.Release();
  30. }
  31. if (this->ISAXAttributes != NULL)
  32. {
  33. this->ISAXAttributes.Release();
  34. }
  35. }
  36. operator MSXML2::ISAXAttributes * () { return this->ISAXAttributes; }
  37. HRESULT clear() { return this->IMXAttributes->clear(); }
  38. HRESULT addAttribute(
  39. _bstr_t strURI,
  40. _bstr_t strLocalName,
  41. _bstr_t strQName,
  42. _bstr_t strType,
  43. _bstr_t strValue)
  44. {
  45. return this->IMXAttributes->addAttribute(
  46. strURI,
  47. strLocalName,
  48. strQName,
  49. strType,
  50. strValue);
  51. }
  52. MSXML2::IMXAttributesPtr IMXAttributes;
  53. MSXML2::ISAXAttributesPtr ISAXAttributes;
  54. };
  55. }