Skip to content

fugerit79/venus-sample-validating-source

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

venus-sample-validating-source

Venus Fugerit Doc sample showing how to validate source documents

Keep a Changelog v1.1.0 badge Quality Gate Status Coverage License: MIT code of conduct

This project is part of a series of mini tutorial on Venus Fugerit Doc, here you can find the other tutorials.

Requirement

  • JDK 8+ (*)
  • Maven 3.8+

Quickstart

This is a sample project configured using fj-doc-maven-plugin init plugin.

flavour : vanilla

Creation command :

mvn org.fugerit.java:fj-doc-maven-plugin:8.16.5:init \
-DgroupId=org.fugerit.java.demo \
-DartifactId=venus-sample-validating-source \
-Dextensions=base,freemarker \
-Dflavour=vanilla

Adding source document validation

When writing a Venus Fugerit Doc source document :

<row><para>This element is not allowed this</para>
    <cell><para>Luthien</para></cell>
    <cell><para>Tinuviel</para></cell>
    <cell><para>Queen</para></cell>
</row>

It is possible to validate the XML source document by adding validating and/or failOnValidate properties to freemarker-doc-process-config :

<freemarker-doc-process-config
        xmlns="https://freemarkerdocprocess.fugerit.org"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="https://freemarkerdocprocess.fugerit.org https://www.fugerit.org/data/java/doc/xsd/freemarker-doc-process-1-0.xsd"
        validating="true"
        failOnValidate="true">

This will print validation information (and eventually fail if failOnValidate is set to true) :

[main] WARN org.fugerit.java.doc.freemarker.process.DocInputProcess - DocValidationResult failed!, errors : 2
[main] WARN org.fugerit.java.doc.freemarker.process.DocInputProcess - Validation error 0, org.xml.sax.SAXParseException; lineNumber: 39; columnNumber: 28; cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://javacoredoc.fugerit.org":para}'. One of '{"http://javacoredoc.fugerit.org":cell}' is expected.
[main] WARN org.fugerit.java.doc.freemarker.process.DocInputProcess - Validation error 1, org.xml.sax.SAXParseException; lineNumber: 44; columnNumber: 28; cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://javacoredoc.fugerit.org":para}'. One of '{"http://javacoredoc.fugerit.org":cell}' is expected.

Here are the resources we modified for this example :

NOTE: the printed errors are related to the XML source after FreeMarker template processing.

About

Venus Fugerit Doc sample showing how to validate source documents

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published