[Pharo-project] Pattern for reifying XML doc?

Guillermo Polito guillermopolito at gmail.com
Tue Feb 22 15:41:45 CET 2011


>From the Java world, I know Digester
http://commons.apache.org/digester/xmlrules.html, letting you map an xml to
objects with a set of rules...
I don't know if that's what you were expecting as an answer :).

BTW, great example! :P

Guille

On Tue, Feb 22, 2011 at 11:39 AM, Schwab,Wilhelm K <bschwab at anest.ufl.edu>wrote:

> Stef,
>
> So far, I about all I have done with the xml parser is note that it can
> parse the data from my Garmin Forerunner.   Otherwise, I have used SIXX with
> good results, at least as far as I have pushed it.  Its code might give you
> some ideas that would apply to outside xml (maybe), or if you can control
> the schema, you might simply leave it to SIXX??
>
> Bill
>
>
>
> ________________________________________
> From: pharo-project-bounces at lists.gforge.inria.fr [
> pharo-project-bounces at lists.gforge.inria.fr] On Behalf Of stephane ducasse
> [stephane.ducasse at free.fr]
> Sent: Monday, February 21, 2011 4:11 AM
> To: pharo Development
> Subject: [Pharo-project] Pattern for reifying XML doc?
>
> Hi guys
>
> I often encounter the following situation: I have an xmldoc and I want to
> load it and get the corresponding objects.
> Here is an example
>
> <group>
>    <groupName>Test2Cards</groupName>
>    <cards><card>
>    <cardName>All Is Dust</cardName>
>    <manaCost>7</manaCost>
>    <convertedManaCost>7</convertedManaCost>
>    <type>Tribal Sorcery — Eldrazi</type>
>    <cardText>Each player sacrifices all colored permanents he or she
> controls.</cardText>
>    <rarity>mythic</rarity>
>    <cardNumber>1</cardNumber>
>    <artist>Jason Felix</artist>
>    <kind>STD</kind>
>    <expansionId>ELDRAZI</expansionId>
> </card>
> <card>
>    <cardName>Kird Ape</cardName>
>    <manaCost>G</manaCost>
>    <convertedManaCost>1</convertedManaCost>
>    <type>Tribal Sorcery — Eldrazi</type>
>    <cardText>get +1/+1 when you control</cardText>
>    <rarity>common</rarity>
>    <cardNumber>33</cardNumber>
>    <artist>Zork</artist>
>    <kind>STD</kind>
>    <expansionId>WORLDWAKE</expansionId>
> </card></cards>
> </group>
>
> I have card and group. But I could have several kind of nodes. So I was
> wondering if there are patterns to read in
> and map that to objects. In the future I would like to have magritte like
> type of first class instance variables that
> perform i/o in xml or other formats because this is always the same.
>
> stef
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20110222/019111f9/attachment.htm>


More information about the Pharo-project mailing list