BluesZhang / gdata-objectivec-client

Automatically exported from code.google.com/p/gdata-objectivec-client
Other
0 stars 0 forks source link

Missing initWithContentsOfUrl #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
I used this library because I had code that used NSXMLDocument that I
wanted to put on the iPhone.  I was able to build but my app crashed
because the GDataXMLDocument did not accept the initWithContentsOfUrl
selector which I use in various places in my code.

What is the expected output? What do you see instead?
I expected this to work exactly as a replacement for NSXMLDocument, instead
this method was missing.  Though this method was trivial to implement it
was still kind of annoying and is a simple fix.

Please use labels and text to provide additional information.

I ended up adding it myself, code follows.

- (id)initWithContentsOfURL:(NSURL *)url options:(unsigned int)mask
error:(NSError **)error {

    NSString *contentString = [NSString stringWithContentsOfURL:url
encoding:NSASCIIStringEncoding error:error];
    NSData *data = [contentString dataUsingEncoding:NSUTF8StringEncoding];
    GDataXMLDocument *doc = [self initWithData:data options:mask error:error];
    return doc;
}

Original issue reported on code.google.com by travispo...@gmail.com on 10 Feb 2009 at 3:31