[x3d-public] question on MFStrings in XML.

Roy Walmsley roy.walmsley at ntlworld.com
Fri May 19 05:12:51 PDT 2017


John,

 

I am assuming that the file in question is in the Savage examples archive. I can see the line in question in that file. Just out of interest, I looked on the web page at the Cobweb image, and zoomed right into the cockpit to view the controls. I spotted the text. It’s been implemented as three separate strings. Judging by the appearance on the screen, I’d hazard a guess that was the intention of the model designer. Don might be able to provide more insight.

 

So, in conclusion, I’d say the model needs to be fixed, by inserting a space between the second and  third strings.

 

What does the XSLT do? Is it specifically looking for whitespace between strings? Does it care whether there is some, or not?

 

All the best,

 

Roy

 

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

 

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.

 

John

 

Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986>  for Windows 10

 

From: Roy Walmsley <mailto:roy.walmsley at ntlworld.com> 
Sent: Friday, May 19, 2017 6:45 AM
To: 'John Carlson' <mailto:yottzumm at gmail.com> ; 'X3D Graphics public mailing list' <mailto:x3d-public at web3d.org> ; 'Don Brutzman' <mailto:brutzman at nps.edu> 
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,

 

Roy

 

 

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 <mailto:x3d-public at web3d.org> >; Don Brutzman <brutzman at nps.edu <mailto:brutzman at nps.edu> >; Roy Walmsley <roy.walmsley at ntlworld.com <mailto: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?

 

John

 

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> "'/>

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!

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>                              "@string":["Target Locked"," FIRE!..\"\"(Green Button)"]

John

 

 

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


More information about the x3d-public mailing list