FROM : Simon Liu
DATE : Tue Apr 05 19:46:49 2005
I know of NSXMLParser but unfortunately it's for 10.3 only, and I need
to support 10.2 machines as well...
On Apr 5, 2005 6:40 PM, Kevin Viggers <<email_removed>> wrote:
> If you can get away with an event-driven (SAX-style) XML parsing
> approach, you may want to give the NSXMLParser a try. I haven't used it
> yet, but it looks to at least have some constants relating to
> encodings.
>
> http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
> ObjC_classic/Classes/NSXMLParser.html
>
> Kevin
>
>
> On 5-Apr-05, at 11:12 AM, Simon Liu wrote:
>
> > Hi,
> >
> > I am doing some XML parsing for 10.2+, thus I am using Core
> > Foundation's XML functions, such as CFXMLTreeCreateFromData().
> >
> > Things are working fine except for XML files with non-ASCII
> > characters. The functions seem to ignore the encoding attribute of
> > the xml tag, such as in:
> >
> > <?xml version="1.0" encoding="shift_jis" standalone="yes"?>
> >
> > Given an XML file in the above encoding, with Japanese characters as
> > values between tags, the routines crash.
> >
> > However, if I first convert the file to UTF8, things work fine...
> >
> > NSString *s = [NSString stringWithContentsOfURL:sourceURL];
> > NSData *xmlData = [s dataUsingEncoding:NSUTF8StringEncoding];
> > // use as CFDataRef in CFXMLTreeCreateFromData()
> >
> > Is this the expected behaviour? Is there a more elegant way to parse
> > non-ASCII XML files?
> >
> > Regards,
> > Simon
> > _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Cocoa-dev mailing list (<email_removed>)
> > Help/Unsubscribe/Update your Subscription:
> > http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
> >
> > This email sent to <email_removed>
> >
>
>
DATE : Tue Apr 05 19:46:49 2005
I know of NSXMLParser but unfortunately it's for 10.3 only, and I need
to support 10.2 machines as well...
On Apr 5, 2005 6:40 PM, Kevin Viggers <<email_removed>> wrote:
> If you can get away with an event-driven (SAX-style) XML parsing
> approach, you may want to give the NSXMLParser a try. I haven't used it
> yet, but it looks to at least have some constants relating to
> encodings.
>
> http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
> ObjC_classic/Classes/NSXMLParser.html
>
> Kevin
>
>
> On 5-Apr-05, at 11:12 AM, Simon Liu wrote:
>
> > Hi,
> >
> > I am doing some XML parsing for 10.2+, thus I am using Core
> > Foundation's XML functions, such as CFXMLTreeCreateFromData().
> >
> > Things are working fine except for XML files with non-ASCII
> > characters. The functions seem to ignore the encoding attribute of
> > the xml tag, such as in:
> >
> > <?xml version="1.0" encoding="shift_jis" standalone="yes"?>
> >
> > Given an XML file in the above encoding, with Japanese characters as
> > values between tags, the routines crash.
> >
> > However, if I first convert the file to UTF8, things work fine...
> >
> > NSString *s = [NSString stringWithContentsOfURL:sourceURL];
> > NSData *xmlData = [s dataUsingEncoding:NSUTF8StringEncoding];
> > // use as CFDataRef in CFXMLTreeCreateFromData()
> >
> > Is this the expected behaviour? Is there a more elegant way to parse
> > non-ASCII XML files?
> >
> > Regards,
> > Simon
> > _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Cocoa-dev mailing list (<email_removed>)
> > Help/Unsubscribe/Update your Subscription:
> > http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
> >
> > This email sent to <email_removed>
> >
>
>
| Related mails | Author | Date |
|---|---|---|
| Simon Liu | Apr 5, 19:12 | |
| Simon Liu | Apr 5, 19:46 | |
| Kevin Viggers | Apr 7, 07:08 | |
| Simon Liu | Apr 7, 12:53 |






Cocoa mail archive

