[X3D-Public] Should MFString (and SFString) in XML encoding use backslashes?

Michalis Kamburelis michalis.kambi at gmail.com
Tue Jul 19 00:08:09 PDT 2011

I wrote:
> should we precede "real" double quotes with backslashes

Quick tests: FreeWRL and InstantPlayer both show that:

- In MFString, double quotes (") should be preceded by \ (and of
course  this means that \ should be \\)
- In SFString, no.

view3dscene behaves like this now too :)

Attached the test X3D file, you're welcome to try this with other
browsers. You should see the text

  Some "quotes" and backslash \ in MFString

displayed. When mousing over the text, you should see description of
TouchSensor saying

  Some \"quotes\" and backslash \\ in SFString

If you see something different, it means that your browser handles it
differently (duh).

Suggestion is to add this clearly to the XML encoding specification.
Mention that backslashes should be used, and mention explicitly that
this is *only for MFString, not SFString*. Some (clumsy) suggested wording:

Double quotes (") inside strings in MFString fields should be
preceded by a backslash. Moreover, normal backslashes should be doubled.
This is necessary to distinguish between double quotes delimiting items
of the MFString, and double quotes inside string content.

(Example 2 here, <Text string='"He said, \"Immel did it!\""' />)

The above rule does not apply to SFString, or other attributes (for
example META content). That is, inside SFString and such content,
backslashes don't have any special meaning.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: double_quotes_in_xml.x3d
Type: model/x3d+xml
Size: 699 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20110719/30e89263/attachment.bin>

More information about the X3D-Public mailing list