[x3d-public] question on MFStrings in XML.

John Carlson yottzumm at gmail.com
Fri May 19 04:13:50 PDT 2017

Roy, I’ve got a file F16.x3d with the first case, and I need to know how to handle it, perhaps by making X3dToJson.xslt keel over and complain.  I’m trying to fix X3dToJson.xslt, to convert the X3D (if legal) to JSON.  I believe I have my own copy of X3dToJson.xslt.  I am hoping my copy will be accepted, if it’s doing the right thing.  I do have some cases it’s failing on, but perhaps the standard one would fail as well.  More work!  Attached.


Sent from Mail for Windows 10

From: Roy Walmsley
Sent: Friday, May 19, 2017 6:45 AM
To: 'John Carlson'; 'X3D Graphics public mailing list'; 'Don Brutzman'
Subject: RE: question on MFStrings in XML.

Hi John,

Let’s remember that the string field in the Text node is of type MFString.

Yes. These two examples would be encoded differently in JSON.

No. The first is not an illegal expression, or is it. Reviewing ISO/IEC 19776-1 clause 5.15 SFString and MFString (http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfFields.html#SFString) there is no mention of white space separators. However, clause 5.1.2 Description (http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfFields.html#5.1.2) does say that “Multiple-valued fields are written as an ordered list of values enclosed in quotations and separated by whitespace.”. So whitespace seems to be required. Since SFString values have quotation marks as delimiters, the requirement for whitespace could be considered superfluous. So, implementations may, or may not, expect it. In conclusion, perhaps the first example is illegal. 

I’m trying to follow what you want, in each case. I’ll look at each in turn.

The first line reads (with added spaces for readability):

-                        <Text string=' "Target Locked" " FIRE!..""(Green Button)" '/>

This could be parsed as three separate strings. Namely “Target Locked”, then “ FIRE!..”, and finally “(Green Button)”. Or perhaps just as two strings, the second being “ FIRE!..” and the remainder is lost. Or perhaps the parser will complain about it and fall over.

The second line reads (

+                        <Text string=' "Target Locked" " FIRE!..\"\"(Green Button)” ’

This will be parsed as two separate strings. Namely “Target Locked”, and then “ FIRE!..\”\”(Green Button)”. When displayed, the escaping should then render the second string as FIRE!..””(Green Button).

What do you want to render? Then we can work out the correct encoding, for both JSON and XML.

All the best,


From: John Carlson [mailto:yottzumm at gmail.com] 
Sent: 19 May 2017 10:59
To: X3D Graphics public mailing list <x3d-public at web3d.org>; Don Brutzman <brutzman at nps.edu>; Roy Walmsley <roy.walmsley at ntlworld.com>
Subject: RE: question on MFStrings in XML.

Should these two examples be encoded differently in JSON?  That is my question!  Is the first an illegal expression?


Sent from Mail for Windows 10

From: John Carlson
Sent: Friday, May 19, 2017 2:37 AM
To: X3D Graphics public mailing list; Don Brutzman; Roy Walmsley
Subject: question on MFStrings in XML.

-                        <Text string='"Target Locked" " FIRE!..""(Green Button)"'/>
+                        <Text string='"Target Locked" " FIRE!..\"\"(Green Button)"'/>
Are these equivalent or not?  Thanks!
The first is from the Savage examples.

Here’s how I’m encoding it in JSON:
                             "@string":["Target Locked"," FIRE!..\"\"(Green Button)"]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170519/bfc5a66e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: X3dToJava.xslt
Type: application/octet-stream
Size: 222805 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170519/bfc5a66e/attachment-0001.obj>

More information about the x3d-public mailing list