[x3d-public] question on MFStrings in XML.

Roy Walmsley roy.walmsley at ntlworld.com
Fri May 19 03:45:08 PDT 2017

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 <https://go.microsoft.com/fwlink/?LinkId=550986>  for Windows 10


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


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

+                        <Text string='"Target Locked" " FIRE!..\"\"(Green Button) <mailto:%22'/%3e%0d%0dAre%20these%20equivalent%20or%20not? %20Thanks!%0d%0dThe%20first%20is%20from%20the%20Savage%20examples.%0d%0bHere's%20how%20I'm%20encoding%20it%20in%20JSON:%0d%0d     %20                       %22 at string%22:%5b%22Target> "'/>

 <mailto:%22'/%3e%0d%0dAre%20these%20equivalent%20or%20not? %20Thanks!%0d%0dThe%20first%20is%20from%20the%20Savage%20examples.%0d%0bHere's%20how%20I'm%20encoding%20it%20in%20JSON:%0d%0d     %20                       %22 at string%22:%5b%22Target>  

Are these equivalent or not? <mailto:%22'/%3e%0d%0dAre%20these%20equivalent%20or%20not? %20Thanks!%0d%0dThe%20first%20is%20from%20the%20Savage%20examples.%0d%0bHere's%20how%20I'm%20encoding%20it%20in%20JSON:%0d%0d     %20                       %22 at string%22:%5b%22Target>   Thanks!

 <mailto:%22'/%3e%0d%0dAre%20these%20equivalent%20or%20not? %20Thanks!%0d%0dThe%20first%20is%20from%20the%20Savage%20examples.%0d%0bHere's%20how%20I'm%20encoding%20it%20in%20JSON:%0d%0d     %20                       %22 at string%22:%5b%22Target>  

The first is from the Savage examples. <mailto:%22'/%3e%0d%0dAre%20these%20equivalent%20or%20not? %20Thanks!%0d%0dThe%20first%20is%20from%20the%20Savage%20examples.%0d%0bHere's%20how%20I'm%20encoding%20it%20in%20JSON:%0d%0d     %20                       %22 at string%22:%5b%22Target> 

 <mailto:%22'/%3e%0d%0dAre%20these%20equivalent%20or%20not? %20Thanks!%0d%0dThe%20first%20is%20from%20the%20Savage%20examples.%0d%0bHere's%20how%20I'm%20encoding%20it%20in%20JSON:%0d%0d     %20                       %22 at string%22:%5b%22Target> 
Here’s how I’m encoding it in JSON:

 <mailto:%22'/%3e%0d%0dAre%20these%20equivalent%20or%20not? %20Thanks!%0d%0dThe%20first%20is%20from%20the%20Savage%20examples.%0d%0bHere's%20how%20I'm%20encoding%20it%20in%20JSON:%0d%0d     %20                       %22 at string%22:%5b%22Target>  

 <mailto:%22'/%3e%0d%0dAre%20these%20equivalent%20or%20not? %20Thanks!%0d%0dThe%20first%20is%20from%20the%20Savage%20examples.%0d%0bHere's%20how%20I'm%20encoding%20it%20in%20JSON:%0d%0d     %20                       %22 at string%22:%5b%22Target>                              "@string":["Target Locked"," FIRE!..\"\"(Green Button)"]



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170519/4e7438a8/attachment.html>

More information about the x3d-public mailing list