Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Reading a XML file
Last updated at 11:25 am UTC on 26 February 2020
Read an XML file and construct a DOM
 f := FileStream fileNamed: 'MyXml.xml'. "opening a stream"
 doc := XMLDOMParser parseDocumentFrom: f.
 f close.


Access the DOM
 xmlUser := (doc elements) at: 1. "now you have the entire user data"
 
 "read the name"
 elmt := xmlUser firstTagNamed: #name.
 userName := elmt contentString.