[x3d-public] Released to the Public Domain--How to configure Schematron in Java

John Carlson yottzumm at gmail.com
Wed Jul 30 10:39:41 PDT 2025


I’m staying away from X3D-Edit. But most people like IDEs. I hear Holger
has an X_ITE viewer in VSCode and CGE uses VSCode.  The developer mindshare
has gone to VSCode and vim/neovim.   You might be interested in fuzzy find
(fzf) for finding files in the terminal, zoxide for changing folders, and
of course emacs and neovim/vim have built in file browsing.  One can even
run a terminal in vim these days.

In the enterprise, IntelliJ has taken the Java market to Kotlin.  But yeah,
Java is the new COBOL, plenty of money to be made.  And the government
follows the enterprise, not open source, unless it’s Java. And Oracle has
Java in  the database, so you don’t have to run Apache.  Forget 2-tier
stuff, it doesn’t make sense.

Now that I have schematron in a terminal, I want results on standard output
of course.  What happens if I don’t specify a -tofile?

Note that I have been building Java to batch validate with
CommandLines.java.  Sure you can do it with <apply> in ant, but I can’t tab
complete an ant target in the terminal.  Or do you know something?

I will foray into NetBeans if something needs to be addressed in X3DJSAIL.
Are there easy ways to make stylesheets?

John

On Wed, Jul 30, 2025 at 12:08 PM Don Brutzman <don.brutzman at gmail.com>
wrote:

