-
Notifications
You must be signed in to change notification settings - Fork 9
PROCEED working with xsd files
A XSD file is a schema file for xml documents for semantic validation.
The current XML Schema file for PROCEEDs BPMN processes can be found in the doc repo under /static/xsd/XSD-PROCEED.xsd
or live here: https://docs.proceed-labs.org/xsd/XSD-PROCEED.xsd
For writing XSD files see this link: https://www.w3schools.com/XML/schema_intro.asp
-
Install: https://marketplace.visualstudio.com/items?itemName=rogalmic.vscode-xml-complete
-
it supports schema validation and autocompletion
- either with
xsi:schemaLocation="<namespace> <location>"
- or in VSCode config settings
- either with
-
still check with the old tools, because the Addon is not complete yet
-
Optional: install "XML Tools" Addon for getting an XML tree view
Configure Addon
- install and open settings.json, add:
"xmlComplete.schemaMapping": [
{
"xmlns": "http://www.omg.org/spec/BPMN/20100524/MODEL",
"xsdUri": "https://www.omg.org/spec/BPMN/20100501/BPMN20.xsd",
"strict": true // shows errors instead of tips
},
{
"xmlns": "http://www.omg.org/spec/BPMN/20100524/DI",
"xsdUri": "https://www.omg.org/spec/BPMN/20100501/BPMNDI.xsd",
"strict": true // shows errors instead of tips
},
{
"xmlns": "https://docs.proceed-labs.org/BPMN",
// "xsdUri": "https://docs.proceed-labs.org/xsd/XSD-PROCEED.xsd",
"xsdUri": "file:///home/PATH/TO/DOCUMENTATION/REPO/proceed-documentation-website/static/xsd/XSD-PROCEED.xsd",
"strict": true // shows errors instead of tips
},
{
"xmlns": "http://www.w3.org/2001/XMLSchema",
"xsdUri": "https://www.w3.org/2001/XMLSchema.xsd",
"strict": true // shows errors instead of tips
}
]
Supported URI protocols: data, file, ftp, http, https
Develop with Addon:
- the blue line at the closing
>
of an element shows the problems
Addon Problems:
- no namespace/prefix usage for attributes inside XML elements
- no imports => problem with BPMN XSD file because they import other files => in VS config the most important Semantic.xsd (contains most BPMN element definitions) is referenced, not BPMN20.xsd (i.e. there is no
definitions
element defined) - no reload of XSD file if it was changed
check big issue if complete: https://github.com/rogalmic/vscode-xml-complete/issues/18
For testing the validity of a BPMN XML process, e.g. this one, with the XSD schema you have two possibilities:
- Use https://www.freeformatter.com/xml-validator-xsd.html
- Paste the example XML into the XML Input
- XSD Input can be empty, but pay attention that
xsi:schemaLocation
is correctly included inside thedefinitions
element
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://docs.proceed-labs.org/BPMN https://docs.proceed-labs.org/xsd/XSD-PROCEED.xsd
http://www.omg.org/spec/BPMN/20100524/MODEL https://www.omg.org/spec/BPMN/20100501/BPMN20.xsd"
-
install
xmllint
(libxml...) orxmlstarlet
- unfortunately this tools have some problems:
- access the internet (BPMN online schemas) and
- don't support every XML element, e.g.
schemaLocation
(XML schema version only 1.0?) - don't implement every XSD Type, e.g. ID
- unfortunately this tools have some problems:
-
go into the dir
docs/static/xsd
of the xsd file: there are already the BPMN XSD files, aTest_BPMN_XML.bpmn
file, theXSD-PROCEED.xsd
and aXSD-TEST-Parent-File.xsd
file- the latter contains the
import
of the localBPMN_2_XSD-BPMN20.xsd
and theXSD-PROCEED.xsd
file, the online URLs inschemaLocation
are not used (not supported by this tools) - the BPMN XSD files are modified for strict evaluation (
processContents="lax"
attribute is removed)
- the latter contains the
-
everything you want to change, test it directly in
XSD-PROCEED.xsd
andTest_BPMN_XML.bpmn
-
run
xmlstarlet val --err --xsd XSD-TEST-Parent-File.xsd Test_BPMN_XML.bpmn
or
xmllint --schema XSD-TEST-Parent-File.xsd --noout Test_BPMN_XML.bpmn