XML attributes are properly formed when they are double-quoted, not single quoted. This is why the default for NSXML is double-quoted. It is likely that what you need to do is encode the x3d MFString before using it as the attribute body, perhaps as simply as slash escaping the quotes: attr="\'\"alpha\" \"bravo\"\' ". You may have to use DTD entities to represent the internal quote and double-quote characters.
~ Erik On 2012-08-15, at 7:47 PM, Christopher Henrich <chenr...@monmouth.com> wrote: > I am working on an app which will, among other things, write out an X3D file, > in XML format. (Background: X3D is a language for describing > three-dimensional scenes*; one way to put an X3D scene in a file is to use > XML.) Some of the X3D "fields," which map to "attributes" of XML nodes, are > of the X3D type MFString. The idea is to wrap 0, 1, or more character strings > in a single package. > > The specification of the XML form for X3D requires that an MFString be > enclosed in single quotes, and the enclosed strings must be enclosed in > double quotes. Example: ' "alpha" "bravo" '. > > Now, if I construct an NSXML document in my program, and write it out using > XMLDataWithOptions, I do not have fine-grained control over whether strings > are enclosed in single or double quotes. I can apply the option > NSXMLNodeUseSingleQuotes, but I have to apply it to the entire document. This > is acceptable for the moment, but it seems clunky. What if I later have to > use X3D fields of type SFString, which X3D requires to be enclosed in double > quotes? > > There are, as far as I can tell, no magic hooks into the mechanism of > XMLDataWithOptions to apply an option in certain cases but not others. I face > the prospect of having to re-implement XMLDataWithOptions, adding special > wrinkles to apply an option in certain cases. > > I am tempted to wonder about the rule that X3D wants to enforce upon its XML > representation of fields of type SFString or MFString. I do not see how it > can be expressed in an XML Data Type Definition. It doesn't seem to appear in > the dtd files published by the X3D committee. Is it for real? And, according > to the customer of the XML community, should it be for real? > > Thanks in advance for any relevant insights. > > *X3D is good for a lot of other stuff as well, but this is the aspect I am > trying to use. > > Christopher Henrich > chenr...@monmouth.com > mathinteract.com > > > > > > _______________________________________________ > > 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/erik.stainsby%40roaringsky.ca > > This email sent to erik.stain...@roaringsky.ca _______________________________________________ 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