[x3d-public] Possible issue with X3dToPython.xslt, newly tested file from X3D4WA: need x3d.py python support for Script CDATA

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Mon Jan 10 18:36:48 PST 2022


Thanks for the interesting trouble report John.

No changes needed to original X3D model, it passes all X3D Validator tests (though X3D Schematron provides a few warnings).

* https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulator.x3d
* https://savage.nps.edu/X3dValidator

XMLSpy was stricter about type handling than our Java-based Saxon10 conversions for this example.  XMLSpy diagnosed some problems that I fixed.

After also fixing the stylesheet name provided by a diagnostic, all X3dToPython.xslt changes were checked into subversion.

I now get the following conversion error:

=====================
create python:
C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors/Chapter14Prototypes//MaterialModulator.x3d processing with X3dToPython stylesheet...
*** TODO x3d.py and X3dToPython.xslt need to handle embedded CDATA source code for Script
C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors/Chapter14Prototypes//MaterialModulator.py self-validation tests...
validate python:
  File "C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\Chapter14Prototypes\MaterialModulator.py", line 74
    *** TODO x3d.py and X3dToPython.xslt need to handle embedded CDATA source code for Script
      ^
SyntaxError: invalid syntax
Result: 1
===================================

So, embedded CDATA scripting code inside a Script node (and similar Shader nodes) remains an omission in our Python support.

To remedy this, we need to create a special field in the X3DPSAIL class Script.  *What shall we call it?*  Creating a Script member named CDATA seems unambiguous and eponymous with the XML encoding...

* X3D Tooltips, Script and Script url
   https://www.web3d.org/x3d/tooltips/X3dTooltips.html#Script
   https://www.web3d.org/x3d/tooltips/X3dTooltips.html#Script.url

* X3D Tooltips, XML Data Types
   https://www.web3d.org/x3d/tooltips/X3dTooltips.html#XML

" CDATA is an XML term for Character Data. The base type for all XML attributes consists of string-based CDATA characters. CDATA is used throughout the X3D DOCTYPE definitions, which can only check for the presence of legal strings and thus are not able to validate numeric type information. XML Schema provides stricter validation based on data types."

* XML, 2.4 Character Data and Markup
   https://www.w3.org/TR/REC-xml/#syntax

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 https:// faculty.nps.edu/brutzman

-----Original Message-----
From: John Carlson <yottzumm at gmail.com> 
Sent: Monday, January 10, 2022 4:06 PM
To: Brutzman, Donald (Don) (CIV) <brutzman at nps.edu>; X3D Graphics public mailing list <x3d-public at web3d.org>
Subject: Possible issue with X3dToPython.xslt, newly tested file from X3D4WA

X3D XML file attached.  From X3DJSONLD's maven build log:

[INFO] --- xml-maven-plugin:1.0.2:transform (default) @ X3DJSONLD --- [INFO] Transforming file:
/home/coderextreme/X3DJSONLD/src/main/data/MaterialModulatorExamples.x3d
[INFO] Transforming file:
/home/coderextreme/X3DJSONLD/src/main/data/MaterialModulator.x3d
Type error at char 37 in xsl:value-of/@select on line 610 column 120 of
X3dToPython.xslt:
   XPTY0004: A sequence of more than one item is not allowed as the first argument of
   normalize-space() ("", "", ...)
   at xsl:apply-templates
(file:/home/coderextreme/X3DJSONLD/src/main/lib/stylesheets/X3dToPython.xslt#606)
      processing /X3D/Scene[1]/ProtoDeclare[1]/ProtoBody[1]/Script[1]
   at xsl:apply-templates
(file:/home/coderextreme/X3DJSONLD/src/main/lib/stylesheets/X3dToPython.xslt#606)
      processing /X3D/Scene[1]/ProtoDeclare[1]/ProtoBody[1]
   at xsl:apply-templates
(file:/home/coderextreme/X3DJSONLD/src/main/lib/stylesheets/X3dToPython.xslt#606)
      processing /X3D/Scene[1]/ProtoDeclare[1]
   at xsl:apply-templates
(file:/home/coderextreme/X3DJSONLD/src/main/lib/stylesheets/X3dToPython.xslt#606)
      processing /X3D/Scene[1]
   at xsl:apply-templates
(file:/home/coderextreme/X3DJSONLD/src/main/lib/stylesheets/X3dToPython.xslt#123)
      processing /X3D
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time:  2.840 s
[INFO] Finished at: 2022-01-10T17:59:22-06:00 [INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.codehaus.mojo:xml-maven-plugin:1.0.2:transform (default) on project
X3DJSONLD: Failed to transform input file
/home/coderextreme/X3DJSONLD/src/main/data/MaterialModulator.x3d: A sequence of more than one item is not allowed as the first argument of
normalize-space() ("", "", ...)  -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcwiki.apache.org%2Fconfluence%2Fdisplay%2FMAVEN%2FMojoExecutionException&data=04%7C01%7Cbrutzman%40nps.edu%7C4d9a56edbabc4fbf858a08d9d4961aad%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637774563580355600%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=cBka%2BtJaHGaPH8JvSi8ZcTKyJ57nZ3NK2AcO6G4ad4s%3D&reserved=0



More information about the x3d-public mailing list