Re: [libxml++] Putting values in a decent data structure



On Wed, Jun 02, 2004 at 10:25:04AM +0200, Daniel Holbach wrote:

> Hello Christophe, hello list :-)
> 
> first of all, thanks for your answer.
> 
> Am Di, den 01.06.2004 um 15:44 Uhr +0200 schrieb Christophe de VIENNE:
> > What makes you think it's inappropriate ? As long as your structures and 
> > your xml tree are organised in a similar way, I'd say that using xpath 
> > expressions is a bit overkill.
> Maybe you're right, but i didn't know exactly, how to access all the
> subsequent entries of the <datasource>-tags, I only found the
> find()-method.
> 
> I now organized the data structures in another way, but my problem is
> still the same: it's not easy at all to know when to append a list to
> the aequivalent structure of the father node.

Surely if you see <ccc> after a series of <eee> elements you know that
the <ddd> parent of the <eee>s has been closed and you should append the
list of <eee>s to the parent node, and start parsing the new <ccc>.

If I understand you correctly it's simply a matter of keeping some state
so you know what the previous element was. A simple std::string to hold
the name of the last element seen should be enough.
If the current node is one that appears nearer the root of the document
than the previous node then you know that the previous node and its
parent have been closed.

jon


-- 
"It is always the best policy to tell the truth, unless, of course, you 
 are an exceptionally good liar."
	- Jerome K. Jerome




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