[x3d-public] starting to run more tests.

Don Brutzman brutzman at nps.edu
Wed Jan 18 03:53:10 PST 2017

On 1/18/2017 1:22 AM, Yves Piguet wrote:
> Are comments considered to be worthwhile to preserve during conversion?

yes, at least as an author option.  the Java SAI treats them them as first-class library objects.

>  Each syntax has different capabilities for the location where comments can be stored: everywhere you can have blanks including in the middle of a value (classic), everywhere but in values stored in attributes (xml), more restricted (binary and x3d json as it's currently defined). So it's impossible to have an exact match between different formats; hence I guess the normalization to a compatible subset you seek with a series of multiple conversions.

exactly correct.  also occasionally tricky to handle and always worth sorting out.

> Also the author is free to use comments any way she wants, including specific to a format; for example a long line of # in classic to separate sections, or spaces for vertical alignment. Chunks of a file can be commented out, which one doesn't want to preserve in a different format. X3D clauses are grouped differently in different formats (IS element in xml vs. "inline" IS in classic), so reordering will bring comments with them, or not, which can make comments meaningless.

sure.  though meaningless is a bit strong... moved to a less relevant location, perhaps.

> One important usage of comments in many languages is to document author, copyright, version etc. and X3D has its own way to do it with metadata.

yes, and the document metadata approach (head/meta) exactly matches HTML.

> I'd suggest to discard comments during conversion.
> Yves

translator preference.  we keep comment retention turned on by default to best support unit testing in the example archives.

>> On 18 Jan 2017, at 06:29, <yottzumm at gmail.com> <yottzumm at gmail.com> wrote:
>> XML -> JSON -> DOM -> Java -> JSON (diff JSON files).
>> Seeing some differences.  Comments aren’t handled in my serializer yet.  Differences in trailing digits of numbers.
>> John

differences in trailing digits can be expected if zero. otherwise such occurrences, if within typed-value bounds, are failures to maintain necessary precision.

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

More information about the x3d-public mailing list