XMLParser issue

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

XMLParser issue

Sebastia Van Lacke
Hi,

I need to parse some xml files with XMLParser, and I am not sure how to use it nor which version of XMLParser I should use.

I am doing this:

readFrom: aFilename

| xmlFile |

    xmlFile := GsFile openReadOnServer: aFilename.
    document := XMLDOMParser parseDocumentFrom: xmlFile useNamespaces: false.
    xmlFile close.
    self readDocument

When executing that, I get an error doing:

self stream upToAll: delimitingString

GsFile does not understand #upToAll

The parser expect a stream, and I am sending a GsFile, is that correct? What should I send as argument?

My current XMLParser is XML-Parser.g-jgf.20

Thanks

Sebastian
Reply | Threaded
Open this post in threaded view
|

Re: XMLParser issue

otto
Hi,

This worked for me:

| xmlFile document |
[
   xmlFile := GsFile openReadOnServer: '/tmp/t.xml'.
   document := XMLDOMParser parseDocumentFrom: xmlFile contents
readStream useNamespaces: false
] ensure: [ xmlFile close ].
document

I have the most recent XML-Parser-OttoBehrens.125.mcz (version 1.1.9
of ConfigurationOfXMLSupport) loaded. Unfortunately GsFile does not
think it is a stream (isStream), although it does implement stream
like functionality.

Cheers
Otto


On Thu, Feb 24, 2011 at 9:41 PM, Sebastian Van Lacke
<[hidden email]> wrote:

> Hi,
>
> I need to parse some xml files with XMLParser, and I am not sure how to use
> it nor which version of XMLParser I should use.
>
> I am doing this:
>
> readFrom: aFilename
>
> | xmlFile |
>
>     xmlFile := GsFile openReadOnServer: aFilename.
>     document := XMLDOMParser parseDocumentFrom: xmlFile useNamespaces:
> false.
>     xmlFile close.
>     self readDocument
>
> When executing that, I get an error doing:
>
> self stream upToAll: delimitingString
>
> GsFile does not understand #upToAll
>
> The parser expect a stream, and I am sending a GsFile, is that correct? What
> should I send as argument?
>
> My current XMLParser is XML-Parser.g-jgf.20
>
> Thanks
>
> Sebastian