1 //============================================================
5 * @brief Some helper functions for XML
7 * @author Bala Natarajan <bala@dre.vanderbilt.edu>
8 * @author William R. Otte <wotte@dre.vanderbilt.edu>
10 //============================================================
11 #ifndef ACE_XML_HELPER_H
12 #define ACE_XML_HELPER_H
13 #include /**/ "ace/pre.h"
15 #if !defined (ACE_LACKS_PRAGMA_ONCE)
17 #endif /* ACE_LACKS_PRAGMA_ONCE */
19 #include "XML_Error_Handler.h"
20 #include "XML_Schema_Resolver.h"
22 #include "xercesc/util/XercesDefs.hpp"
23 #include "xercesc/parsers/XercesDOMParser.hpp"
27 namespace XERCES_CPP_NAMESPACE
31 class DOMImplementation
;
32 class DOMDocumentType
;
40 * @brief Helper class for some routine XML stuff.
42 template <typename Resolver
= XML_Schema_Resolver
<>,
43 typename Error_Handler
= XML_Error_Handler
>
47 XML_Helper (Resolver
*resolver
= nullptr, Error_Handler
*eh
= nullptr);
52 XERCES_CPP_NAMESPACE::DOMDocument
*
53 create_dom (const ACE_TCHAR
*uri
) const;
55 XERCES_CPP_NAMESPACE::DOMDocument
*
56 create_dom (const ACE_TCHAR
*root
,
58 XERCES_CPP_NAMESPACE::DOMDocumentType
* doctype
= 0) const;
60 XERCES_CPP_NAMESPACE::DOMDocumentType
*
61 create_doctype (const ACE_TCHAR
*qn
,
63 const ACE_TCHAR
*sid
) const;
65 /// Writes out a DOMDocument to an XML file
66 bool write_DOM (XERCES_CPP_NAMESPACE::DOMDocument
*doc
,
67 const ACE_TCHAR
*file
) const;
69 bool is_initialized () const;
71 /// Terminate the parser
72 void terminate_parser ();
74 Resolver
&get_resolver ();
76 Error_Handler
&get_error_handler ();
79 /// Initialize the parser
83 bool initialized_
{ false };
84 XERCES_CPP_NAMESPACE::DOMImplementation
*impl_
{};
85 mutable std::unique_ptr
<XERCES_CPP_NAMESPACE::XercesDOMParser
> parser_
;
88 bool release_resolver_
{ false };
89 Error_Handler
*e_handler_
;
90 bool release_e_handler_
{ false };
94 #include "XML_Helper.tpp"
96 #include /**/ "ace/post.h"
97 #endif/*ACE_XML_HELPER_H*/