Skip to content

PROCEED working with xsd files

iaktern edited this page Mar 13, 2023 · 2 revisions

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

New: VS Code Addon "Xml Complete"

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

vscode-xml-addon

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

Testing the Validity of a process with the Schema

For testing the validity of a BPMN XML process, e.g. this one, with the XSD schema you have two possibilities:

1. Online tool (useful if XSD file is online)
    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"
2. Local validation in command line (useful for development)
  • install xmllint (libxml...) or xmlstarlet

    • unfortunately this tools have some problems:
      1. access the internet (BPMN online schemas) and
      2. don't support every XML element, e.g. schemaLocation (XML schema version only 1.0?)
      3. don't implement every XSD Type, e.g. ID
  • go into the dir docs/static/xsd of the xsd file: there are already the BPMN XSD files, a Test_BPMN_XML.bpmn file, the XSD-PROCEED.xsd and a XSD-TEST-Parent-File.xsd file

  • everything you want to change, test it directly in XSD-PROCEED.xsd and Test_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

Clone this wiki locally