[x3d-public] potential error in X3dToJava.xslt (setLang not called for meta statements.
John Carlson
yottzumm at gmail.com
Fri Nov 19 15:55:58 PST 2021
Okay, I also confirmed that in my setup. I apologize for missing your
prior message.
Unless X3dToJava.xslt is not supposed to list default attributes (it
still produced the code directly below, on an edited, new Teapot.x3d,
with '' as a meta,lang attribute value), we're good. If the default is
NULL, my guess is the X3dToJava.xslt stylesheet is correct.
I haven't found any way to suppressing default lang values in
X3dToJava.xslt or X3dToPython.xslt Other conversions appear successful.
Here's the test code I used:
<meta content='Teapot.x3d' name='title' lang=''/>
I was getting a lot of errors with the Java code, we may want to address
coding style for autogenerated code.
Cofirmation that Teapot.py generated contains lang:
meta(content='Teapot.x3d',name='title',lang=''),
Confirmation that Teapot.java generated contains xml:lang:
.addMeta(new meta().setName(meta.NAME_TITLE ).setContent("Teapot.x3d")/*
xml:lang='' */)
John
On 11/19/21 17:33, Brutzman, Donald (Don) (CIV) wrote:
>
> Sure, have fun. As (hopefully) communicated earlier in the week,
> current experimental way of handling xml:lang in Java is the inserted
> comment
>
> .someInvcation("")/* xml:lang='' */.anotherInvocation("")
>
> Java comments are not persistent, of course. This experimental
> commenting is likely to go away, if we indeed conclude next week that
> the XML-only attribute xml:lang=’EN’ is not something we want to
> encourage.
>
> 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
>
> *From:*John Carlson <yottzumm at gmail.com>
> *Sent:* Friday, November 19, 2021 2:05 PM
> *To:* Brutzman, Donald (Don) (CIV) <brutzman at nps.edu>
> *Cc:* X3D Graphics public mailing list <x3d-public at web3d.org>
> *Subject:* Re: potential error in X3dToJava.xslt (setLang not called
> for meta statements.
>
> NPS WARNING: *external sender* verify before acting.
>
> Here's the Teapot.java I was referring to:
> https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/java/net/x3djsonld/data/Teapot.java
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcoderextreme%2FX3DJSONLD%2Fblob%2Fmaster%2Fsrc%2Fmain%2Fjava%2Fnet%2Fx3djsonld%2Fdata%2FTeapot.java&data=04%7C01%7Cbrutzman%40nps.edu%7Cf1103a63e2b14940b58708d9aba8a973%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637729564199121629%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=qHGe%2BAuIhpImUbqicGZG5JZc%2FeSehQdFRYEfs2hvytY%3D&reserved=0>.
>
> I verified my in email was a git diff. The filenames are in the first
> few lines.
>
> I will look for updates.
>
> Parallel to your code, my checked in Teapot.java, created with
> stylesheets, looks like:
>
> .setDir("").setHttp_equiv("")/*
>
> xml:lang='' */.setScheme(""))
>
> I will look further into your referenced build.xml, I'm looking more
> for how to do more than one file (validating with Java) *and* do to do
> a single file validator. I already have code to do Saxon stuff.
>
> I have one more comment below.
>
> John
>
> On 11/19/21 03:56, Brutzman, Donald (Don) (CIV) wrote:
>
> Thanks for report. Not sure what change or problem you are
> reporting however. Further you mention Teapot but then show
> another example, Mooring Buoy. Hmmm.
>
> I suspect that you are getting things like
> setDir("").setHttp_equiv("").setLang("").setScheme("") because you
> do not have Saxon invocation set to strip default attribute values.
>
> Excerpt from
> https://x3dgraphics.com/examples/X3dForAdvancedModeling/build.xml
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fx3dgraphics.com%2Fexamples%2FX3dForAdvancedModeling%2Fbuild.xml&data=04%7C01%7Cbrutzman%40nps.edu%7Cf1103a63e2b14940b58708d9aba8a973%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637729564199131586%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=BHTDyCJajRXO%2F4EtUBSpyrfhUgXH1fz4GQe3GEihPVc%3D&reserved=0>
> showing invocation parameters
>
> <!-- process individual files here. show
> full path to facilitate user loading, editing of reported files -->
>
> <echo>${archive.path}/${relative.path1}/${relative.path2}/${name.short}.x3d
> converted to ${name.short}.java</echo>
>
> <!-- Saxon10 is locally defined macro -->
>
> <Saxon10
> scene="${relative.path1}/${relative.path2}/${name.short}"
>
> stylesheet="${stylesheet.dir}/X3dToJava"
>
> parameterPair1="packageName=${archive.name}.${relative.path1}${relative.path2}"
>
> parameterPair2= "className=${name.short}"
>
> parameterPair3="includeLicense=true"
>
> suffix=""
>
> extension="java"
>
> expand="on"/>
>
> <!-- expand:on since DTD defaults needed -->
>
> <!-- <echo message="... compiling
> ${name.short}.java"/> -->
>
> <javac srcdir="${relative.path1}/${relative.path2}/"
>
> includes="${name.short}.java"
>
> classpath="${x3djsail.stylesheets.dir}/${jsai.full.archive.jar.name}"
>
> destdir="${java.classes.dir}"
>
> debug="on"
>
> source="${java.source}"
>
> target="${java.target}"
>
> verbose="${javac.verbose}"
>
> failonerror="false"
>
> includeantruntime="false">
>
> Anyway I’m not seeing what your seeing, here is my local test of
> Teapot:
>
> •
> https://x3dgraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/TeapotIndex.html
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fx3dgraphics.com%2Fexamples%2FX3dForAdvancedModeling%2FGeometricShapes%2FTeapotIndex.html&data=04%7C01%7Cbrutzman%40nps.edu%7Cf1103a63e2b14940b58708d9aba8a973%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637729564199131586%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=G9uQ4DImongsN10uwh%2F8UkXkhGGb9YJfQGUu0xC38C0%3D&reserved=0>
>
> •
> https://x3dgraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/TeapotIndex.x3d
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fx3dgraphics.com%2Fexamples%2FX3dForAdvancedModeling%2FGeometricShapes%2FTeapotIndex.x3d&data=04%7C01%7Cbrutzman%40nps.edu%7Cf1103a63e2b14940b58708d9aba8a973%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637729564199141544%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2B6EdtOQKsR8%2FLJ8A%2Fi51dbOUsMCrpzzBhRbC6tgmDBs%3D&reserved=0>
>
> •
> https://x3dgraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/TeapotIndex.java
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fx3dgraphics.com%2Fexamples%2FX3dForAdvancedModeling%2FGeometricShapes%2FTeapotIndex.java&data=04%7C01%7Cbrutzman%40nps.edu%7Cf1103a63e2b14940b58708d9aba8a973%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637729564199141544%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=owsSQhAhkIjqfN%2BAV5cIwivsrFMXtI%2FrRJ4J6gFEyCE%3D&reserved=0>
>
> I'm seeing TeapotIndex.java here, and Teapot.java below. Please clarify.
>
> ant -f
> C:\\x3d-code\\www.web3d.org\\x3d\\content\\examples\\X3dForAdvancedModeling
> <http://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling>
> processScenes.java
>
> clean.RoundTrip:
>
> ensuring any prior converted *RoundTrip*.* source files are
> cleaned out...
>
> processScenes.java:
>
> Verifying Apache Ant XML Catalog resolver classpath:
> C:\apache-ant-1.10.11\lib/xml-resolver-1.2.jar (84091 bytes)
>
> versions:
>
> ant -version
>
> Apache Ant(TM) version 1.10.11 compiled on July 10 2021
>
> java -version
>
> openjdk version "16" 2021-03-16
>
> OpenJDK Runtime Environment (build 16+36-2231)
>
> OpenJDK 64-Bit Server VM (build 16+36-2231, mixed mode, sharing)
>
> python -version
>
> Python 3.9.7
>
> saxon -? help
>
> Saxon-HE 10.6J from Saxonica
>
> Usage: see
> http://www.saxonica.com/documentation/index.html#!using-xsl/commandline
> <https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.saxonica.com%2Fdocumentation%2Findex.html%23!using-xsl%2Fcommandline&data=04%7C01%7Cbrutzman%40nps.edu%7Cf1103a63e2b14940b58708d9aba8a973%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637729564199151499%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=EQhogT8lv8%2BrtbOrX0yTVWMRP9KKHUs3Q%2FNfzirAiEc%3D&reserved=0>
>
> Format: net.sf.saxon.Transform options params
>
> Options available: -? -a -catalog -config -cr -diag -dtd -ea
> -expand -explain -export -ext -im -init -it -jit -l -lib -license
> -m -nogo -now -ns -o -opt -or -outval -p -quit -r -relocate
> -repeat -s -sa -scmin -strip -t -T -target -TB -threads -TJ
> -Tlevel -Tout -TP -traceout -tree -u -val -versionmsg -warnings -x
> -xi -xmlversion -xsd -xsdversion -xsiloc -xsl -y --?
>
> Use -XYZ:? for details of option XYZ
>
> Params:
>
> param=value Set stylesheet string parameter
>
> +param=filename Set stylesheet document parameter
>
> ?param=expression Set stylesheet parameter using XPath
>
> !param=value Set serialization parameter
>
> ANT_HOME=C:\apache-ant-1.10.11
>
> JAVA_HOME=C:\Program Files\Java\openjdk\jdk-16
>
> PYTHONHOME=C:\Program Files\Python39
>
> PYTHONPATH=C:\x3d-code\www.web3d.org\x3d\stylesheets\python\x3d
> <http://www.web3d.org/x3d/stylesheets/python/x3d>
>
> Check for X3DJSAIL ${jsail.full.archive.jar.name} or
> X3DJSAIL.4.0.classes.jar
>
> CLASSPATH=C:\x3d-code\www.web3d.org\x3d\stylesheets\java\jars\X3DJSAIL.4.0.full.jar
> <http://www.web3d.org/x3d/stylesheets/java/jars/X3DJSAIL.4.0.full.jar>;
>
> javac source/target $java.source=1.8
>
> Java/JVM version $ant.java.version=16
>
> Java/JVM detail version $java.version=16
>
> Ant version $ant.version=Apache Ant(TM) version 1.10.11 compiled
> on July 10 2021
>
> Check for node.js installation from https://nodejs.org
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fnodejs.org%2F&data=04%7C01%7Cbrutzman%40nps.edu%7Cf1103a63e2b14940b58708d9aba8a973%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637729564199161459%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=NrqkhJjL5ATSQR2tJY%2FmeUaXsqnNrjKbUp8mTxC38s0%3D&reserved=0>
>
> v14.17.6
>
> lib/X3DJSAIL.4.0.full.jar -version
>
> X3DJSAIL version date: 12 October 2021
>
> Configuration settings: https://savage.nps.edu/Savage/developers.html
>
> ===========================================
>
> C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForAdvancedModeling/GeometricShapes//Teapot.x3d
> <http://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/GeometricShapes/Teapot.x3d>
> converted to Teapot.java
>
> Compiling 1 source file to
> C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForAdvancedModeling\classes
> <http://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/classes>
>
> now run and validate the java model
>
> java -classpath
> classes;../../../stylesheets/java/jars/X3DJSAIL.4.0.full.jar
> X3dForAdvancedModeling.GeometricShapes.Teapot
>
> Java program "X3dForAdvancedModeling.GeometricShapes.Teapot"
> self-validation test results: success
>
> ===================================
>
> echo.timestamp:
>
> timestamp 01:36:46 on 19 November 2021
>
> processScenes.java complete.
>
> BUILD SUCCESSFUL (total time: 5 seconds)
>
> 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
>
> *From:* John Carlson <yottzumm at gmail.com> <mailto:yottzumm at gmail.com>
> *Sent:* Thursday, November 18, 2021 2:31 AM
> *To:* Brutzman, Donald (Don) (CIV) <brutzman at nps.edu>
> <mailto:brutzman at nps.edu>; X3D Graphics public mailing list
> <x3d-public at web3d.org> <mailto:x3d-public at web3d.org>
> *Subject:* potential error in X3dToJava.xslt (setLang not called
> for meta statements.
>
> Before/after difference in Teapot.java.
>
> *diff --git a/src/main/java/net/x3djsonld/data/Teapot.java
> b/src/main/java/net/x3djsonld/data/Teapot.java*
> *index a9fdb5619..3ad954bd0 100644*
> *--- a/src/main/java/net/x3djsonld/data/Teapot.java*
> *+++ b/src/main/java/net/x3djsonld/data/Teapot.java*
> @@ -88,16 +88,16 @@public class Teapot
> {
> x3dModel = new
> X3D().setProfile(X3D.PROFILE_INTERCHANGE).setVersion(X3D.VERSION_3_0)
> .setHead(new head()
> - .addMeta(new meta().setName(meta.NAME_TITLE
> ).setContent("Teapot.x3d").setDir("").setHttp_equiv("").setLang("").setScheme(""))
> - .addMeta(new
> meta().setName(meta.NAME_DESCRIPTION).setContent("A mooring buoy
> used in Naval
> Harbors").setDir("").setHttp_equiv("").setLang("").setScheme(""))
> - .addMeta(new meta().setName(meta.NAME_CREATOR
> ).setContent("LT Patrick
> Sullivan").setDir("").setHttp_equiv("").setLang("").setScheme(""))
> - .addMeta(new meta().setName(meta.NAME_CREATED
> ).setContent("28 July
> 2006").setDir("").setHttp_equiv("").setLang("").setScheme(""))
> - .addMeta(new meta().setName(meta.NAME_MODIFIED
> ).setContent("12 January
> 2014").setDir("").setHttp_equiv("").setLang("").setScheme(""))
> - .addMeta(new meta().setName(meta.NAME_IDENTIFIER
> ).setContent("https://savage.nps.edu/Savage/HarborEquipment/Buoys/MooringBuoy.x3d"
> <https://savage.nps.edu/Savage/HarborEquipment/Buoys/MooringBuoy.x3d>).setDir("").setHttp_equiv(""
> ).setLang("").setScheme(""))
> - .addMeta(new meta().setName(meta.NAME_GENERATOR
> ).setContent("VizX3D, http://www.vivaty.com/downloads/studio
> <https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vivaty.com%2Fdownloads%2Fstudio&data=04%7C01%7Cbrutzman%40nps.edu%7Cf1103a63e2b14940b58708d9aba8a973%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637729564199161459%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=DVRDzLRhQlnbdPUiJMNbbcOgzeFTWD%2Fka%2F%2FYbKpbNRU%3D&reserved=0>").setDir("").setHttp_equiv("").setLang("").setSche
> me(""))
> - .addMeta(new meta().setName(meta.NAME_GENERATOR
> ).setContent("Wings3D, http://www.wings3d.com
> <https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.wings3d.com%2F&data=04%7C01%7Cbrutzman%40nps.edu%7Cf1103a63e2b14940b58708d9aba8a973%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637729564199171409%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=2nJQuOY35cNZtpP9BZJtS6KYIkLtmby8Qrk%2FTNIa4%2FE%3D&reserved=0>").setDir("").setHttp_equiv("").setLang("").setScheme(""))
> - .addMeta(new meta().setName(meta.NAME_GENERATOR
> ).setContent("X3D-Edit,
> https://savage.nps.edu/X3D-Edit").setDir("").setHttp_equiv("").setLang("").setScheme(""
> ))
> - .addMeta(new meta().setName(meta.NAME_LICENSE
> ).setContent("../../license.html").setDir("").setHttp_equiv("").setLang("").setScheme("")))
> + .addMeta(new meta().setName(meta.NAME_TITLE
> ).setContent("Teapot.x3d").setDir("").setHttp_equiv("")/*
> xml:lang='' */.setScheme(""))
> + .addMeta(new
> meta().setName(meta.NAME_DESCRIPTION).setContent("A mooring buoy
> used in Naval Harbors").setDir("").setHttp_equiv("")/* xml:lang=''
> */.setScheme(""
> ))
> + .addMeta(new meta().setName(meta.NAME_CREATOR
> ).setContent("LT Patrick
> Sullivan").setDir("").setHttp_equiv("")/* xml:lang=''
> */.setScheme(""))
> + .addMeta(new meta().setName(meta.NAME_CREATED
> ).setContent("28 July 2006").setDir("").setHttp_equiv("")/*
> xml:lang='' */.setScheme(""))
> + .addMeta(new meta().setName(meta.NAME_MODIFIED
> ).setContent("12 January 2014").setDir("").setHttp_equiv("")/*
> xml:lang='' */.setScheme(""))
> + .addMeta(new meta().setName(meta.NAME_IDENTIFIER
> ).setContent("https://savage.nps.edu/Savage/HarborEquipment/Buoys/MooringBuoy.x3d"
> <https://savage.nps.edu/Savage/HarborEquipment/Buoys/MooringBuoy.x3d>).setDir("").setHttp_equiv(""
> )/* xml:lang='' */.setScheme(""))
> + .addMeta(new meta().setName(meta.NAME_GENERATOR
> ).setContent("VizX3D, http://www.vivaty.com/downloads/studio
> <https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vivaty.com%2Fdownloads%2Fstudio&data=04%7C01%7Cbrutzman%40nps.edu%7Cf1103a63e2b14940b58708d9aba8a973%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637729564199171409%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=K%2FcgPheSXw1l%2F35QKP6mJjNSzNhyP3vzWU9tZc0g46A%3D&reserved=0>").setDir("").setHttp_equiv("")/*
> xml:lang='' */.se
> tScheme(""))
> + .addMeta(new meta().setName(meta.NAME_GENERATOR
> ).setContent("Wings3D, http://www.wings3d.com
> <https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.wings3d.com%2F&data=04%7C01%7Cbrutzman%40nps.edu%7Cf1103a63e2b14940b58708d9aba8a973%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637729564199181362%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kqacXNS%2B4ttWgAB0ZPmWEQfTxliZ%2B8yPqshfExzq8Ns%3D&reserved=0>").setDir("").setHttp_equiv("")/*
> xml:lang='' */.setScheme(""))
> + .addMeta(new meta().setName(meta.NAME_GENERATOR
> ).setContent("X3D-Edit,
> https://savage.nps.edu/X3D-Edit").setDir("").setHttp_equiv("")/*
> xml:lang='' */.setSche
> me(""))
> + .addMeta(new meta().setName(meta.NAME_LICENSE
> ).setContent("../../license.html").setDir("").setHttp_equiv("")/*
> xml:lang='' */.setScheme("")))
> .setScene(new Scene()
> .addChild(new Transform().setScale(0.3,0.3,0.3)
> .addChild(new Group("MooringBuoyWithHook")
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20211119/4d917699/attachment-0001.html>
More information about the x3d-public
mailing list