Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BPMN Modeler » BPMN model validation(how to validate bpmn model xmi?)
BPMN model validation [message #536343] Thu, 27 May 2010 17:18 Go to next message
Giuseppe Ciulla is currently offline Giuseppe CiullaFriend
Messages: 3
Registered: November 2009
Junior Member
Hi,

I'm new in this forum.

I have to perform validation of .bpmn files with xml schema or in other way.

How can I do this?

I run this code:



	try {
      // define the type of schema - we use W3C:
      String schemaLang = "http://www.w3.org/2001/XMLSchema";

      // get validation driver:
      SchemaFactory factory = SchemaFactory.newInstance(schemaLang);

      // create schema by reading it from an XSD file:
      Schema schema = factory.newSchema(new StreamSource(new File("bpmnXMI.xsd")));
      Validator validator = schema.newValidator();

      // at last perform validation:
      validator.validate(new StreamSource(new File("bpmnModelTest.bpmn")));
      
    }catch (SAXException ex) {
      ex.printStackTrace();
    } catch (Exception ex) {
      ex.printStackTrace();
    }



and this is the result:


org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'xmi:version' is not allowed to appear in element 'bpmn:BpmnDiagram'.
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.jaxp.validation.StreamValidatorHelper.validate(Unknown Source)
	at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(Unknown Source)
	at javax.xml.validation.Validator.validate(Unknown Source)
	at it.eng.rspa.validator.Test.main(Test.java:33)



I generate "bpmnXMI.xsd" from the "bpmn.genmodel" by the command "Generator -> Export Model" and selecting "XML schema for XMI"

Thanks.
Giuseppe
Re: BPMN model validation [message #539439 is a reply to message #536343] Thu, 10 June 2010 17:47 Go to previous message
Antoine Toulmé is currently offline Antoine ToulméFriend
Messages: 31
Registered: July 2009
Member
1. Go ahead and use XMLUnit for your XML validation needs. It works well for me.

2. Not sure what you are trying to do - this bpmnXMI.xsd doesn't match the bpmn.xsd file name we use in the bpmn modeler.

Thanks,

Antoine
Previous Topic:Several Outgoing Edges
Next Topic:Cannot open diagrams with old version that were created by a new version
Goto Forum:
  


Current Time: Tue Mar 19 08:45:25 GMT 2024

Powered by FUDForum. Page generated in 0.02217 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top