[x3d-public] Mantis 1320: relax requirement for quoted single-string value in MFString array

Michalis Kamburelis michalis.kambi at gmail.com
Sun Jul 5 04:48:06 PDT 2020


Don,

About your implementation and samples, there are 2 errors. Which shows my
point -- this issue has complicated details :)

1.You need to account that the character may also be " (literal double
quote), they don't need to be expressed using HTML entities when you
surround the XML attribute using apostrophes. (One point of our proposed
text, on
https://github.com/michaliskambi/x3d-tests/wiki/Clarify-the-usage-of-quotes-and-backslashes-for-MFString-and-SFString-in-XML-encoding
, was to clarify this).

2. Your example <Text string='we \"love\" you Ma!'/> does not work like you
probably think. Since now this is treated like an SFString, the backslashes
are *not* special, and so they would be visible. Please see my discussion
of backslashes on the bottom of
https://github.com/michaliskambi/x3d-tests/wiki/Clarify-the-usage-of-quotes-and-backslashes-for-MFString-and-SFString-in-XML-encoding
. This was discussed on this mailing list, with a consensus, and my
description there matches what browsers are already doing.

And there remains a problem Vince noted: what is an empty string now?
Previously it was MFString with 0 items. Now it will be MFString with 1
item equal to an empty string. This difference matters in some edge cases
e.g. "Text" node will have a different size now, as it has 1 row.

In general, the rationale """be liberal in what you accept""" is not
convincing IMHO. That is not what a usual programming language is doing.
You don't want to liberally accept everything that may make sense --
because this leads to a language with lots of special rules and allowances,
which leads to a language that is hard to understand / predict. Instead,
the usual guideline is that language should apply the rules consistently.

My practical problem is that this new rule would create a confusion for
authors. Your own example shows this, as you were confused with how <Text
string='we \"love\" you Ma!'/>  works.

I imagine these scenarios:

1. I start with a <Text string="bla bla" /> . Cool, it just works.

    - But now I want to add a second line. So I need to learn to surround
the first line in double quotes now anyway: <Text string=""bla
bla" "another line"" />.

2. I start with a <Text string='we "love" you Ma!' />. Cool, it just works.

    - But now I want to add a second line. So I need to learn to surround
the first line in double quotes now anyway: <Text string='"we "love"
you Ma!" "another line"' />

    - And now I need to learn about backslashes, because the above example
will fail. Both " and " inside delimit string parts, so I actually
need <Text string='"we \"love\" you Ma!" "another
line"' />

These cases show how an author would get confused. Having to do the correct
thing (with quotes and backslashes) at the beginning, means that you have a
harder start (you need to understand these quotes and backslashes), but
then you have a smooth way ahead, because it's obvious how to add a 2nd
string.

And existing tools (both writing and reading) have learned to cope with
this throughout the years. I doubt that these additional quotes are a
blocker for X3D adoption -- it's trivial to explain them, "they are there
because you may have multiple strings, and we have a general way of writing
many strings inside one XML attribute".

All in all, I'm still not convinced.

Regards,
Michalis

niedz., 5 lip 2020 o 05:01 vmarchetti at kshell.com <vmarchetti at kshell.com>
napisał(a):

> Apologies, this fragment of a reply was sent prematurely and is
> incomplete, ignore it for now.
>
> Vince
>
>
> > On Jul 4, 2020, at 10:58 PM, vmarchetti at kshell.com wrote:
> >
> >
> >
> >> On Jul 4, 2020, at 9:26 PM, Don Brutzman <brutzman at nps.edu> wrote:
> >>
> >> Thanks for your note... yes we had a brief discussion some months ago,
> will look it up.  Didn't want to dwell on the topic then (each of us too
> busy!!) but now more metadata is getting created and this relaxation will
> help.
> >>
> >> My understanding of years of implementation-complexity objections heard
> to this XML encoding relaxation have not appeared to be grounded by
> practice, which in this case is quite simple.
> >>
> >> For example, pseudocode adaptable to ~any language that is parsing text
> into X3D objects:
> >>
> >>      if (!value.startsWith('"') and !value.endsWith('"')) //
> example approach #1
> >>      {
> >>              newMFStringValue = new MFString() of length 1;
> >>              newMFStringValue[0] = value;
> >>      }
> >>      else // continue parsing as before
> >>
> >>
> >
> > However, I think this approach of coming up with code or pseudo code to
> explain or document the standard doesn't account that implementors will
> want to (and I think should) use standardized code to do all the XML
> processing, including applying the XML rules for un-encoding the way that
> attribute values can be encoded in XML.
> > For example, given an XML fragment
> > <Element fruit='"apple"'/>
> >
> > However, the same could be
> >
> >
> >
> > Someone using the standard Python module xml.etree to parse the document
> would only see a Python object with a (Python) attribute named fruit and a
> value which was the unicode value "apple" . If this occurred in an X3D
> document,
> > this would be interpreted as an SFString with value "apple"  or an
> MFString of one element with value apple .
> >
> >
> >
> >
> >
> >> 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
> >>
> >> _______________________________________________
> >> x3d-public mailing list
> >> x3d-public at web3d.org
> >> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> >
> >
> > _______________________________________________
> > x3d-public mailing list
> > x3d-public at web3d.org
> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20200705/46448fc5/attachment.html>


More information about the x3d-public mailing list