From: Akbar <li...@cw...> - 2004-05-25 15:11:34
|
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. |