|
|
Comments and Discussions
|
|
 |

|
Hi!
This library would be a great if it worked!
I tried to compile a small application, taking into account the above comments, but it does not work. It compiles but does not work.
#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
#include <ostream>
#include <pugxml.h>
using namespace std;
using namespace pug;
int _tmain(int argc, _TCHAR* argv[])
{
xml_parser* xml = new xml_parser;
xml_node root = xml->document();
xml_node node = root.append_child(pug::node_element);
node.name(_T("node"));
node.value(_T("my name is root"));
wcout<<node.value()<<endl;
xml_node d = root.first_element_by_name(_T("node"));
wcout<<d.value(); system("pause");
return 0;
}
Share your "Hello,World!" application please.
The demo don't work.
|
|
|
|

|
For some reason or another, root != document. Instead, attach a root to the document, then all the children to root. pug::xml_node_struct *doc = pug::new_node(pug::node_document); doc->parent = doc; pug::xml_node docNode(doc); pug::xml_node root = docNode.append_child(pug::node_element); root.name("TestData"); root.append_attribute("version", "1"); std::ostringstream str_xml_out; str_xml_out << docNode; std::string str_xml_out_str = str_xml_out.str(); returns: <TestData version="1"/> Maybe there's even a smaller version of the above.
-- Modified Friday, September 10, 2010 9:36 AM
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
Discussion of techniques for fast, robust, light-weight XML parsing.
| Type | Article |
| Licence | |
| First Posted | 11 Jan 2003 |
| Views | 693,590 |
| Bookmarked | 277 times |
|
|