> Congratulations on configuring your system to run things differently.
>
> I do not expect that anyone else needs such gyrations since the
> stylesheets are included within the X3DJSAIL.4.0.full.jar file, and all
> paths are relative there.
>
> Once again the X3dSchematronValidityChecks.xslt is quite a large and
> complex construct - most rules have straightforward logic for what they are
> checking, but it uses XPath expressions to examine various nodes and fields
> in an X3D model for logical consistency and correctness.  There is no
> attempt to duplicate functionality provided by X3D XML Schema and DOCTYPE
> since they do a good job at validation of legal values already.  Summary of
> expressive power:
>
>    - X3D Resources, Quality Assurance (QA)
>
> X3D Quality Assurance (QA) identifies errors and warnings in order to make
>> X3D scene content more portable and reliable. Improved Quality Assurance
>> (QA) helps achieve intended results in X3D scenes and metadata.
>> This is important. providing high confidence that when 3D modeling errors
>> occur, they can be detected and then corrected. As a result, X3D models can
>> run in many different file formats and programming languages, equivalently
>> and correctly.
>>
>>    - X3D Validator <https://savage.nps.edu/X3dValidator> (currently only
>>    available within X3D-Edit) provides a server-based suite of tests to help
>>    ensure the quality of X3D scenes and metadata. Validation tests include:
>>
>>
>>    - XML header and DOCTYPE
>>    <https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#Validation> checking
>>    for correct document headers
>>
>>
>>    - Well-formed XML
>>    <https://en.wikipedia.org/wiki/XML#Well-formedness_and_error-handling> checking
>>    for syntactic correctness
>>
>>
>>    - X3D Specifications: Schema and DOCTYPE Validation
>>    <https://www.web3d.org/specifications> checking for valid X3D nodes,
>>    fields and values
>>
>>
>>    - X3D to ClassicVRML conversion
>>    <https://www.web3d.org/x3d/stylesheets/X3dToVrml97.xslt> checks a
>>    variety of legal X3D constructs
>>
>>
>>    - Regular expression (regex) checking
>>    <https://www.web3d.org/specifications/X3dRegularExpressions.html> (design
>>    discussion
>>    <https://www.web3d.org/pipermail/x3d-public_web3d.org/2012-March/001950.html>)
>>    for malformed floating-point numbers and excess leading zeros.
>>
>>
>>    - X3D Schematron
>>    <https://www.web3d.org/x3d/tools/schematron/X3dSchematron.html> rule
>>    checking verifies semantic correctness and completeness, detecting
>>    internal-consistency problems to help assure the quality and correctness of
>>    X3D scenes
>>
>>
>>    - X3D Tidy <https://www.web3d.org/x3d/stylesheets/X3dTidy.html> helps
>>    authors automatically correct fixable errors in X3D scenes.
>>
>>
>>    - X3D to XHTML conversion
>>    <https://www.web3d.org/x3d/stylesheets/X3dToXhtml.xslt> pretty-print
>>    listing to check online URL links, document ROUTE connections, and provide
>>    node tooltips
>>
>>
>>    - Support for .html/.xhtml pages containing X3DOM support for X3D
>>    models. Errors or warnings are provided as appropriate for experimental
>>    attributes and interspersed HTML elements.
>>
>>
>>    - X3D Validator is written in Java using publicly available source
>>    code
>>    <https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/tools/X3dQualityAssurance/X3dValidator>
>>    .
>>
>>
>>    - Validation of ClassicVRML (.x3dv) and VRML97 (.wrl) output files
>>    can be performed using castle-model-viewer
>>    <https://castle-engine.io/castle-model-converter> in command-line
>>    mode.
>>
>>
>    -
>    https://www.web3d.org/x3d/content/examples/X3dResources.html#QualityAssurance
>
> Yes the operation of X3D Schematron is relatively slow, since the 1MB
> ruleset get converted into a (gulp) 91MB stylesheet.
>
> The X3DJSAIL library is written in Java and uses Saxon for
> XLST operations, currently bundling the open-source "Home Edition"
> saxon-he-12.5.jar package.  In addition to Java, Saxon offers support for
> C#, C++, PHP, Python.
>
> A few years back, this work was using compiled stylesheets for improved
> performance.  However that capability got split out into the Saxon
> Enterprise Edition.  More information on compiled stylesheets is available
> at
>
>    - Saxonica > Saxon > Using XSLT > Compiled Stylesheets
>    -
>    https://www.saxonica.com/documentation12/index.html#!using-xsl/compiling
>    - "With Saxon-EE it is also possible to export the compiled form of a
>    stylesheet as an XML file (called the stylesheet export file), in much the
>    same way that object code from other languages is saved to filestore, and
>    distributed from developers to users."
>
> I will not be integrating commercially licensed packages into X3DJSAIL,
> keeping it a fully open-source package.  You and others are of course
> welcome to do what you want.
>
> Incidentally have noticed that latest version of Saxon is 12.8.  Will
> upgrade, this affects a number of projects.
>
> Have fun with X3D Schematron!
>
> all the best, Don
>
>
> On Wed, Jul 30, 2025 at 7:26 AM John Carlson via x3d-public <
> x3d-public at web3d.org> wrote:
>
>> Add to your X3DJSAIL.properties file in your CLASSPATH
>>
>>
>> STYLESHEET_X3DSCHEMATRON_SVRLREPORT="../lib/stylesheets/SvrlReportText.xslt";
>>
>> STYLESHEET_X3DSCHEMATRON="../lib/stylesheets/X3dSchematronValidityChecks.xslt";
>>
>> Pick the correct paths you wish.
>>
>> In CoderSchematron.java
>>
>> import org.web3d.x3d.jsail.CommandLine;
>>
>> public class CoderSchematron {
>>         public static void main(String args[]) {
>>                 for (int a = 0; a < args.length; a++) {
>>                         try {
>>                                 String source = args[a];
>>                                 org.web3d.x3d.jsail.CommandLine.main(new
>> String[] {
>>                                         "-schematron",
>>                                         source,
>>                                         "-tofile",
>>                                         source+".new.schematron.txt"
>>                                 });
>>                         } catch (Exception e) {
>>                                 e.printStackTrace();
>>                         }
>>                 }
>>         }
>> }
>>
>> Compile:
>>
>> > javac -cp '.;X3DJSAIL.4.0.jar' CoderSchematron.java   # windows
>>
>> run!
>>
>> > java -cp '.;X3DJSAIL.4.0.jar' CoderSchematron file1.x3d file2.x3d
>> file3.x3d
>>
>> Pickup results in file1.x3d.new.schematron.txt
>> file2.x3d.new.schematron.txt file3.x3d.new.schematron.txt
>>
>> Great!  It's still slow as molasses.  Maybe we can try compiled
>> stylesheets?
>>
>> Thanks!
>>
>> John
>>
> _______________________________________________
>> x3d-public mailing list
>> x3d-public at web3d.org
>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20250730/c96ef3cf/attachment.html>


More information about the x3d-public mailing list