[Newbies] xml file query and object mapping

cdrick cdrick65 at gmail.com
Thu Jun 29 20:49:29 UTC 2006

Hi all

I've got xml files that I receive from Meteo France (weather forecast) that
I have to query and map to some objects
I've tried several stuff like parsing the file, selecting only some
elements,  displaying it with a WATree but I'm a bit stuck as none results I
got are good enough.

The structure is like behind:

<?xml version="1.0" encoding="UTF-8" ?>...
 <prev num="1">    // a prev concern a zone for 3 hours - there are 18 prev
for a given zone

 ....   around 450 prev (18 for each ZONE)

  <prevQ num="1">   // this are prevision for the whole day - 4 prevQ in
each file for a given zone

What I need to do is quering the file according to the some attribute (ZONE,
VALIDITE, JJ and HH) so as to get the different value that characterize the
weather forecast. The only thing I can do is selecting nodes accoring to one
parameter, for instance all prevQ element of zone 6504 (using Xpath).

| xml document path results |
   xml := (StandardFileStream readOnlyFileNamed:
'ressources/MF/backup/sympo0805200617h00.xml') contents.
   document := XMLDOMParser parseDocumentFrom: xml readStream.
   path := XPath for: 'prevision/prev'.
   results := path in: document.
   ^ results
       select: [:xmlElem | (xmlElem elementAt: #ZONE) contents first
string = '6504']

I'm a bit lost now. Is it possible to map to objects ?  do I need to work
directly on xml file by xsl transformation ? I don't really understand how
to use a sax parser (I always do a full dom parse that I store in an inst

Do you have advices, pointers or other good practises that can help me ?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20060629/0b095324/attachment.htm

More information about the Beginners mailing list