30 #ifndef _RL_XML_DOCUMENT_H_
31 #define _RL_XML_DOCUMENT_H_
34 #include <boost/shared_array.hpp>
35 #include <boost/shared_ptr.hpp>
36 #include <libxml/parser.h>
37 #include <libxml/xinclude.h>
60 return reinterpret_cast< const char*
>(this->
doc->encoding);
65 return xmlDocGetRootElement(this->
doc.get());
70 return reinterpret_cast< const char*
>(this->
doc->version);
75 return this->
doc.get();
78 void save(const ::std::string& filename,
const bool& format =
true)
const
80 xmlSaveFormatFile(filename.c_str(), this->
doc.get(), format ? 1 : 0);
83 void save(const ::std::string& filename, const ::std::string& encoding,
const bool& format =
true)
const
85 xmlSaveFormatFileEnc(filename.c_str(), this->
doc.get(), encoding.c_str(), format ? 1 : 0);
90 xmlDocSetRootElement(this->
doc.get(), node());
95 int substitutions = xmlXIncludeProcessFlags(this->
doc.get(), flags);
97 if (-1 == substitutions)
99 throw Exception(xmlGetLastError()->message);
102 return substitutions;
108 ::boost::shared_ptr< xmlDoc >
doc;
113 #endif // _RL_XML_DOCUMENT_H_