bakery
2.6
Main Page
Namespaces
Classes
Files
File List
File Members
bakery
Document
Document_XML.h
Go to the documentation of this file.
1
/*
2
* Copyright 2000-2002 Murray Cumming
3
*
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Library General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
8
*
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Library General Public License for more details.
13
*
14
* You should have received a copy of the GNU Library General Public
15
* License along with this library; if not, write to the Free
16
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
*/
18
19
#ifndef BAKERY_DOCUMENT_XML_H
20
#define BAKERY_DOCUMENT_XML_H
21
22
#include "
bakery/Document/Document.h
"
23
#include <libxml++/libxml++.h>
24
25
//Features:
26
//- Read/Write to the Document in terms of XML DOM.
27
28
//Future features:
29
//- Parse the document from disk instad of memory - This *might* allow for very large documents.
30
31
namespace
Bakery
32
{
33
34
class
Document_XML
:
public
Bakery::Document
35
{
36
public
:
37
Document_XML
();
38
virtual
~Document_XML
();
39
40
//overrides:
41
virtual
bool
load_after
();
42
virtual
bool
save_before
();
43
44
virtual
void
set_dtd_name
(
const
std::string& strVal);
//e.g. "glom.dtd"
45
virtual
std::string
get_dtd_name
()
const
;
46
47
virtual
void
set_dtd_root_node_name
(
const
Glib::ustring& strVal);
48
virtual
Glib::ustring
get_dtd_root_node_name
()
const
;
49
54
void
set_write_formatted
(
bool
formatted =
true
);
55
61
void
add_indenting_white_space
();
62
63
virtual
bool
set_xml
(
const
Glib::ustring& strXML);
//Parse the XML from the text.
64
virtual
Glib::ustring
get_xml
()
const
;
//Get the text for the XML.
65
66
protected
:
67
static
Glib::ustring
get_node_attribute_value
(
const
xmlpp::Element* node,
const
Glib::ustring& strAttributeName);
68
static
void
set_node_attribute_value
(xmlpp::Element* node,
const
Glib::ustring& strAttributeName,
const
Glib::ustring& strValue);
69
70
static
xmlpp::Element*
get_node_child_named
(
const
xmlpp::Element* node,
const
Glib::ustring& strName);
71
static
xmlpp::Element*
get_node_child_named_with_add
(xmlpp::Element* node,
const
Glib::ustring& strName);
72
73
virtual
const
xmlpp::Element*
get_node_document
()
const
;
//e.g. <glom_document> (root name)
74
virtual
xmlpp::Element*
get_node_document
();
//e.g. <glom_document> (root name)
75
76
virtual
void
Util_DOM_Write
(Glib::ustring& refstrXML)
const
;
77
78
void
add_indenting_white_space_to_node
(xmlpp::Node* node = 0,
const
Glib::ustring& start_indent = Glib::ustring());
79
80
typedef
Bakery::Document
type_base
;
81
82
//XML Parsing bits:
83
xmlpp::DomParser
m_DOM_Parser
;
//Could be mutable to allow us to guarantee a root node.
84
xmlpp::Document*
m_pDOM_Document
;
//1-to-1 with the m_DOM_Parser.
85
86
std::string
m_strDTD_Name
;
87
Glib::ustring
m_strRootNodeName
;
88
bool
m_write_formatted
;
89
};
90
91
}
//namespace Bakery.
92
93
#endif // BAKERY_DOCUMENT_XML_H
Generated by
1.8.1.2