rbeyer / pds4validate Goto Github PK
View Code? Open in Web Editor NEWPython-based validator for PDS4 XML labels.
License: BSD 3-Clause "New" or "Revised" License
Python-based validator for PDS4 XML labels.
License: BSD 3-Clause "New" or "Revised" License
I ran across this repo looking at hiproc. In general, I do simply recommend using the PDS Engineering supported validate routine. Not only does it check validation based using PDS4 schemas, but also has support for Schematron v2 rules (rare to find outside of commercial applications like Oxygen). Lastly, it has some extra validation for PDS4 and actually can look into the data files for simple testing (image or tables). Now that check can be turned off to speed things up.
Anyway, I have an old email (circa 2017) from Even R. when he first implemented PDS4 in GDAL which shows a trick method in GDAL to provide simple validation (not full Schematron v2 though). But he also located a free method to help with Schematron v2 as listed in the second section below. I have never tested that method and it seems like using several schema files would be problematic as the bash script is currently written. Anyway, if you are running JAVA for saxonb-xslt, you might as well run the PDS4 validate app.
[Trent] We don't plan for GDAL to have any sort of schema validation method, but what application do you use?
[Even] You can validate any XML document that references its schemas, like a PDS4 .xml label, using (or perhaps abusing !) the new GMLAS driver
For example:
ogrinfo GMLAS:PDS4_label_test.xml -oo VALIDATE=YES >/dev/null
windoze:
ogrinfo GMLAS:PDS4_label_test.xml -oo VALIDATE=YES > NUL
The first run will take some time, downloading schemas and caching them in ~/.gdal/gmlas_xsd_cache
. If the above command doesn't output anything, then the document validates. Underneath this is the Xerces-C validator which is used.
[Even] Note that Schematron validation is not done. As far as I could find, for open source software, there are only Java based solutions that can deal with Schematron v2.
On Ubuntu 16+,
sudo apt-get install libsaxonb-java
unzip it
create the following shell script validate.sh
#!/bin/sh
set -e
saxonb-xslt -s:$1 -xsl:iso_dsdl_include.xsl -o:stage1.sch
saxonb-xslt -s:stage1.sch -xsl:iso_abstract_expand.xsl -o:stage2.sch
saxonb-xslt -s:stage2.sch -xsl:iso_svrl_for_xslt2.xsl -o:test.xsl
saxonb-xslt -s:$2 -xsl:test.xsl -o:report.svrlt
cat report.svrlt
validate.sh your.sch PDS4_label_test.xml
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.