Plugin to validate XML files
Compile
- make clean
- make
- make test
Install
- copy jar-file to /operational_shared/plugins/custom/
Configuration
DTDs ....
- the plugin uses the XML-catalog file to validate DTD related XML files.
- the catalog file is specified via plugin settings (if no catalog entry exists an error is reported)
- the catalog file should be created/modified by
xmlcatalog
. - all paths in catalog file should be absolute
- for tests you could also use env XML_CATALOG_FILES
- please ensure, your catalog file is correct, you could test it with example
XML_CATALOG_FILES="$(pwd)/example_catalog/" xmlcatalog example_catalog/catalog "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.1 20151215//EN"
. Replace the last string with the corresponding publicID or systemID.
Schemas .......
- the plugin uses local schema files to validate schema/schematron/relaxng related XML files.
- the schema catalog file has following structure:
<?xml version="1.0" encoding="UTF-8"?>
<slubschemacatalog>
<entry schematype="schema" namespace="http://www.loc.gov/mods/v3" schemauri="http://www.loc.gov/standards/mods/v3/mods-3-8.xsd" />
<entry schematype="schema" namespace="http://www.lido-schema.org" schemauri="http://www.lido-schema.org/schema/v1.1/lido-v1.1.xsd" />
<entry schematype="schema" namespace="http://slubarchiv.slub-dresden.de/rights1" schemauri="https://slubarchiv.slub-dresden.de/fileadmin/groups/slubsite/slubarchiv/standards/rights/rights1.xsd" />
<entry schematype="schema" namespace="http://www.loc.gov/standards/alto/ns-v2#" schemauri="http://www.loc.gov/standards/alto/alto-v2.0.xsd" />
<entry schematype="nonvalidating" namespace="http://slub-dresden.de/" />
<entry schematype="nonvalidating" namespace="http://slub-dresden.de/slubarchiv" schemauri="nothing"/>
</slubschemacatalog>
- please ensure, that the 'schemauri' starts either with 'http://$server/', 'https://$server/' or 'file://localhost/'! For testing purposes relative URIs also supported.
- schematype "nonvalidating" does not need a schemauri attribute. If commited, it will be ignored
For a (german) introduction how to use it, check https://www.data2type.de/xml-xslt-xslfo/docbook/xml-kataloge
Namespace based Schema resolution
The schema resolution follows the rules:
- if schematype is "nonvalidating", the resourceresolver returns null, indicating the validator should ignore rules
- if schematype is "schema" and the baseuri is local and the associated systemid is defined, a combined url will be used, pE.
- baseUri = file:/tmp/xml_plugin4rosetta/example_catalog/mets-1.12.1/mets.xsd
- SystemId = http://www.loc.gov/standards/xlink/xlink.xsd
- combined: file:/home/romeyke/git/xml_plugin4rosetta/example_catalog/xlink-1.1/xlink.xsd
- if schematype is "schema" then the url of associated namespace will be used
Hint: in case of nonvalidating schemaurl should never be empty!
Copyright hints
see file LICENSE