[xml] xmlreader



Hello,

I'm using the xmlreader interface of libxml2 2.6.11.

I've got a DTD with <dat> tag in <head> and <card>. I'm parsing the
document with validation enabled and use a handwritten FSM to know where
to write, like this: if state is head and tag is dat, then go to dat; if
state is dat, then process it (fill my data structures); if state is
card and tag is dat, go to dat. The problem is that I have to know where
to write data while I'm in dat. Dat is relatively deep, so I don't want
to duplicate it like head_dat and card_dat. For now, I'm going to use an
additional structure with previous state (to know where to return to
when I receive </dat>) and pointer to the target data structure (head's
dat or card's dat).

If I have more tags like dat in the future (elements that can occur in
more than one element), I'll have to extend my state structure, and I
don't like this. Does anyone see a better way to do that? I would
appreciate any ideas.

Please inform me if this is too abstract and I should give more details.

With kind regards,
Baurzhan.



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