[libxml++] libxml++ problem
- From: tim <tim sterlingmicros com au>
- To: libxmlplusplus-general lists sourceforge net
- Subject: [libxml++] libxml++ problem
- Date: Wed, 3 Sep 2003 10:13:58 +0930
Hi Guys
I am writting a c++ app and need xml support so i thought i would give
libxml++ a try. Anyways i can not get anything to compile, i am using Debian
3.0r1 I am using kdevelop 2.1. I tried a few of the examples that comes with
libxml++ but none of them compile for eg (import node example)
#include <iostream>
#include <stdexcept>
#include <string>
#include <cstdlib>
#include <libxml++/libxml++.h>
using namespace xmlpp;
using namespace std;
int main (int argc, char *argv[]){
try {
DomParser example1("example1.xml");
DomParser example2("example2.xml");
Document *doc1 = example1.get_document();
Document *doc2 = example2.get_document();
Element *root1 = doc1->get_root_node();
Element *root2 = doc2->get_root_node();
// find the first "child" element in example2
Node::NodeList child_list = root2->get_children("child");
Node *node_to_add = child_list.front();
// import the node under the root element (recursive is default)
root1->import_node(node_to_add);
// print out the new doc1
string doc1_string = doc1->write_to_string_formatted();
cout << doc1_string;
return EXIT_SUCCESS;
}
catch (std::exception &e){
cerr << "Caught exception " << e.what() << endl;
return EXIT_FAILURE;
}
}
i get the following errors:
make all-recursive
make[1]: Entering directory `/root/test'
Making all in test
make[2]: Entering directory `/root/test/test'
c++ -DHAVE_CONFIG_H -I. -I. -I.. -O2 -O0 -g3 -Wall -fno-exceptions
-fno-check-new -c main.cpp
main.cpp: In function `int main(int, char **)':
main.cpp:32: exception handling disabled, use -fexceptions to enable
main.cpp:47: no matching function for call to `xmlpp::Element::import_node
(xmlpp::Node *&)'
main.cpp:50: no matching function for call to
`xmlpp::Document::write_to_string_formatted ()'
make[2]: *** [main.o] Error 1
make[2]: Leaving directory `/root/test/test'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/test'
make: *** [all-recursive-am] Error 2
*** failed ***
i am pretty sure it's all installed properly because if i try and compile
with just #include <libxml++/libxml++.h> and nothing in the int main() it
doesn't complain that it can't find libxml++.h. I have also tried the
examples on Mandrake 9.1 and get i get the same errors. I have tried the
other examples and they all fail too. What on earth am i doing wrong??
Tim
P.S
Let me know if i haven't given enough information or didn't explain myself to
well ;-)
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]