00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 #ifndef BAKERY_DOCUMENT_XML_H
00020 #define BAKERY_DOCUMENT_XML_H
00021 
00022 #include "bakery/Document/Document.h"
00023 #include <libxml++/libxml++.h>
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 namespace Bakery
00032 {
00033 
00034 class Document_XML : public Bakery::Document
00035 {
00036 public: 
00037   Document_XML();
00038   virtual ~Document_XML();
00039 
00040   
00041   virtual bool load_after();
00042   virtual bool save_before();
00043 
00044   virtual void set_dtd_name(const std::string& strVal); 
00045   virtual std::string get_dtd_name() const;
00046 
00047   virtual void set_dtd_root_node_name(const Glib::ustring& strVal);
00048   virtual Glib::ustring get_dtd_root_node_name() const;
00049 
00053   virtual void set_write_formatted(bool formatted = true);
00054   
00055   virtual bool set_xml(const Glib::ustring& strXML); 
00056   virtual Glib::ustring get_xml(); 
00057 
00058 protected:
00059   static Glib::ustring get_node_attribute_value(const xmlpp::Element* node, const Glib::ustring& strAttributeName);
00060   static void set_node_attribute_value(xmlpp::Element* node, const Glib::ustring& strAttributeName, const Glib::ustring& strValue);
00061   virtual xmlpp::Element* get_node_child_named(const xmlpp::Element* node, const Glib::ustring& strName) const;
00062   virtual xmlpp::Element* get_node_child_named_with_add(xmlpp::Element* node, const Glib::ustring& strName);
00063 
00064   virtual const xmlpp::Element* get_node_document() const; 
00065   virtual xmlpp::Element* get_node_document(); 
00066 
00067 
00068   virtual void Util_DOM_Write(Glib::ustring& refstrXML);
00069 
00070   typedef Bakery::Document type_base;
00071 
00072   
00073   xmlpp::DomParser m_DOM_Parser; 
00074   xmlpp::Document* m_pDOM_Document; 
00075   
00076   std::string m_strDTD_Name;
00077   Glib::ustring m_strRootNodeName;
00078   bool m_write_formatted;
00079 };
00080 
00081 } 
00082 
00083 #endif // BAKERY_DOCUMENT_XML_H