How to make XMLDocument from a string?

Zulq Alam zulq at orange.net
Fri Apr 28 03:51:46 UTC 2006


Bob,

I haven't use the XML libraries but I believe you could obtain the 
ReadStream from the String by sending #readStream which is understood by 
all SequenceableCollection subclasses.

    XMLDOMParser parseDocumentFrom: '<root><child>wah</child></root>' 
readStream

You can also construct the ReadStream yourself from the String.

    XMLDOMParser parseDocumentFrom: (ReadStream on: 
'<root><child>wah</child></root>')

In my image XMLDocument doesn't understand #parseDocumentFrom do I've 
used XMLDOMParser but I'm sure you get the picture.

I think TextStream is used for something completely different and is not 
needed here. I hope I've understood your question.

- Zulq.


Bob Erb wrote:
> Is there a way to make an XMLDocument from a string? I want to do
> something like this
>
>   XMLDocument new parseDocumentFrom: '<root><child>wah</child></root>'
>
> but #parseDocumentFrom: takes a stream as an argument. 




More information about the Squeak-dev mailing list