[x3d-public] MFString quotes

Yves Piguet yves.piguet at gmail.com
Wed Mar 15 01:02:19 PDT 2017


See also my spec comment 1108 at http://www.web3d.org/node/1694/submission/1108 for those authorized to read it (I'm not). I quote it below. To summarize, I think X3D-XML must be compliant with XML, and 19776-1 shouldn't interfere with what belongs to the XML standard: define what's stored in the attributes (with double quotes for MFString), not how (which quotes around the attribute or which encoding for what must be escaped, be it with entities or not).

Yves

> Comment on 19776-1: XML Encoding - V3.3 
> 5.15 SFString and MFString 
> http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfFields.html#SFString 
> 
> ----------------- 
> Confusion between xml and x3d syntax for SFString 
> Problem statement: 5.15 states which kind of quotes should be used for the 
> xml attribute value for SFString and MFString. But that's specified in the 
> xml standard: both single quotes and double quotes are valid. When an 
> XML-encoded X3D file is parsed by a generic XML parser, there is no way to 
> know which kind of quote was used, and that shouldn't be necessary. For an 
> SFString, str="foo" or str='foo' should both be valid; and for an MFString, 
> str='"foo" "bar"' or str=""foo" "bar"". 
> Suggested solution: replace 
> SFString specifies a single string encoded as a sequence of UTF-8 octets 
> enclosed in double quotes (e.g., "string").  The MFString specifies zero or 
> more SFStrings enclosed in single quotes (e.g., '"string1" "string2"') 
> with 
> SFString specifies a single string encoded as a sequence of UTF-8 octets 
> without additional quotes (as an XML attribute value, it must be enclosed in 
> single or double quotes, e.g. "string" or 'string').  The MFString specifies 
> zero or more SFStrings, each of them enclosed in double quotes, separated by 
> at least one space (as an XML attribute value, it must be enclosed in single 
> or double quotes, and conflicting single and double quotes in the content 
> must be written as entities; e.g., '"string1" "string2"'; for more 
> complicated cases with single quotes in the first string and double quotes in 
> the second string, '"\"string1\"" "'string2'"' or ""\"string1\"" 
> "'string2'"') 
> ----------------- 
> 
> Submitted on Wednesday, 2016,  December 7 - 4:03pm 
> by  (Yves Piguet ) 
> IP: *** 
> 
> See: http://www.web3d.org/node/1694/submission/1108 


> On 14 Mar 2017, at 22:55, Andreas Plesch <andreasplesch at gmail.com> wrote:
> 
> http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfFields.html#SFString
> clearly states:
> The MFString specifies zero or more SFStrings enclosed in single quotes (e.g., '"string1" "string2"').
> 
> However, at least in Python there seems to be a notion that double quotes within attribute values in XML should be escaped as " . Also there is a preference that the outer quotes should be double quotes. This is probably due to Python XML standard libraries such as elementtree or minidom being hardcoded to serialize this way.
> 
> This makes it hard to conform exactly to the X3D XML encoding standard. I am not sure why X3D imposes this use of quotes.  XML allows for both single and double quotes as outer quotes, and the quotes used in the value could still be specified as double quotes. They just need to be escaped as entity if double quotes are used as outer quotes.
> 
>  x3d browsers may behave like this anyways if they use a reasonable XML parser.
> 
> So I would like to raise if it would be possible to relax the XML encoding a bit to allow use of standard XML serializer ?
> 
> Andreas
> 
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org




More information about the x3d-public mailing list