[x3d-public] X3DJSAIL progress report: quote escapinig, node validation, .jsonimprovements, containerField handling

yottzumm at gmail.com yottzumm at gmail.com
Mon Mar 20 17:37:35 PDT 2017


Examples, I believe, where USE is not appearing.  See intermediate X3D and new json for missing USE

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Monday, March 20, 2017 8:20 AM
To: Don Brutzman
Subject: Re: X3DJSAIL progress report: quote escapinig, node validation, .jsonimprovements, containerField handling

Does this update include USE field output?   I will check your TXT file.

John

On Mar 19, 2017 5:24 PM, "Don Brutzman" <brutzman at nps.edu> wrote:
Further updates now deployed:

- A  bunch of work for escaping quotes in the X3dToJson.xslt stylesheet
- Improved handling of quotation marks and escaping
- Validating acceptableNodeTypes for setting nodes

Now handling most (perhaps all?) containerField values OK.  Related documentation now available at

http://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#containerField
========================================================================
X3D Scene Authoring Hints: containerField
 For the XML encoding of .x3d scenes, containerField is the field name indicating a node's field relationship to its parent node.

For example: <Transform><Shape containerField='children'/></Transform> shows that the Shape node is one of the children of the Transform node.

    Default containerField values for each node are correct in most cases, so the need to override default containerField values is rare.
    Example values include containerField='geometry' for Box node, containerField='children' for Group node, containerField='proxy' for hidden proxy shape within a Collision node, etc.
    containerField attribute is part of XML encoding for X3D scenes, and corresponds to the always-declared field labels in the ClassicVRML and VRML97 file encodings.

A small number of nodes have more than one field that can accept the same node type. Care must be taken with the following non-default child fields.

    MetadataSet can have a single X3DMetadataNode node with default containerField='metadata', or multiple other X3DMetadataNode nodes with containerField='value'.
    CADFace and CollidableShape can have a single default Shape node with containerField='shape'. CADFace can also accept an LOD or Transform node in this SFNode field.
    Collision can contain multiple nodes with default containerField='children', or can have a single unrendered Shape, or X3DGroupingNode with containerField='proxy'.

========================================================================

Also rebuilt and uploaded all .json scenes in X3D Examples, see "Special testing distribution" at

        http://www.web3d.org/x3d/content/examples/X3dResources.html#Examples

Test excerpts follow, linked at

        X3DJSAIL Examples
        http://www.web3d.org/specifications/java/X3DJSAIL.html#Examples

http://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.txt
========================================================================
<Shape>
        <Appearance>
                <Material/>
        </Appearance>
        <Text string='"X3D Java" "SAI Library" "X3DJSAIL"'>
                <MetadataSet name='EscapedQuotationMarksMetadataSet'>
                        <MetadataString name='escapedQuotesTest2' value='"escaped quotation marks example 2: He said, \"Immel did it!\""'/>
                </MetadataSet>
                <FontStyle family='"SERIF"' justify='"MIDDLE" "MIDDLE"'/>
                <!-- escaped quotation marks example 3: He said, \"Immel did it!\" -->
                <!-- escaped quotation marks example 4: He said, \"Immel did it!\" -->
        </Text>
</Shape>
<Collision>
        <!-- test containerField='proxy' -->
        <Shape DEF='ProxyShape'>
                <Box/>
        </Shape>
</Collision>
========================================================================
{ "Shape":
  {
        "-appearance":
          { "Appearance":
                {
                  "-material":
                        { "Material":
                          {
                          }
                        }
                }
          },
        "-geometry":
          { "Text":
                {
                  "@string":["X3D Java","SAI Library","X3DJSAIL"],
                  "-metadata":
                        { "MetadataSet":
                          {
                                "@name":"EscapedQuotationMarksMetadataSet",
                                "-value":[
                                  { "MetadataString":
                                        {
                                          "@name":"escapedQuotesTest1",
                                          "@value":["escaped quotation marks example 1: He said, \\\"Immel did it!\\\""]
                                        }
                                  },
                                  { "MetadataString":
                                        {
                                          "@name":"escapedQuotesTest2",
                                          "@value":["escaped quotation marks example 2: He said, \\\"Immel did it!\\\""]
                                        }
                                  }
                                ]
                          }
                        },
                  "-fontStyle":
                        { "FontStyle":
                          {
                                "@justify":["MIDDLE","MIDDLE"]
                          }
                        },
                  "-children":[
                        {
                          "#comment":"escaped quotation marks example 3: He said, \\\"Immel did it!\\\""
                        },
                        {
                          "#comment":"escaped quotation marks example 4: He said, \\"Immel did it!\\""
                        }
                  ]
                }
          }
  }
},
{ "Collision":
  {
        "-children":[
          {
                "#comment":"test containerField='proxy'"
          }
        ],
        "-proxy":
          { "Shape":
                {
                  "@DEF":"ProxyShape",
                  "-geometry":
                        { "Box":
                          {
                          }
                        }
                }
          }
  }
},
========================================================================

On 3/13/2017 8:38 AM, Don Brutzman wrote:
A new X3DLoaderObject is now ready that can read .x3d scenes using native Java DOM support, using Java Reflection to then create strongly typed X3DJSAIL scene objects.  Online at

    X3DLoaderObject: Concrete class for loading an X3D graphics string, file or fragment encoded in XML.
    http://www.web3d.org/specifications/java//javadoc/org/web3d/x3d/jsail/X3DLoaderObject.html

with methods
    getDomDocument() isLoadSuccessful() getValidationResult() getX3dObjectTree()
    loadX3DfromFile(x3dFile) toStringX3D(org.w3c.dom.Node node) toX3dObjectTree(org.w3c.dom.Node node)

Example result
    https://svn.code.sf.net/p/x3d/code/www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.Reloaded.x3d

which is a reloaded and serialized output that exactly matches input scene
    https://svn.code.sf.net/p/x3d/code/www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.x3d

This library improvement fixes a significant bug in field types, which are getting more robust.  Also add a variety of .normalize() utility methods and validation checks on negative SFTime/MFTime values.
    http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/fields/MFColorObject.html

As ever, demonstration test source available in
    http://www.web3d.org/specifications/java/examples/HelloWorldProgram.java

Entire build online via
    http://www.web3d.org/specifications/java/X3DJSAIL.html

Have fun with X3D Java using X3DJSAIL!  8)

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pp3.diff
Type: application/octet-stream
Size: 402 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0010.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pp3.java
Type: application/octet-stream
Size: 13857 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0011.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pp3.json
Type: application/json
Size: 23433 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0004.json>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pp3.new.json
Type: application/json
Size: 23063 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0005.json>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pp3.new.json.intermediate.x3d
Type: application/octet-stream
Size: 8823 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0012.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pp3.x3d
Type: application/octet-stream
Size: 6540 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0013.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pp3.x3d.new
Type: application/octet-stream
Size: 7305 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0014.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qq3.diff
Type: application/octet-stream
Size: 355 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0015.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qq3.java
Type: application/octet-stream
Size: 7801 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0016.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qq3.json
Type: application/json
Size: 9842 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0006.json>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qq3.new.json
Type: application/json
Size: 9459 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0007.json>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qq3.new.json.intermediate.x3d
Type: application/octet-stream
Size: 3756 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0017.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qq3.x3d
Type: application/octet-stream
Size: 4088 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0018.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qq3.x3d.new
Type: application/octet-stream
Size: 3135 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170320/2cf034d0/attachment-0019.obj>


More information about the x3d-public mailing list