how to parse squeak object to xml

Bruno Luca lethalman88 at gmail.com
Fri Apr 21 17:55:43 UTC 2006


On Thu, 20 Apr 2006 21:38:14 +0200, Rasa n. <squeaktalk at gmail.com> 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



More information about the Squeak-dev mailing list