[x3d-public] MFString quoting [was: interesting sample]

Don Brutzman brutzman at nps.edu
Wed Apr 26 10:37:54 PDT 2017


Good discussion, and perhaps document clarity can be improved by additional prose and further examples.  Several mantis issues have suggested that.

However that specification document - XML encoding for X3D - isn't wrong, per se.  Characters " and " are equivalent in XML, and that is why each of the proposed example variants actually work.

Further if we even tried to distinguish between special-character representations in the X3D XML encoding, all XML parsers would ignore such distinctions.

Lots more detail on handling string characters available in

	_X3D for Web Authors_
	http://x3dgraphics.com

	Geometry Part 1: Primitives
	http://x3dgraphics.com/slidesets/X3dForWebAuthors/Chapter02-GeometryPrimitives.pdf

	X3D Example Archives: X3D for Web Authors, Chapter 02 Geometry Primitives (3 scenes)
	http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter02-GeometryPrimitives

	Course videos
	https://www.movesinstitute.org/Video/Courses/X3dForWebAuthors/X3dForWebAuthorsVideo.html#2
	https://www.youtube.com/playlist?list=PLuSIsM-86sik5uZNJ5sl5z5RxB2qvb1ji

	X3D Tooltips: type, SFString and MFString
	http://www.web3d.org/x3d/content/X3dTooltips.html#type

	X3D Tooltips: Text
	http://www.web3d.org/x3d/content/X3dTooltips.html#Text

Comments critiques and improvements on these assets are welcome, of course.

Of particular interest: valid examples that appear to be not supported by the spec.  So far have been able to handle everything.

"Having fun" "with X3D!" ":)  ☺"


On 4/25/2017 9:40 PM, Leonard Daly wrote:
> I agree that the document is wrong, unless there is someplace else in the document that indicates that the text is what appears after any legal XML parser. It may also be the case that an entity (e.g., ") is the same as the referenced character. I am not that familiar with that level of detail in XML syntax.
> 
> BTW, now is the time to propose significant changes in the structure of an encoding. None of the existing encodings are compatible with HTML, so it will be necessary to do work there anyway. It is a good time to improve upon things.
> 
> Leonard Daly
> 
> 
> 
> 
>> 2017-04-26 5:41 GMT+02:00 Leonard Daly<Leonard.Daly at realism.com>:
>>> If there is a reason that all attribute
>>> values must be contained in quotes (perhaps it is a style requirement), then
>>> an MFString would be encoded as
>>>
>>> ""this" "is" "a" "multiple"
>>> "string" "field""
>>>
>>> Yes it's messy. We thought it was well documented, but the repeated
>>> discussion has shown that not to be the case.
>> As Andreas pointed out, your example
>>
>>    ""this" "is" "a" "multiple"
>> "string" "field""
>>
>> seems to be disallowed by the specification (
>> http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfFields.html#SFString
>> ):
>>
>>    The MFString specifies zero or more SFStrings enclosed in single
>> quotes (e.g., '"string1" "string2"').
>>
>> We completely agree with your notion that
>>
>>    '"this" "is" "a" "multiple" "string" "element"'
>>
>> should be equivalent to
>>
>>    ""this" "is" "a" "multiple"
>> "string" "field""
>>
>> The proposed change to the specification (all to the section
>> http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfFields.html#SFString
>> ) would be to change this part:
>>
>> """""""
>>    The MFString specifies zero or more SFStrings enclosed in single
>> quotes (e.g., '"string1" "string2"').
>>
>>    NOTE  The construct
>>
>> "string3"
>>
>> is not a valid instance of an MFString. Such an MFString would be
>> properly specified as
>>
>> '"string3"'
>> """""""
>>
>> into this:
>>
>> """""""
>>    The MFString specifies zero or more SFStrings, with each single
>> string enclosed in double quotes (e.g., "string1" "string2"). Note
>> that inside an XML attribute, you have to express a double quote using
>> the " character entity, unless you enclose a whole XML attribute
>> in single quotes.
>>
>>    NOTE  The construct
>>
>> "string3"
>>
>> is not a valid instance of an MFString. Such an MFString would be
>> properly specified as
>>
>> '"string3"'
>>
>> or
>>
>> '"string3"'
>>
>> or
>>
>> ""string3""
>> """""""
>>
>> For additional clarity, I would also add more prose and examples to
>> explain when backslashes are needed. So I would change
>>
>> """""""
>> EXAMPLE 2  Two instances of the double quote are contained in the
>> following SFString field string:
>>
>> <Text string='"He said, \"Immel did it!\""' />
>> """""""
>>
>> with this:
>>
>> """""""
>> If a string is part of an MFString, and you want this string to
>> contain a double-quote (for example, to actually show a double-quote
>> using the Text node field "string") then you have to place a backslash
>> before this double-quote. This rule applies regardless if you express
>> double-quote as " or as " . This is necessary, to avoid treating
>> the double-quote as a delimiter of strings on a MFString list.
>>
>> Consequently, if you want a string inside MFString to contain a
>> backslash (for example, to actually show a backslash using the Text
>> node field "string") then you have to write two backslashes. This is
>> necessary, to avoid accidentally changing the meaning of a following
>> double-quote character.
>>
>> EXAMPLE 2  All the following forms are correct and equivalent:
>>
>> <Text string='"He said, \"Immel did it!\""' />
>>
>> <Text string='"He said, \"Immel did it!\""' />
>>
>> <Text string='"He said, \"Immel did it!\""' />
>>
>> <Text string=""He said, \"Immel did it!\""" />
>> """""""
>>
>> I think that this prose and examples clarifies the specification (or
>> fixes it, depending on how do you interpret the current
>> specification).
>>
>> P.S. I like your idea of
>>
>> <text>
>>      <string>This</string>
>>      <string>is</string>
>>      <string>a</string>
>>      <string>multiple</string>
>>      <string>string</string>
>>      <string>element</string>
>> </text>
>>
>> But that is a larger change, requiring changes in the X3D browsers
>> implementation. My proposed change requires no action from the
>> implementations -- they already work like that.
>>
>> Regards,
>> Michalis
>>
> 
> -- 
> *Leonard Daly*
> 3D Systems & Cloud Consultant
> LA ACM SIGGRAPH Chair
> President, Daly Realism - /Creating the Future/
> 
> 
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> 


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TextHavingFunWithX3D.x3d
Type: model/x3d+xml
Size: 2093 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170426/1fed51c8/attachment-0001.x3d>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TextHavingFunWithX3D.png
Type: image/png
Size: 17116 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170426/1fed51c8/attachment-0001.png>


More information about the x3d-public mailing list