So what you are saying is "there is no way to get the xml document serialized with namespaces if it is not namespace-well-formed " ? Thanks Mini --- On Thu, 9/3/09, Michael Ludwig <[email protected]> wrote:
From: Michael Ludwig <[email protected]> Subject: Re: [xml] ignore undefined namespaces during parsing To: [email protected] Date: Thursday, September 3, 2009, 8:23 PM mini thomas schrieb: > std::string s2 = "<root><nmspace:test1 hh=\"yyy\"></root>" > xmlDocPtr myDoc = xmlParseDoc((const unsigned char*)s2.c_str()); This is not namespace-well-formed. Not even well-formed. > I get the error "namespace error .. namespace prefix nmspace on test1 > is not declared" > > Is it possible to suppress this error ? If it was possible and you used that, you could also consider using Perl and regular expressions to do the parsing. I mean it would be counter to the specification. > When I call xmlNodeDump(root_node) I get the following result > <root><test1 hh="yyy"></root>. Why is the namespace removed ? Is > there any when to serialize the DOM to a string with the namespace ? You don't have a namespace there. If you want a namespace, make your document namespace-well-formed: <root xmlns:nmspace="urn:this-is-my-namespace-uri"> <nmspace:test1 hh="yyy"/> </root> I suggest you ask Google how XML namespaces work. It is not too complicated. Much, much less complicated then C pointers. -- Michael Ludwig _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
_______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
