<div dir="ltr"><div>It turns out that quoting is regularly discussed. The latest round was just a month ago:<br><br><a href="http://web3d.org/pipermail/x3d-public_web3d.org/2017-March/006145.html">http://web3d.org/pipermail/x3d-public_web3d.org/2017-March/006145.html</a><br><br></div>but looking through the archives there are more threads.<br><div><div><div><br>Date: Tue, 25 Apr 2017 20:44:39 +0200<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
From: Michalis Kamburelis <<a href="mailto:michalis.kambi@gmail.com">michalis.kambi@gmail.com</a>><br>
To: John Carlson <<a href="mailto:yottzumm@gmail.com">yottzumm@gmail.com</a>><br>
Cc: X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a>><br>
Subject: Re: [x3d-public] interesting sample<br><br>
2017-04-25 10:03 GMT+02:00  <<a href="mailto:yottzumm@gmail.com">yottzumm@gmail.com</a>>:<br>
> Here?s an interesting sample from X3D resources examples  that many viewers<br>
> don?t handle?they don?t list the whole MFString.<br>
><br>
<br>
view3dscene handles it. Also displays a warning, pointing to the problem:<br>
<br>
  view3dscene: VRML/X3D warning: Error when reading MFString field<br>
"string" value. Possibly missing double quotes (treating as a single<br>
string): Error at line 1 column 134: Expected string, got "is"<br>
<br>
More explanation:<br>
<br>
- Text.string is MFString.<br>
<br>
- So the whole content must be surrounded with double-quote<br>
characters, if you want to place a single string inside.<br>
<br>
- To place a *visible* double-quote inside, it must *always* be<br>
protected with a backslash.<br>
<br>
- The double-quote can be expressed as " or &quot; inside XML<br>
attribute. These are equivalent once XML parser is done, so they are<br>
seen as equivalent for X3D browser. Note that you can only use literal<br>
" if you surround the whole XML attribute with a single quote<br>
(apostrophe, '), otherwise you have to use &quot; -- that's how XML<br>
works.<br>
<br>
- Note that the XML attribute can be surrounded with single quote<br>
(apostrophe, ') or double quote ("). This is a feature of XML, not<br>
X3D. I was careful to always use the words "double quotes" above, when<br>
I meant only double quotes.<br>
<br>
Following the above rules makes your X3D correct. Other options may<br>
also work in some X3D browsers, because we have learned to tolerate<br>
incorrect X3D files... but this tolerance results in different<br>
behavior in complicated cases, like the one you show.<br>
<br>
And yes, I wish that X3D specification about XML encoding was more<br>
clear about this (maybe using more examples, like I show below). The<br>
example X3D files found on the Internet also often show something<br>
incorrect. Disclaimer: My explanation above, and examples below, is<br>
*my* understanding of the specification, and describes also<br>
view3dscene implementation, and it was confirmed by testing with other<br>
browsers long time ago.<br>
<br>
For example:<br>
<br>
<Text string="blablah" /><br>
<br>
is INCORRECT.<br>
<br>
To make it CORRECT, write<br>
<br>
<Text string=' "blablah" ' /><br>
<br>
or<br>
<br>
<Text string='&quot;blablah&quot;' /><br>
<br></blockquote><div><br></div><div>Using single quotes as outer quotes is legal,<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
or<br>
<br>
<Text string="&quot;blablah&quot;" /><br>
<br></blockquote><div><br></div><div>but using double quotes is not in X3D: <br><a href="http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfFields.html#SFString">http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfFields.html#SFString</a><br><br>although it is legal in XML.<br><br>However, most browser probably allow double quotes as outer quotes since they will just use a standard XML parser.<br></div><div>I am not pretending to understand the motivation for this X3D rule.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
To place a (*visible*) double-quote inside, precede it with backslash. So<br> 
<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<Text string='"You will see quotes \"around this string\""' /><br>
<br>
or<br>
<br>
<Text string='&quot;You will see quotes \&quot;around this<br>
string\&quot;&quot;' /><br>
<br>
or<br>
<br>
<Text string='"You will see quotes \&quot;around this string\&quot;"' /><br>
<br>
I'm attaching an X3D file testing all these possibilities. This is<br>
correct X3D as far as I know, and should work in all X3D browsers. (If<br>
it doesn't, please let me know so that I can update my knowledge:).<br>
<br>
Regards,<br>
Michalis<br clear="all"></blockquote></div><br>-- <br><div class="gmail_signature">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</div>
</div></div></div></div></div>