Re: [xml] parsing using SAX



Hi Daniel. For some reasons, it would be more convinient to me, for the
plot's SAXHandler to take absolute control of the parsing, without having
to go through the upper node's startElement callback for each new element.
I'm wondering if that's possible.

The reason is that each plugin (plot type) has a filter (another plugin)
for each file format. The SAXHandler is internal to the filter (a
private instance), as well as the methods, and not visible from the
outside. What I want to do is to call the plot's filter to read xml files,
with a function like 

read(Plugin *p, FILE *file, GtkObject *o, gpointer data); 

where in data I would pass the info necessary for parsing the node, a
pointer to the node. This model could parse a file by itself, containing a
single plot, or a plot node, included in a project file (or a gnumeric
file, for instance)

I wonder if that's possible. I have the impression that with the DOM
interface this should be straightforward.

Thanks!
Saludos,
<ADRIAN>

On Fri, 10 Jan 2003, Daniel Veillard wrote:

On Thu, Jan 09, 2003 at 09:49:53PM -0500, Adrian Feiguin wrote:
The idea is that each plot type is a plugin, with its own SAXHandler to
parse xml files. So I need the SAXHandler for the project to call the
SAXHandlers of the plugins at each <plot> node to parse each chunk between
<plot> and </plot>, and then come back to parse the rest of the tree. 

To be more specific, in the startElement callback for the project, I find
that my plot is of type "2d". Then I need to call the function to parse
that chunk, the 2d plot with it's own sub-tree, using its own SAXHandler,
and  its own startElement callback, and then come back to parse the rest.

I hope I've been clear, I'd appreciate any help. Thanks a lot!

  What's the problem ? Simply implement the given check in your main
startElement callback and call the appropriate sub-callback when needed
with the exact same input parameters until the matching endElement callback.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/





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