[xml] xmlTextReader namespaces and subtrees


I have a xml document with a namespace on the root element. I'm parsing
that and save a subtree of this document for later usage in memory.
Later I create a new xmlTextReader to parse the saved subtree. Which
after modifying I want to merge back into the main document.

When parsing the subtree I get a namespace error, probably because the
subtree does not have a namespace definition on its root element.
How can I solve this issue?

I have some ideas, but they are not complete, so help would really be

- I could add the namespace manually to the root element of the subtree,
but I'm not sure how to remove the redundant namespace definitions later
when I merge the subtree with the main document again.

- Maybe I could tell the xmlTextReader via some API that the namespace
exists. But I couldn't find this API.

- Last but not least, maybe I can tell the reader to ignore namespace
errors, but again, I couldn't find out how.

It would really be nice if someone could help me, as this is the last
big showstopper before I can make a new realease :)


------------------- Error message ------------------
:3: namespace error : Namespace prefix link on internal is not defined
Descfsadfsdfribe your <link:internal>LINK</link:internal>.</note-conten

------------------- Main document ------------------
<?xml version="1.0" encoding="UTF-8"?>
<note version="0.3" xmlns:link="http://beatniksoftware.com/tomboy/link";
 <title>The title</title>
 <text xml:space="preserve"><note-content version="0.1">The title

Some content with a <link:internal>LINK</link:internal>.</note-content>

-------------------- Sub tree ------------------------
<note-content version="0.1">The title

Some content with a <link:internal>LINK</link:internal>.</note-content>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]