MSXML_DOMDocument.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* -*- C++ -*- */
  2. /****************************************************************************
  3. ** Copyright (c) 2001-2014
  4. **
  5. ** This file is part of the QuickFIX FIX Engine
  6. **
  7. ** This file may be distributed under the terms of the quickfixengine.org
  8. ** license as defined by quickfixengine.org and appearing in the file
  9. ** LICENSE included in the packaging of this file.
  10. **
  11. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  12. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  13. **
  14. ** See http://www.quickfixengine.org/LICENSE for licensing information.
  15. **
  16. ** Contact ask@quickfixengine.org if any conditions of this licensing are
  17. ** not clear to you.
  18. **
  19. ****************************************************************************/
  20. #ifndef FIX_MSXMLDOMDOCUMENT_H
  21. #define FIX_MSXMLDOMDOCUMENT_H
  22. #ifdef _MSC_VER
  23. #pragma warning( disable : 4503 4355 4786 4290 )
  24. #endif
  25. #include "DOMDocument.h"
  26. #include "Exceptions.h"
  27. namespace FIX
  28. {
  29. /// XML attribute as represented by msxml.
  30. class MSXML_DOMAttributes : public DOMAttributes
  31. {
  32. public:
  33. MSXML_DOMAttributes( MSXML2::IXMLDOMNode* pNode )
  34. {
  35. pNode->get_attributes(&m_pNodeMap);
  36. }
  37. ~MSXML_DOMAttributes();
  38. bool get( const std::string&, std::string& );
  39. DOMAttributes::map toMap();
  40. private:
  41. MSXML2::IXMLDOMNamedNodeMap* m_pNodeMap;
  42. };
  43. /// XML node as represented by msxml.
  44. class MSXML_DOMNode : public DOMNode
  45. {
  46. public:
  47. MSXML_DOMNode( MSXML2::IXMLDOMNode* pNode )
  48. : m_pNode( pNode ) {}
  49. ~MSXML_DOMNode();
  50. DOMNodePtr getFirstChildNode();
  51. DOMNodePtr getNextSiblingNode();
  52. DOMAttributesPtr getAttributes();
  53. std::string getName();
  54. std::string getText();
  55. private:
  56. MSXML2::IXMLDOMNode* m_pNode;
  57. };
  58. /// XML document as represented by msxml.
  59. class MSXML_DOMDocument : public DOMDocument
  60. {
  61. public:
  62. MSXML_DOMDocument() throw( ConfigError );
  63. ~MSXML_DOMDocument();
  64. bool load( std::istream& );
  65. bool load( const std::string& );
  66. bool xml( std::ostream& );
  67. DOMNodePtr getNode( const std::string& );
  68. private:
  69. MSXML2::IXMLDOMDocument2* m_pDoc;
  70. };
  71. }
  72. #endif