Squeak and XML

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

Squeak and XML

mike.vidal
Does anyone have a link to current information about how to work with
XML with Squeak?
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Squeak and XML

keith1y
[hidden email] wrote:
> Does anyone have a link to current information about how to work with
> XML with Squeak?
> _
The package is apparently in

www.squeaksource.com/XMLSupport

other than that I have not used it.

Keith

       
       
               
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
http://uk.docs.yahoo.com/nowyoucan.html
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Squeak and XML

tblanchard
In reply to this post by mike.vidal
The usual parser is Yaxo.  Its pretty basic and easy to work with.
Are you parsing or generating?

On Oct 4, 2006, at 6:27 PM, [hidden email] wrote:

> Does anyone have a link to current information about how to work with
> XML with Squeak?
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Squeak and XML

Bert Freudenberg
Yaxo is a SAX-like parser. So you can write your one SAX handler  
(more efficient) or use the provided DOM handler (simple). For the  
latter, an example is provided on the class side of XMLDOMParser.

- Bert -

Am 05.10.2006 um 08:30 schrieb Todd Blanchard:

> The usual parser is Yaxo.  Its pretty basic and easy to work with.
> Are you parsing or generating?
>
> On Oct 4, 2006, at 6:27 PM, [hidden email] wrote:
>
>> Does anyone have a link to current information about how to work with
>> XML with Squeak?



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Squeak and XML

Kenneth Payne
In reply to this post by mike.vidal
On Thursday 05 October 2006 02:27, [hidden email] wrote:
> Does anyone have a link to current information about how to work with
> XML with Squeak?
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

Try the Squeak Swiki - search for YAXO.

The YAXO and XML article includes these useful examples of using the DOM
parser.

========================================
Writing to a file called MyXml.xml

"Code below describes opening a stream and writer and associating the writer
with XMLDocument"

doc := XMLDocument new.
stream := FileStream fileNamed: 'MyXml.xml'. "speicifying the stream"
writer := XMLWriter on:stream. "specifying the writer"
writer initialize.

"Code below describes how you could write an xml element with a tag "
elmt := XMLElement named: 'User' attributes: Dictionary new.

"adding the attribute tags and values to the "
childElmt := XMLElement named: 'Name' attributes: Dictionary new.
childElmt addContent: (XMLStringNode string: ('rao')). "adding a tag called
Name with the value 'rao'"
elmt addElement: childElmt.

doc addElement: elmt.
doc printXMLOn: writer.
stream close.

Reading from MyXml.xml
f := FileStream fileNamed: 'xml.xml'. "opening a stream"
doc := XMLDOMParser parseDocumentFrom: f.
f close.
xmlUser := (doc elements) at: 1. "now you have the entire user data"

"readng the name"
elmt := xmlUser firstTagNamed: #Name.
userName := elmt contentString.

Notice how once you call the parseDocumentFrom: you don't need to have the
stream open because XMLDOMParser builds tree right away from the given
stream.
=====================================

Hope this helps.

- Ken
 

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners