Re: [xml] Getting element content non-recursively
- From: "Caroline Middlebrook" <caroline middlebrook aston tv>
- To: "'Rush Manbert'" <rush manbert com>
- Cc: xml gnome org
- Subject: Re: [xml] Getting element content non-recursively
- Date: Wed, 20 Sep 2006 08:41:58 +0100
Well, that's too bad. I have to admit that I don't quite see what you're
doing, but I will offer one idea to think about.
Basically, I have some XML, which I want to insert into another piece of
XML. That's it! I just can't seem to find a way to do that correctly!
I am implementing an XML-based messaging protocol. All of the messages have
a strict format defined by a DTD and that is fine. However, a handful of the
messages have an element that is just a placeholder for any extra data
needed - that element may hold any amount of valid XML.
I need to pull those messages apart, and I need to put them back together
again. Pulling them apart is easy but when I put them back together I
struggle with this additional element because I can't seem to find a way to
copy this fragment of XML into the message I am currently building.
Would it help you to first iterate over all the elements in document order
and save pointers to them in a vector, then go through the vector in
reverse order to do your replacements? That would mean that you replace
contents of the most highly nested elements first. I have an application
that needs to replace attributes on certain elements, and that is the way I
do it.
I'm not sure. I don't think so because that recursion problem will still hit
me as I get to the top-most elements. All I need to do is get the text
context of a single element, without getting the content of all its children
too.
Caroline
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]