On 14/03/2016 19:14, John Brownie wrote:
Is it possible to read an XML 1.1 file using NSXMLDocument? The crucial thing for my purposes is that the character set allowed in XML 1.1 is larger. XML 1.0 defines characters as:

Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]

XML 1.1 defines:

#2 Char ::= [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */ #2a RestrictedChar ::= [#x1-#x8] | [#xB-#xC] | [#xE-#x1F] | [#x7F-#x84] | [#x86-#x9F]

I need to be able to handle the RestrictedChar characters, but NSXMLDocument apparently only handles the XML 1.0 character set.

Is there a way to make NSXMLDocument handle the fuller character set? If not, is there an alternative that will enable me to parse an XML 1.1 file with a minimum of effort?

No actual answers, but the best I've found is to use the expat XML parser with the expatobjc wrapper, and go in and change the ASCII tables to handle the extra characters (change from BT_NONXML to BT_OTHER). Of course, it is not as simple as NSXMLDocument in that I have to do the parsing myself rather than having it give me a nice tree structure which I can walk to create my internal data structure. It would be even nicer to have it in Swift, but I guess I can live with ObjC for now.

John
--
John Brownie, john_brow...@sil.org or j.brow...@sil.org.pg
Summer Institute of Linguistics, Ukarumpa, Eastern Highlands Province, Papua New Guinea
Mussau-Emira language, Mussau Island, New Ireland Province, Papua New Guinea
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to