2 Replies Latest reply on Jan 30, 2006 2:11 PM by fmuhlenberg

    Failure loading process definition

    fmuhlenberg

      I have run into a curious issue when loading a process definition using JpdlXmlReader.

      The Eclipse plugin generates a process definition where the XML (generally) looks like this:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition
       xmlns="http://jbpm.org/3/jpdl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://jbpm.org/3/jpdl http://jbpm.org/xsd/jpdl-3.0.xsd"
       name="AdministrativeData">
       <start-state name="start">
       <transition name="tr1" to="SaveXMLDocument"></transition>
       </start-state>
       <end-state name="end"></end-state>
       <node name="SaveXMLDocument">
       <transition name="tr1" to="end"></transition>
       <action class="workflow.action.SaveXMLDocument" config-type="bean"></action>
       </node>
      </process-definition>
      


      I get an exception when loading the above definition using this code:

       FileReader rdr = new FileReader(...);
       JpdlXmlReader jrdr = new JpdlXmlReader( rdr );
       ProcessDefinition pd = jrdr.getProcessDefinition();
       jbpms.getGraphSession().saveProcessDefinition(pd);
      


      However, if I either remove the XML schema information
      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition
       name="AdministrativeData">
       <start-state name="start">
       <transition name="tr1" to="SaveXMLDocument"></transition>
       </start-state>
       <end-state name="end"></end-state>
       <node name="SaveXMLDocument">
       <transition name="tr1" to="end"></transition>
       <action class="workflow.action.SaveXMLDocument" config-type="bean"></action>
       </node>
      </process-definition>
      


      -or-
      adjust the action tag ordering within the node
      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition
       xmlns="http://jbpm.org/3/jpdl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://jbpm.org/3/jpdl http://jbpm.org/xsd/jpdl-3.0.xsd"
       name="AdministrativeData">
       <start-state name="start">
       <transition name="tr1" to="SaveXMLDocument"></transition>
       </start-state>
       <end-state name="end"></end-state>
       <node name="SaveXMLDocument">
       <action class="workflow.action.SaveXMLDocument" config-type="bean"></action>
       <transition name="tr1" to="end"></transition>
       </node>
      </process-definition>
      


      the process definition is accepted without complaint.



        • 1. Re: Failure loading process definition
          aguizar

          You know the saying, "it is not a bug, but a feature". The DOM APIs let you read elements in any order, even if they are intermixed. The XML Schema validation is not that forgiving, tough.

          • 2. Re: Failure loading process definition
            fmuhlenberg


            I just thought I'd post what I found as I lost some time dealing with it. Maybe it will save someone else the trouble.

            The followup question, which doesn't need to be answered is: does this mean that there should be a bug listed against the eclipse plug-in for creating XML that doesn't pass validation?