how to parse squeak object to xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to parse squeak object to xml

Rasa n.
for example i have

schoolClassName
  • student         
    • name: firstname
    • surname: firstsurname
    • mark: 6...
  • student     
    •    name: firstname1
    •    surname: firstsurname1
    •    mark: 7...
  • student     
    •    name: firstname2
    •    surname: firstsurname2
    •    mark: 5..  

  • etc.
is where some written methods which parse any structure object  to xml file.

could anyone give simple example, how to do it.
or there is no simple example :(

i saw some packages, but have no idea how to get started using them..

or should i write it by myself :)



Reply | Threaded
Open this post in threaded view
|

Re: how to parse squeak object to xml

Luca Bruno aka Lethalman
On Thu, 20 Apr 2006 21:38:14 +0200, Rasa n. <[hidden email]> wrote:

> for example i have
>
> schoolClassName
>
>    - student
>    -
>       - name: firstname
>    - surname: firstsurname
>    - mark: 6...
>    - student
>    -
>       -    name: firstname1
>    -    surname: firstsurname1
>    -    mark: 7...
>
>
>    - student
>    -
>       -    name: firstname2
>    -    surname: firstsurname2
>    -    mark: 5..
>
>
>
>    - etc.
>
> is where some written methods which parse any structure object  to xml  
> file.
>
> could anyone give simple example, how to do it.
> or there is no simple example :(
>
> i saw some packages, but have no idea how to get started using them..
>
> or should i write it by myself :)

You can create #asXMLDOMElement foreach Object, so that calling it will  
recurse trough sub objects... a theroic example:

SchoolClass asXMLDOMElement
        "create your dom element"
        ^ anXMLDOMElement add: (self students collect: [ :ea | ea  
asXMLDOMElement]); yourself

Student asXMLDOM asXMLDOMElement
        "create your dom element here"
        ^ anXMLDOMElement

- Note that i never created an XMLDOMElement so i really don't know what's  
the method to add sub elements -

--
www.lethalman.net - Thoughts about computer technologies