<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Pretty much since the beginning there
has been discussions as to the "correct" way to specify an
MFString. That tells me we (the WG) could improve the notation
and/or description for MFStrings. Note that the confusion only
seems to be in the XML encoding. <br>
<br>
Part of the syntax was a desire to maintain compatibility with the
old VRML97 encoding. In that encoding all string elements were
enclosed in quotes ("). Since this encoding was not trying to fit
into another format, it was easy to do some things -- like use a
external (meaning not in quotes) space for a delimiter. The value
of SFString would be encoded as<br>
<br>
<blockquote><tt>"this is a single string </tt><tt><tt>element</tt>"</tt><br>
</blockquote>
and the value of an MFString field would be encoded as<br>
<br>
<blockquote><tt>"this" "is" "a" "multiple" "string" "</tt><tt><tt>element</tt>"</tt><br>
</blockquote>
When X3D went to XML, the quotation marks around field elements
was retained as was the white-space separator. As was the case for
almost everything else, it was put in an attribute. XML rules
require all attribute values to be enclosed in a quote (") or
apostrophe ('). This made the encodings of the SFString and
MFString<br>
<br>
<br>
<blockquote><tt>'"this is a single string element"'</tt><br>
<br>
</blockquote>
<blockquote><tt>'"this" "is" "a" "multiple" "string" "</tt><tt><tt>element</tt>"'<br>
<br>
</tt></blockquote>
But this is XML and all that really counts is how the attribute
value is presented to the parser. You can use various entities to
represent any of the values in the attribute value. 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<br>
<br>
<tt>""this</tt><tt><tt>"</tt> </tt><tt><tt>"</tt>is</tt><tt><tt>"</tt>
</tt><tt><tt>"</tt>a</tt><tt><tt>"</tt> </tt><tt><tt>"</tt>multiple</tt><tt><tt>"</tt>
</tt><tt><tt>"</tt>string</tt><tt><tt>"</tt> </tt><tt><tt>"</tt>field</tt><tt><tt>""</tt></tt><br>
<br>
Yes it's messy. We thought it was well documented, but the
repeated discussion has shown that not to be the case.<br>
<br>
<br>
So how would you change the encoding or documentation to make
things better?<br>
<br>
There are many possibilities for changing the encoding. I'll just
list a few for MFString<br>
<br>
<tt><text></tt><tt><br>
</tt><tt> <string>This</string></tt><tt><br>
</tt><tt> <string>is</tt><tt></string></tt><tt><br>
</tt><tt> <string>a</tt><tt></string></tt><tt><br>
</tt><tt> <string>multiple</tt><tt></string></tt><tt><br>
</tt><tt> <string>string</tt><tt></string></tt><tt><br>
</tt><tt> <string></tt><tt>element</tt><tt></string></tt><tt><br>
</tt><tt></text></tt><tt><br>
</tt><br>
<tt><text></tt><tt><![CDATA[This</tt><tt><br>
</tt><tt>is</tt><tt><br>
</tt><tt>a</tt><tt><br>
</tt><tt>multiple</tt><tt><br>
</tt><tt>string</tt><tt><br>
</tt><tt>element</tt><tt>]]></tt><tt></text></tt><tt>
<!-- newlines delimit the string elements --><br>
</tt><br>
Allow any character to delimit string elements. The entire string
would still need to be handled as an XML attribute. The opening
character defines the closing character. <br>
<blockquote><tt>"'This' |would| ^be^ ~legal~"</tt><br>
</blockquote>
<br>
I am not recommending any of these, just trying to offer a few
alternatives to see what people might come up with.<br>
<br>
<br>
Leonard Daly<br>
<br>
<br>
<br>
<br>
</div>
<blockquote type="cite"
cite="mid:CAKdk67upPafrUbKDgA4qb8+pOqu05Tyr7afcjzWuMJcSDHSrvw@mail.gmail.com">
<div dir="auto">
<div><br>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Apr 25, 2017 8:37 PM, "Michalis
Kamburelis" <<a href="mailto:michalis.kambi@gmail.com"
moz-do-not-send="true">michalis.kambi@gmail.com</a>>
wrote:<br type="attribution">
<blockquote class="quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="quoted-text">2017-04-26 1:47 GMT+02:00
Andreas Plesch <<a
href="mailto:andreasplesch@gmail.com"
moz-do-not-send="true">andreasplesch@gmail.com</a>>:<br>
>> To make it CORRECT, write<br>
>><br>
>> <Text string=' "blablah" ' /><br>
>><br>
>> or<br>
>><br>
>> <Text string='"blablah"'
/><br>
>><br>
><br>
> Using single quotes as outer quotes is legal,<br>
><br>
>><br>
>> or<br>
>><br>
>> <Text string=""blablah""
/><br>
>><br>
><br>
> 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"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://www.web3d.org/<wbr>documents/specifications/<wbr>19776-1/V3.3/Part01/<wbr>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<br>
> they will just use a standard XML parser.<br>
> I am not pretending to understand the motivation
for this X3D rule.<br>
><br>
<br>
</div>
I don't think the X3D disallows using double quotes to
surround XML<br>
attributes in X3D XML encoding. Indeed, the
specification (<br>
<a
href="http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfFields.html#SFString"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://www.web3d.org/<wbr>documents/specifications/<wbr>19776-1/V3.3/Part01/<wbr>EncodingOfFields.html#SFString</a><br>
) does not show this as a valid example (it only shows
using single<br>
quotes to surround the XML attribute). But it also
doesn't say it's<br>
invalid.<br>
</blockquote>
</div>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">(Unfortunately) it does say explicitly:</div>
<div dir="auto"><br>
</div>
<div dir="auto"><span style="font-family:sans-serif">The
MFString specifies zero or more SFStrings enclosed in single
quotes </span><span style="font-family:sans-serif">(</span><span
style="font-family:sans-serif">e.g.</span><span
style="font-family:sans-serif">, '"string1" "string2"').</span><br>
</div>
<div dir="auto"><span style="font-family:sans-serif"><br>
</span></div>
<div dir="auto"><span style="font-family:sans-serif">There may
be a little wiggle room since double quotes are not declared
invalid, but in general the spec. does not deal with
negatives. Otherwise, one could argue using $$ may be valid
as well. Also, the words "single quotes" clearly refer to
apostrophes rather than single counts of quote characters.</span></div>
<div dir="auto"><span style="font-family:sans-serif"><br>
</span></div>
<div dir="auto"><span style="font-family:sans-serif">If double
quotes are used for outer quotes, it may become impossible
to identify</span></div>
<div dir="auto"><span style="font-family:sans-serif"><br>
</span></div>
<div dir="auto"><span style="font-family:sans-serif">" '
MFString or SFString ? ' "</span></div>
<div dir="auto"><span style="font-family:sans-serif"><br>
</span></div>
<div dir="auto"><font face="sans-serif">as MFString or SFString.
But I do not think this would be a problem since it would be
parsed according to what the field expects. Is there a
situation where it is necessary to uniquely identify a field
value type based on the value alone ?</font></div>
<div dir="auto"><br>
</div>
<div dir="auto">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
I admit, I may be biased when reading this part of the
specification,<br>
because I think (like you) that it would be weird if the
X3D<br>
specification was limiting what is valid XML syntax.
Probably everyone<br>
uses some standard library to read XML files, and we
don't know:<br>
<br>
- What character in XML was used to surround XML
attribute: single or<br>
double quote.<br>
- What characters in XML were used to express a visible
double quote:<br>
" or ".<br>
<br>
And we don't want to know it, after all it's the purpose
of a standard<br>
XML parser to hide these details from the programmers
working on a<br>
higher level.<br>
<br>
Indeed, it would be great if the X3D XML specification
clarified this,<br>
both by more prose and by showing more examples what is
correct and<br>
what is incorrect (like the examples in my previous
mail). Reading the<br>
thread from <a
href="http://web3d.org/pipermail/x3d-public_web3d.org/2017-March/006145.html"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://web3d.org/pipermail/<wbr>x3d-public_web3d.org/2017-<wbr>March/006145.html</a><br>
, it seems that everyone agrees about what the
specification *should*<br>
mean (regardless of what it currently means), and this
expectation<br>
matches (all?) current implementations. So it would be
great to<br>
improve/fix the specification:)<br>
<br>
</blockquote>
</div>
<br>
</div>
<div class="gmail_extra" dir="auto">Completely agreed.</div>
<div class="gmail_extra" dir="auto"><br>
</div>
<div class="gmail_extra" dir="auto">As an aside, I recently
came across <a href="http://glitch.com"
moz-do-not-send="true">glitch.com</a> which has an online
html editor with non-optional syntax checker. It insists on
double quotes for attribute values which was irritating in
the same way.</div>
<div class="gmail_extra" dir="auto"><br>
</div>
<div class="gmail_extra" dir="auto">Andreas</div>
<div class="gmail_extra" dir="auto"><br>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
x3d-public mailing list
<a class="moz-txt-link-abbreviated" href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a>
<a class="moz-txt-link-freetext" href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a>
</pre>
</blockquote>
<p><br>
</p>
<div class="moz-signature">-- <br>
<font class="tahoma,arial,helvetica san serif" color="#333366">
<font size="+1"><b>Leonard Daly</b></font><br>
3D Systems & Cloud Consultant<br>
LA ACM SIGGRAPH Chair<br>
President, Daly Realism - <i>Creating the Future</i>
</font></div>
</body>
</html>