[libxml++] bad style
- From: Akbar <linux cwazy co uk>
- To: libxmlplusplus-general lists sourceforge net
- Subject: [libxml++] bad style
- Date: Tue, 25 May 2004 22:11:28 +0700
Hey, this is my code:
void Wall::on_button_apply() {
char *server_name = getenv("HOME");
Glib::ustring filepath = server_name;
filepath += "/.wallpapoz/wallpapoz.xml";
xmlpp::Document document;
document.set_internal_subset("wallpaper", "", "");
xmlpp::Element* nodeRoot = document.create_root_node("wallpaper");
Gtk::TreeModel::Children children = m_refTreeModel->children();
for(Gtk::TreeModel::Children::iterator iter=children.begin();
iter!=children.end(); iter++) {
Gtk::TreeModel::Row row= *iter;
Glib::ustring temp2 = row[m_Columns.m_col_wallp];
xmlpp::Element* nodeChild = nodeRoot->add_child("file");
nodeChild->set_child_text(temp2);
}
document.write_to_file(filepath);
}
And my xml file will be like this:
<?xml version="1.0"?>
<!DOCTYPE wallpaper>
<wallpaper><file>/home/knight/wallpaper/eowyn2.jpg
</file><file>/home/knight/wallpaper/eowyn2.jpg
</file><file>/home/knight/wallpaper/eowyn2.jpg
</file><file>/home/knight/wallpaper/eowyn2.jpg
</file><file>/home/knight/wallpaper/eowyn2.jpg
</file></wallpaper>
How can I make it like this:
<?xml version="1.0"?>
<!DOCTYPE wallpaper>
<wallpaper>
<file>/home/knight/wallpaper/eowyn2.jpg</file>
<file>/home/knight/wallpaper/eowyn2.jpg</file>
<file>/home/knight/wallpaper/eowyn2.jpg</file>
<file>/home/knight/wallpaper/eowyn2.jpg</file>
<file>/home/knight/wallpaper/eowyn2.jpg</file>
</wallpaper>
Thank you.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]