Filtering XML with SAX

Mael Guillemot <[email protected]>
Newsgroups gmane.text.xml.sax.general
Organization I.D.I.A.P.
Message-ID <[email protected]>
Hello,

I use Xerces-C++ on Linux (Redhat 7.2). I compiled and built the samples
(SAXCount, SAXPrint, PParse) and everything is OK. I guess most of you
use Java but the idea of my question should be independant of the
platform.

I want to filter (to extract elements information from)  my XML files
(eg. representing key-frames of videos like this):

<video>
    <shot>
        <keyframe-timestamp>000020.000</keyframe-timestamp>
    </shot>
    <shot>
        <keyframe-timestamp>000030.000</keyframe-timestamp>
    </shot>
...

and I want to extract the values of the elements of
<keyframe-timestamp>.

I could use easily XSLT to transform into HTML but I want these values
for printing them later on a HTML file like this. { My question is not
related to how to produce the HTML file but how to extract information
from XML file }.


<html>
    shot 1:
    <img
src='http://www.website.com/cgi-bin/getframecgi?filename=video.avi&timestamp=000020.000'
width='100' height='70' > <br>
    shot 2:
    <img
src='http://www.website.com/cgi-bin/getframecgi?filename=video.avi&timestamp=000030.000'
width='100' height='70' > <br>
...


I think I can use SAX API for that but I can't find any functions to
extract information. How do I extract elements using a handler class
like in SAXPrint
(I understand only startelement and endelement functions)? Do you advise
me to use DOM with getNode functions instead, do you have any sample
code to guide me?

Thanks a lot for any help,

Maël





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
List: [email protected]
See:  http://www.saxproject.org
https://lists.sourceforge.net/lists/listinfo/sax-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.