[x3d-public] X3dToJson.xslt , Saxon-JS 2 (oil and water) which one is at fault?

Don Brutzman brutzman at nps.edu
Wed Jan 6 11:35:50 PST 2021


Hi John.  A good practice is to compare with possible errors in original content in order to isolate the cause of difficulties.

* X3D Resources, Examples: Scene Archives for X3D
   https://www.web3d.org/x3d/content/examples/X3dResources.html#Examples

Most of the following relationships are demonstrated in

* X3D Example Archives: X3D4AM, X3D for Advanced Modeling, Hello World Scenes, Hello World
   https://x3dgraphics.com/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldIndex.html

* https://x3dgraphics.com/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorld.json

which has been successfully converted from HelloWorld.x3d by X3dToJson.xslt

On 1/6/2021 7:37 AM, John Carlson wrote:
> 
> Okay, I took all my X3D data files and shoved them through Saxon-JS 2:
> 
> $ npm install -g xslt3
> 
> $ cat skeleton.sh
> 
> for i in `ls ../data/*.x3d| grep -v new`
> 
> do
> 
> echo ../../../node_modules/.bin/xslt3 -xsl:/c/x3d-code/www.web3d.org/x3d/stylesheets/X3dToJson.xslt -s:$i -o:`dirname $i`/`basename $i .x3d`.json2
> 
> ../../../node_modules/.bin/xslt3 -xsl:/c/x3d-code/www.web3d.org/x3d/stylesheets/X3dToJson.xslt -s:$i -o:`dirname $i`/`basename $i .x3d`.json2
> 
> Done
> 
> There are many errors like:
> 
> ../../../node_modules/.bin/xslt3 -xsl:/c/x3d-code/www.web3d.org/x3d/stylesheets/X3dToJson.xslt -s:../data/extrusion.x3d -o:../data/extrusion.json2
> 
> Error: IllegalChildNodeFieldNameNotFound no containerField or field name found for the X3D JSON object. Check spelling of node.
> 
>    $elementName=Shape, $parentName=Group

expected value for parent-child relationship is containerField='children'

>    Please report this error to x3d-public at web3d.org - thanks for your help improving X3D Quality Assurance (QA).
> 
> Error: IllegalChildNodeFieldNameNotFound no containerField or field name found for the X3D JSON object. Check spelling of node.
> 
>    $elementName=Extrusion, DEF=extrusion, $parentName=Shape


expected value for parent-child relationship is containerField='geometry'


>    Please report this error to x3d-public at web3d.org - thanks for your help improving X3D Quality Assurance (QA).
> 
> Error: IllegalChildNodeFieldNameNotFound no containerField or field name found for the X3D JSON object. Check spelling of node.
> 
>    $elementName=Appearance, $parentName=Shape

expected value for parent-child relationship is containerField='appearance'

>    Please report this error to x3d-public at web3d.org - thanks for your help improving X3D Quality Assurance (QA).
> 
> Error: IllegalChildNodeFieldNameNotFound no containerField or field name found for the X3D JSON object. Check spelling of node.
> 
>    $elementName=Material, $parentName=Appearance

expected value for parent-child relationship is containerField='material'

>    Please report this error to x3d-public at web3d.org - thanks for your help improving X3D Quality Assurance (QA).
> 
> Error: IllegalChildNodeFieldNameNotFound no containerField or field name found for the X3D JSON object. Check spelling of node.
> 
>    $elementName=TimeSensor, DEF=TourTime, $parentName=Group

expected value for parent-child relationship is containerField='children'

>    Please report this error to x3d-public at web3d.org - thanks for your help improving X3D Quality Assurance (QA).
> 
> Error: IllegalChildNodeFieldNameNotFound no containerField or field name found for the X3D JSON object. Check spelling of node.
> 
>    $elementName=Script, DEF=MoveCylinder, $parentName=Group

expected value for parent-child relationship is containerField='children'

>    Please report this error to x3d-public at web3d.org - thanks for your help improving X3D Quality Assurance (QA).
> 
> Script DEF=MoveCylinder contains CDATA source-code text, copied as "#sourceText" using "strings" mode
> 
> So either X3dToJson.xslt is not ready for primetime, or it’s Saxon-JS 2.
> 
> Here are some of the output files:
> 
> $ grep -l IllegalChild *json2
> 
> abox.json2
> 
> app.json2
> 
> arc.json2
> 
> arc1.json2
> 
> arc2.json2
> 
> arc3.json2
> 
> arc4.json2
> 
> ArchHalf.json2
> 
> ArchPrototype.json2
> 
> arcold.json2
> 
> asmallbox.json2
> 
> ball.json2
> 
> BoxEm.json2
> 
> BoxManAnimationPanel.json2
> 
> bubble.json2
> 
> bubbles.json2
> 
> bubs.json2
> 
> bubs2.json2
> 
> bubs3.json2
> 
> CameraShape.json2
> 
> CoordinateAxes.json2
> 
> cube.json2
> 
> extrusion.json2
> 
> ExtrusionHeart.json2
> 
> F16.json2
> 
> flipp.json2
> 
> flower.json2
> 
> flower3.json2
> 
> flowerproto.json2
> 
> flowers.json2
> 
> flowers2.json2
> 
> flowers4.json2
> 
> force.json2
> 
> [snip]
> 
> What I will do next is investigate X3dToJson.xslt
> 
> Ttiab.
> 
> John

Wondering if your scenes have DOCTYPE (DTD) declarations in them? Is it correct?

* X3D Scene Authoring Hints, Validation of X3D Scenes using DTD and XML Schema
   https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#Validation

I think that the retrieved DOCTYPE is where saxon gets default containerField values from in the X3D Examples build.

If you (or other authors) don't want to include DOCTYPE, that is understandable (and of course allowed).  If this is the cause of the problem, then maybe we need to add containerField default values directly in this stylesheet (as well as a number of others).  Or maybe you want to add a local reference to DOCTYPE as part of your invocation.

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