BPMN2 export/serialization without xsi:Type [message #662787] |
Thu, 31 March 2011 22:48  |
Eclipse User |
|
|
|
I'm attempting to use MDT BPMN2 Eclipse to programmatically create a BMPN2 model and serialize it to xml, but I get unexpected output like:
<?xml version="1.0" encoding="ASCII"?>
<MODEL:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:DC="http://www.omg.org/spec/DD/20100524/DC" xmlns:DI="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:DI_1="http://www.omg.org/spec/DD/20100524/DI" xmlns:MODEL="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI-XMI" targetNamespace="_test">
<MODEL:rootElement xsi:type="bpmn2:tProcess" id="_model">
<MODEL:flowElement xsi:type="bpmn2:tStartEvent" id="_start"/>
</MODEL:rootElement>
<DI:BPMNDiagram name="Test Diagram">
<DI:BPMNPlane>
<DI_1:DiagramElement xsi:type="bpmndi:BPMNShape" bpmnElement="#_start">
<DC:Bounds height="20.0" width="20.0" x="20.0" y="20.0"/>
</DI_1:DiagramElement>
</DI:BPMNPlane>
</DI:BPMNDiagram>
</MODEL:definitions>
Where I would expect:
<?xml version="1.0" encoding="ASCII"?>
<MODEL:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:DC="http://www.omg.org/spec/DD/20100524/DC" xmlns:DI="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:DI_1="http://www.omg.org/spec/DD/20100524/DI" xmlns:MODEL="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI-XMI" targetNamespace="_test">
<MODEL:process id="_model">
<MODEL:startEvent id="_start"/>
</MODEL:process>
<DI:BPMNDiagram name="Test Diagram">
<DI:BPMNPlane>
<DI:BPMNShape bpmnElement="_start">
<DC:Bounds height="20.0" width="20.0" x="20.0" y="20.0"/>
</DI:BPMNShape>
</DI:BPMNPlane>
</DI:BPMNDiagram>
</MODEL:definitions>
Any idea on how to get rid of the xsi:type stuff?
This is the code I was using (Bpmn2Test.java):
package org.eclipse;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.bpmn2.Bpmn2Factory;
import org.eclipse.bpmn2.DocumentRoot;
import org.eclipse.bpmn2.Process;
import org.eclipse.bpmn2.StartEvent;
import org.eclipse.bpmn2.di.BPMNDiagram;
import org.eclipse.bpmn2.di.BPMNShape;
import org.eclipse.bpmn2.di.BpmnDiFactory;
import org.eclipse.bpmn2.di.impl.BpmnDiFactoryImpl;
import org.eclipse.bpmn2.impl.Bpmn2FactoryImpl;
import org.eclipse.bpmn2.util.Bpmn2ResourceFactoryImpl;
import org.eclipse.bpmn2.util.Bpmn2XMLProcessor;
import org.eclipse.dd.dc.Bounds;
import org.eclipse.dd.dc.DcFactory;
import org.eclipse.dd.dc.impl.DcFactoryImpl;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
public class Bpmn2Test {
private Bpmn2Factory bpmn2Factory = new Bpmn2FactoryImpl();
private BpmnDiFactory diFactory = new BpmnDiFactoryImpl();
private DcFactory dcFactory = new DcFactoryImpl();
public void createModel() throws IOException {
DocumentRoot documentRoot = bpmn2Factory.createDocumentRoot();
documentRoot = bpmn2Factory.createDocumentRoot();
documentRoot.setDefinitions(bpmn2Factory.createDefinitions());
documentRoot.getDefinitions().setTargetNamespace("_test");
//Create the process
Process process = bpmn2Factory.createProcess();
process.setId("_model");
documentRoot.getDefinitions().getRootElements().add(process);
//Create the diagram:
BPMNDiagram diagram = diFactory.createBPMNDiagram();
diagram.setPlane(diFactory.createBPMNPlane());
diagram.setName("Test Diagram");
documentRoot.getDefinitions().getDiagrams().add(diagram);
//Add a start event:
StartEvent start = bpmn2Factory.createStartEvent();
start.setId("_start");
process.getFlowElements().add(start);
//Toss it in the Diagram:
BPMNShape shape = diFactory.createBPMNShape();
Bounds bounds = dcFactory.createBounds();
bounds.setHeight(20);
bounds.setWidth(20);
bounds.setX(20);
bounds.setY(20);
shape.setBounds(bounds);
shape.setBpmnElement(start);
diagram.getPlane().getPlaneElement().add(shape);
//Serialize it:
save(documentRoot, System.out);
}
public void save(DocumentRoot model, OutputStream out) throws IOException {
Bpmn2ResourceFactoryImpl resourceFactory = new Bpmn2ResourceFactoryImpl();
File tempFile = File.createTempFile("bpmn20convert", "tmp");
try {
Resource resource = resourceFactory.createResource(URI.createFileURI(tempFile.getAbsolutePath()));
resource.getContents().add(model);
Bpmn2XMLProcessor proc = new Bpmn2XMLProcessor();
Map<Object, Object> options = new HashMap<Object, Object>();
proc.save(out, resource, options);
}
finally {
tempFile.delete();
}
}
public static final void main(String [] args) {
Bpmn2Test test = new Bpmn2Test();
try {
test.createModel();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Thanks!
|
|
|
Re: BPMN2 export/serialization without xsi:Type [message #662789 is a reply to message #662787] |
Thu, 31 March 2011 23:07   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------000901040908050404050005
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Colin,
I know nothing about BPMN2's definition but perhaps there are feature
maps and substitution groups involved. What leads you to expect
<MODEL:process id="_model"> rather than <MODEL:rootElement
xsi:type="bpmn2:tProcess" id="_model"> . Is there an element named
process of type "tProcess" that's in rootElement's substitution group?
If so, this XMLResource save option might help produce what you're
looking for
/**
* This option is used to specify an {@link ElementHandler} for
deducing the feature used to serialize a specific type of value.
* @see ElementHandler
* @since 2.4
*/
String OPTION_ELEMENT_HANDLER = "ELEMENT_HANDLER";
Otherwise, some PBMN2 expert will need to comment.
Colin MacNaughton wrote:
> I'm attempting to use MDT BPMN2 Eclipse to programmatically create a
> BMPN2 model and serialize it to xml, but I get unexpected output like:
>
>
> <?xml version="1.0" encoding="ASCII"?>
> <MODEL:definitions
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:DC="http://www.omg.org/spec/DD/20100524/DC"
> xmlns:DI="http://www.omg.org/spec/BPMN/20100524/DI"
> xmlns:DI_1="http://www.omg.org/spec/DD/20100524/DI"
> xmlns:MODEL="http://www.omg.org/spec/BPMN/20100524/MODEL"
> xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI"
> xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI-XMI"
> targetNamespace="_test">
> <MODEL:rootElement xsi:type="bpmn2:tProcess" id="_model">
> <MODEL:flowElement xsi:type="bpmn2:tStartEvent" id="_start"/>
> </MODEL:rootElement>
> <DI:BPMNDiagram name="Test Diagram">
> <DI:BPMNPlane>
> <DI_1:DiagramElement xsi:type="bpmndi:BPMNShape"
> bpmnElement="#_start">
> <DC:Bounds height="20.0" width="20.0" x="20.0" y="20.0"/>
> </DI_1:DiagramElement>
> </DI:BPMNPlane>
> </DI:BPMNDiagram>
> </MODEL:definitions>
>
>
>
> Where I would expect:
>
>
> <?xml version="1.0" encoding="ASCII"?>
> <MODEL:definitions
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:DC="http://www.omg.org/spec/DD/20100524/DC"
> xmlns:DI="http://www.omg.org/spec/BPMN/20100524/DI"
> xmlns:DI_1="http://www.omg.org/spec/DD/20100524/DI"
> xmlns:MODEL="http://www.omg.org/spec/BPMN/20100524/MODEL"
> xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI"
> xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI-XMI"
> targetNamespace="_test">
> <MODEL:process id="_model">
> <MODEL:startEvent id="_start"/>
> </MODEL:process>
> <DI:BPMNDiagram name="Test Diagram">
> <DI:BPMNPlane>
> <DI:BPMNShape bpmnElement="_start">
> <DC:Bounds height="20.0" width="20.0" x="20.0" y="20.0"/>
> </DI:BPMNShape>
> </DI:BPMNPlane>
> </DI:BPMNDiagram>
> </MODEL:definitions>
>
>
> Any idea on how to get rid of the xsi:type stuff?
>
> This is the code I was using (Bpmn2Test.java):
>
> package org.eclipse;
>
> import java.io.File;
> import java.io.IOException;
> import java.io.OutputStream;
> import java.util.HashMap;
> import java.util.Map;
>
> import org.eclipse.bpmn2.Bpmn2Factory;
> import org.eclipse.bpmn2.DocumentRoot;
> import org.eclipse.bpmn2.Process;
> import org.eclipse.bpmn2.StartEvent;
> import org.eclipse.bpmn2.di.BPMNDiagram;
> import org.eclipse.bpmn2.di.BPMNShape;
> import org.eclipse.bpmn2.di.BpmnDiFactory;
> import org.eclipse.bpmn2.di.impl.BpmnDiFactoryImpl;
> import org.eclipse.bpmn2.impl.Bpmn2FactoryImpl;
> import org.eclipse.bpmn2.util.Bpmn2ResourceFactoryImpl;
> import org.eclipse.bpmn2.util.Bpmn2XMLProcessor;
> import org.eclipse.dd.dc.Bounds;
> import org.eclipse.dd.dc.DcFactory;
> import org.eclipse.dd.dc.impl.DcFactoryImpl;
> import org.eclipse.emf.common.util.URI;
> import org.eclipse.emf.ecore.resource.Resource;
>
>
> public class Bpmn2Test {
> private Bpmn2Factory bpmn2Factory = new Bpmn2FactoryImpl();
> private BpmnDiFactory diFactory = new BpmnDiFactoryImpl();
> private DcFactory dcFactory = new DcFactoryImpl();
>
> public void createModel() throws IOException {
> DocumentRoot documentRoot = bpmn2Factory.createDocumentRoot();
> documentRoot = bpmn2Factory.createDocumentRoot();
> documentRoot.setDefinitions(bpmn2Factory.createDefinitions() );
> documentRoot.getDefinitions().setTargetNamespace("_test");
> //Create the process
> Process process = bpmn2Factory.createProcess();
> process.setId("_model");
> documentRoot.getDefinitions().getRootElements().add(process) ;
> //Create the diagram:
> BPMNDiagram diagram = diFactory.createBPMNDiagram();
> diagram.setPlane(diFactory.createBPMNPlane());
> diagram.setName("Test Diagram");
> documentRoot.getDefinitions().getDiagrams().add(diagram);
> //Add a start event:
> StartEvent start = bpmn2Factory.createStartEvent();
> start.setId("_start");
> process.getFlowElements().add(start);
> //Toss it in the Diagram:
> BPMNShape shape = diFactory.createBPMNShape();
> Bounds bounds = dcFactory.createBounds();
> bounds.setHeight(20);
> bounds.setWidth(20);
> bounds.setX(20);
> bounds.setY(20);
> shape.setBounds(bounds);
> shape.setBpmnElement(start);
> diagram.getPlane().getPlaneElement().add(shape);
> //Serialize it:
> save(documentRoot, System.out);
> }
>
> public void save(DocumentRoot model, OutputStream out) throws
> IOException {
> Bpmn2ResourceFactoryImpl resourceFactory = new
> Bpmn2ResourceFactoryImpl();
> File tempFile = File.createTempFile("bpmn20convert", "tmp");
> try {
> Resource resource =
> resourceFactory.createResource(URI.createFileURI(tempFile.ge tAbsolutePath()));
>
> resource.getContents().add(model);
> Bpmn2XMLProcessor proc = new Bpmn2XMLProcessor();
> Map<Object, Object> options = new HashMap<Object, Object>();
>
> proc.save(out, resource, options);
> }
> finally {
> tempFile.delete();
> }
> }
>
> public static final void main(String [] args) {
> Bpmn2Test test = new Bpmn2Test();
> try {
> test.createModel();
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
>
> }
>
>
>
> Thanks!
--------------000901040908050404050005
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Colin,<br>
<br>
I know nothing about BPMN2's definition but perhaps there are feature
maps and substitution groups involved. What leads you to expect
<MODEL:process id="_model">
rather than <MODEL:rootElement xsi:type="bpmn2:tProcess"
id="_model">
.. Is there an element named process of type "tProcess" that's in
rootElement's substitution group? If so, this XMLResource save option
might help produce what you're looking for<br>
<blockquote><small> /**<br>
* This option is used to specify an {@link ElementHandler} for
deducing the feature used to serialize a specific type of value.<br>
* @see ElementHandler<br>
* @since 2.4<br>
*/<br>
String OPTION_ELEMENT_HANDLER = "ELEMENT_HANDLER";<br>
</small></blockquote>
Otherwise, some PBMN2 expert will need to comment.<br>
<br>
<br>
<br>
<br>
Colin MacNaughton wrote:
<blockquote cite="mid:in2vut$qjc$1@news.eclipse.org" type="cite">I'm
attempting to use MDT BPMN2 Eclipse to programmatically create a BMPN2
model and serialize it to xml, but I get unexpected output like:
<br>
<br>
<br>
<?xml version="1.0" encoding="ASCII"?>
<br>
<MODEL:definitions
xmlns:xsi=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
xmlns:DC=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/spec/DD/20100524/DC">"http://www.omg.org/spec/DD/20100524/DC"</a>
xmlns:DI=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/spec/BPMN/20100524/DI">"http://www.omg.org/spec/BPMN/20100524/DI"</a>
xmlns:DI_1=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/spec/DD/20100524/DI">"http://www.omg.org/spec/DD/20100524/DI"</a>
xmlns:MODEL=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/spec/BPMN/20100524/MODEL">"http://www.omg.org/spec/BPMN/20100524/MODEL"</a>
xmlns:bpmn2=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI">"http://www.omg.org/spec/BPMN/20100524/MODEL-XMI"</a>
xmlns:bpmndi=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/spec/BPMN/20100524/DI-XMI">"http://www.omg.org/spec/BPMN/20100524/DI-XMI"</a>
targetNamespace="_test">
<br>
<MODEL:rootElement xsi:type="bpmn2:tProcess" id="_model">
<br>
<MODEL:flowElement xsi:type="bpmn2:tStartEvent" id="_start"/>
<br>
</MODEL:rootElement>
<br>
<DI:BPMNDiagram name="Test Diagram">
<br>
<DI:BPMNPlane>
<br>
<DI_1:DiagramElement xsi:type="bpmndi:BPMNShape"
bpmnElement="#_start">
<br>
<DC:Bounds height="20.0" width="20.0" x="20.0" y="20.0"/>
<br>
</DI_1:DiagramElement>
<br>
</DI:BPMNPlane>
<br>
</DI:BPMNDiagram>
<br>
</MODEL:definitions>
<br>
<br>
<br>
<br>
Where I would expect:
<br>
<br>
<br>
<?xml version="1.0" encoding="ASCII"?>
<br>
<MODEL:definitions
xmlns:xsi=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
xmlns:DC=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/spec/DD/20100524/DC">"http://www.omg.org/spec/DD/20100524/DC"</a>
xmlns:DI=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/spec/BPMN/20100524/DI">"http://www.omg.org/spec/BPMN/20100524/DI"</a>
xmlns:DI_1=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/spec/DD/20100524/DI">"http://www.omg.org/spec/DD/20100524/DI"</a>
xmlns:MODEL=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/spec/BPMN/20100524/MODEL">"http://www.omg.org/spec/BPMN/20100524/MODEL"</a>
xmlns:bpmn2=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI">"http://www.omg.org/spec/BPMN/20100524/MODEL-XMI"</a>
xmlns:bpmndi=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/spec/BPMN/20100524/DI-XMI">"http://www.omg.org/spec/BPMN/20100524/DI-XMI"</a>
targetNamespace="_test">
<br>
<MODEL:process id="_model">
<br>
<MODEL:startEvent id="_start"/>
<br>
</MODEL:process>
<br>
<DI:BPMNDiagram name="Test Diagram">
<br>
<DI:BPMNPlane>
<br>
<DI:BPMNShape bpmnElement="_start">
<br>
<DC:Bounds height="20.0" width="20.0" x="20.0" y="20.0"/>
<br>
</DI:BPMNShape>
<br>
</DI:BPMNPlane>
<br>
</DI:BPMNDiagram>
<br>
</MODEL:definitions>
<br>
<br>
<br>
Any idea on how to get rid of the xsi:type stuff?
<br>
<br>
This is the code I was using (Bpmn2Test.java):
<br>
<br>
package org.eclipse;
<br>
<br>
import java.io.File;
<br>
import java.io.IOException;
<br>
import java.io.OutputStream;
<br>
import java.util.HashMap;
<br>
import java.util.Map;
<br>
<br>
import org.eclipse.bpmn2.Bpmn2Factory;
<br>
import org.eclipse.bpmn2.DocumentRoot;
<br>
import org.eclipse.bpmn2.Process;
<br>
import org.eclipse.bpmn2.StartEvent;
<br>
import org.eclipse.bpmn2.di.BPMNDiagram;
<br>
import org.eclipse.bpmn2.di.BPMNShape;
<br>
import org.eclipse.bpmn2.di.BpmnDiFactory;
<br>
import org.eclipse.bpmn2.di.impl.BpmnDiFactoryImpl;
<br>
import org.eclipse.bpmn2.impl.Bpmn2FactoryImpl;
<br>
import org.eclipse.bpmn2.util.Bpmn2ResourceFactoryImpl;
<br>
import org.eclipse.bpmn2.util.Bpmn2XMLProcessor;
<br>
import org.eclipse.dd.dc.Bounds;
<br>
import org.eclipse.dd.dc.DcFactory;
<br>
import org.eclipse.dd.dc.impl.DcFactoryImpl;
<br>
import org.eclipse.emf.common.util.URI;
<br>
import org.eclipse.emf.ecore.resource.Resource;
<br>
<br>
<br>
public class Bpmn2Test {
<br>
private Bpmn2Factory bpmn2Factory = new Bpmn2FactoryImpl();
<br>
private BpmnDiFactory diFactory = new BpmnDiFactoryImpl();
<br>
private DcFactory dcFactory = new DcFactoryImpl();
<br>
<br>
public void createModel() throws IOException {
<br>
DocumentRoot documentRoot = bpmn2Factory.createDocumentRoot();
<br>
documentRoot = bpmn2Factory.createDocumentRoot();
<br>
documentRoot.setDefinitions(bpmn2Factory.createDefinitions() );
<br>
documentRoot.getDefinitions().setTargetNamespace("_test");
<br>
//Create the process
<br>
Process process = bpmn2Factory.createProcess();
<br>
process.setId("_model");
<br>
documentRoot.getDefinitions().getRootElements().add(process) ;
<br>
//Create the diagram:
<br>
BPMNDiagram diagram = diFactory.createBPMNDiagram();
<br>
diagram.setPlane(diFactory.createBPMNPlane());
<br>
diagram.setName("Test Diagram");
<br>
documentRoot.getDefinitions().getDiagrams().add(diagram);
<br>
//Add a start event:
<br>
StartEvent start = bpmn2Factory.createStartEvent();
<br>
start.setId("_start");
<br>
process.getFlowElements().add(start);
<br>
//Toss it in the Diagram:
<br>
BPMNShape shape = diFactory.createBPMNShape();
<br>
Bounds bounds = dcFactory.createBounds();
<br>
bounds.setHeight(20);
<br>
bounds.setWidth(20);
<br>
bounds.setX(20);
<br>
bounds.setY(20);
<br>
shape.setBounds(bounds);
<br>
shape.setBpmnElement(start);
<br>
diagram.getPlane().getPlaneElement().add(shape);
<br>
//Serialize it:
<br>
save(documentRoot, System.out);
<br>
}
<br>
<br>
public void save(DocumentRoot model, OutputStream out) throws
IOException {
<br>
Bpmn2ResourceFactoryImpl resourceFactory = new
Bpmn2ResourceFactoryImpl();
<br>
File tempFile = File.createTempFile("bpmn20convert", "tmp");
<br>
try {
<br>
Resource resource =
resourceFactory.createResource(URI.createFileURI(tempFile.ge tAbsolutePath()));
<br>
resource.getContents().add(model);
<br>
Bpmn2XMLProcessor proc = new Bpmn2XMLProcessor();
<br>
Map<Object, Object> options = new HashMap<Object,
Object>();
<br>
<br>
proc.save(out, resource, options);
<br>
}
<br>
finally {
<br>
tempFile.delete();
<br>
}
<br>
}
<br>
<br>
public static final void main(String [] args) {
<br>
Bpmn2Test test = new Bpmn2Test();
<br>
try {
<br>
test.createModel();
<br>
} catch (IOException e) {
<br>
// TODO Auto-generated catch block
<br>
e.printStackTrace();
<br>
}
<br>
}
<br>
<br>
}
<br>
<br>
<br>
<br>
Thanks!
<br>
</blockquote>
</body>
</html>
--------------000901040908050404050005--
|
|
|
Re: BPMN2 export/serialization without xsi:Type [message #662840 is a reply to message #662787] |
Fri, 01 April 2011 07:57   |
Eclipse User |
|
|
|
Hello Colin,
using your example with our current HEAD from git.eclipse.org/gitroot/bpmn2, I get the following result, which is still not valid (because the namespace prefixes are bound to the XMI namespaces instead of the XML namespaces), but a little closer to what you expected - what version are you using?
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions
xmlns="_test" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI-XMI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC-XMI" id="_Y2bvYVw0EeCw0pdrns_3qg"
targetNamespace="_test">
<bpmn2:process id="_model">
<bpmn2:startEvent id="_start"/>
</bpmn2:process>
<bpmndi:BPMNDiagram id="_Y2bvYlw0EeCw0pdrns_3qg" name="Test Diagram">
<bpmndi:BPMNPlane id="_Y2bvY1w0EeCw0pdrns_3qg">
<bpmndi:BPMNShape id="_Y2bvZFw0EeCw0pdrns_3qg" bpmnElement="_start">
<dc:Bounds height="20.0" width="20.0" x="20.0" y="20.0"/>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
The incorrect namespaces are due to a bug in the Bpmn2XMLProcessor (soon to be fixed). If you instead use resource.save(...), you should get the following valid output:
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns="_test" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="_7qY2gVw0EeC3ct8EY-Z0pA" targetNamespace="_test">
<bpmn2:process id="_model">
<bpmn2:startEvent id="_start"/>
</bpmn2:process>
<bpmndi:BPMNDiagram id="_7qY2glw0EeC3ct8EY-Z0pA" name="Test Diagram">
<bpmndi:BPMNPlane id="_7qY2g1w0EeC3ct8EY-Z0pA">
<bpmndi:BPMNShape id="_7qY2hFw0EeC3ct8EY-Z0pA" bpmnElement="_start">
<dc:Bounds height="20.0" width="20.0" x="20.0" y="20.0"/>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
Hope that helps,
Henning
PS: Bpmn2XMLProcessor should be fixed with http://git.eclipse.org/c/bpmn2/commit/?id=e722dc115b026e4621 41e20eed2613b8fa75be7b - thanks for reporting this!
[Updated on: Fri, 01 April 2011 08:09] by Moderator Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03545 seconds