使用 xsd.exe 或 xsd2code 反序列化复杂的 xsd 架构(包含用于继承的替换组元素)

发布于 2024-12-17 05:48:11 字数 4849 浏览 2 评论 0原文

我在反序列化/序列化某些 xsd 模式时遇到问题,特别是其中的替换组元素(替换组)。我想要做的是从 xsd 模式生成 C# 类,然后使用对象进行处理,然后将它们序列化为有效的 XML 格式。 我使用 xsd2code 或 xsd.exe 反序列化和序列化有 4 个 xsd 文件。这两种工具都会产生类似的令人不满意的结果。它们忽略“替换组”元素并且不会正确生成类成员。 例如,当我运行 xsd.exe 或 xsd2code 时,为 BPMNPlane 生成的 C# 类不包含成员 BPMNShape(但是 BPMNDiagram 类包含 BPMNPlane)。我尝试更改生成的 C# 类(例如添加成员/属性),但生成的 XML 输出不正确。我想人们可以使用 linq-to-xml 来掌握这一点,但它们有太多不同的元素,大约有 70 个,并且具有附加的属性。

<xsd:import namespace="http://www.omg.org/spec/DD/20100524/DC" schemaLocation="DC.xsd" />
<xsd:import namespace="http://www.omg.org/spec/DD/20100524/DI" schemaLocation="DI.xsd" />

<xsd:element name="BPMNDiagram" type="bpmndi:BPMNDiagram" />
<xsd:element name="BPMNPlane" type="bpmndi:BPMNPlane" />
<xsd:element name="BPMNLabelStyle" type="bpmndi:BPMNLabelStyle" />
<xsd:element name="BPMNShape" type="bpmndi:BPMNShape" substitutionGroup="di:DiagramElement" />
<xsd:element name="BPMNLabel" type="bpmndi:BPMNLabel" />
<xsd:element name="BPMNEdge" type="bpmndi:BPMNEdge" substitutionGroup="di:DiagramElement" />

<xsd:complexType name="BPMNDiagram">
    <xsd:complexContent>
        <xsd:extension base="di:Diagram">
            <xsd:sequence>
                <xsd:element ref="bpmndi:BPMNPlane" />
                <xsd:element ref="bpmndi:BPMNLabelStyle" maxOccurs="unbounded" minOccurs="0" />
            </xsd:sequence>
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>


<xsd:complexType name="BPMNPlane">
    <xsd:complexContent>
        <xsd:extension base="di:Plane">    
    <xsd:attribute name="bpmnElement" type="xsd:QName" />       
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="BPMNEdge">
    <xsd:complexContent>
        <xsd:extension base="di:LabeledEdge">
            <xsd:sequence>
                <xsd:element ref="bpmndi:BPMNLabel" minOccurs="0" />
            </xsd:sequence>
            <xsd:attribute name="bpmnElement" type="xsd:QName" />
            <xsd:attribute name="sourceElement" type="xsd:QName" />
            <xsd:attribute name="targetElement" type="xsd:QName" />
            <xsd:attribute name="messageVisibleKind" type="bpmndi:MessageVisibleKind" />
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>



<xsd:complexType name="BPMNShape">
    <xsd:complexContent>
        <xsd:extension base="di:LabeledShape">
            <xsd:sequence>
                <xsd:element ref="bpmndi:BPMNLabel" minOccurs="0" />
            </xsd:sequence>
            <xsd:attribute name="bpmnElement" type="xsd:QName" />
            <xsd:attribute name="isHorizontal" type="xsd:boolean" />
            <xsd:attribute name="isExpanded" type="xsd:boolean" />
            <xsd:attribute name="isMarkerVisible" type="xsd:boolean" />
            <xsd:attribute name="isMessageVisible" type="xsd:boolean" />
            <xsd:attribute name="participantBandKind" type="bpmndi:ParticipantBandKind" />
            <xsd:attribute name="choreographyActivityShape" type="xsd:QName"/>
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="BPMNLabel">
    <xsd:complexContent>
        <xsd:extension base="di:Label">
            <xsd:attribute name="labelStyle" type="xsd:QName" />
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="BPMNLabelStyle">
    <xsd:complexContent>
        <xsd:extension base="di:Style">
            <xsd:sequence>
                <xsd:element ref="dc:Font" />
            </xsd:sequence>
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>

<xsd:simpleType name="ParticipantBandKind">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="top_initiating" />
        <xsd:enumeration value="middle_initiating" />
        <xsd:enumeration value="bottom_initiating" />
        <xsd:enumeration value="top_non_initiating" />
        <xsd:enumeration value="middle_non_initiating" />
        <xsd:enumeration value="bottom_non_initiating" />
    </xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="MessageVisibleKind">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="initiating" />
        <xsd:enumeration value="non_initiating" />
    </xsd:restriction>
</xsd:simpleType>

我是新手,没有使用 xsd 或 linq-to-xml 的经验,但我认为这是处理强类型数据/对象的更好方法?

I have problems with deserializing/serializing some xsd schemas, specially with substitution group elements (substitutiongroup) within. What I want to do is to generate C# classes from xsd schemas, then handle with object and later serialize them into a valid XML format.
There are 4 xsd files which I deserialize and serialize with xsd2code or xsd.exe. Both tools generate similar unsatisfactory results. They ignore "substitutiongroup" elements and don't generate class members properly.
When i run xsd.exe or xsd2code the generated c# class for BPMNPlane for example don't contain a member BPMNShape(however BPMNDiagram class contain BPMNPlane). I tried to change the generated C# classes( e.g . add members/properties), but the generated XML output wasn't correct. I suppose one could master this with linq-to-xml, but they are too much different elements, approximately 70, with additional properties attributes.

<xsd:import namespace="http://www.omg.org/spec/DD/20100524/DC" schemaLocation="DC.xsd" />
<xsd:import namespace="http://www.omg.org/spec/DD/20100524/DI" schemaLocation="DI.xsd" />

<xsd:element name="BPMNDiagram" type="bpmndi:BPMNDiagram" />
<xsd:element name="BPMNPlane" type="bpmndi:BPMNPlane" />
<xsd:element name="BPMNLabelStyle" type="bpmndi:BPMNLabelStyle" />
<xsd:element name="BPMNShape" type="bpmndi:BPMNShape" substitutionGroup="di:DiagramElement" />
<xsd:element name="BPMNLabel" type="bpmndi:BPMNLabel" />
<xsd:element name="BPMNEdge" type="bpmndi:BPMNEdge" substitutionGroup="di:DiagramElement" />

<xsd:complexType name="BPMNDiagram">
    <xsd:complexContent>
        <xsd:extension base="di:Diagram">
            <xsd:sequence>
                <xsd:element ref="bpmndi:BPMNPlane" />
                <xsd:element ref="bpmndi:BPMNLabelStyle" maxOccurs="unbounded" minOccurs="0" />
            </xsd:sequence>
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>


<xsd:complexType name="BPMNPlane">
    <xsd:complexContent>
        <xsd:extension base="di:Plane">    
    <xsd:attribute name="bpmnElement" type="xsd:QName" />       
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="BPMNEdge">
    <xsd:complexContent>
        <xsd:extension base="di:LabeledEdge">
            <xsd:sequence>
                <xsd:element ref="bpmndi:BPMNLabel" minOccurs="0" />
            </xsd:sequence>
            <xsd:attribute name="bpmnElement" type="xsd:QName" />
            <xsd:attribute name="sourceElement" type="xsd:QName" />
            <xsd:attribute name="targetElement" type="xsd:QName" />
            <xsd:attribute name="messageVisibleKind" type="bpmndi:MessageVisibleKind" />
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>



<xsd:complexType name="BPMNShape">
    <xsd:complexContent>
        <xsd:extension base="di:LabeledShape">
            <xsd:sequence>
                <xsd:element ref="bpmndi:BPMNLabel" minOccurs="0" />
            </xsd:sequence>
            <xsd:attribute name="bpmnElement" type="xsd:QName" />
            <xsd:attribute name="isHorizontal" type="xsd:boolean" />
            <xsd:attribute name="isExpanded" type="xsd:boolean" />
            <xsd:attribute name="isMarkerVisible" type="xsd:boolean" />
            <xsd:attribute name="isMessageVisible" type="xsd:boolean" />
            <xsd:attribute name="participantBandKind" type="bpmndi:ParticipantBandKind" />
            <xsd:attribute name="choreographyActivityShape" type="xsd:QName"/>
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="BPMNLabel">
    <xsd:complexContent>
        <xsd:extension base="di:Label">
            <xsd:attribute name="labelStyle" type="xsd:QName" />
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="BPMNLabelStyle">
    <xsd:complexContent>
        <xsd:extension base="di:Style">
            <xsd:sequence>
                <xsd:element ref="dc:Font" />
            </xsd:sequence>
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>

<xsd:simpleType name="ParticipantBandKind">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="top_initiating" />
        <xsd:enumeration value="middle_initiating" />
        <xsd:enumeration value="bottom_initiating" />
        <xsd:enumeration value="top_non_initiating" />
        <xsd:enumeration value="middle_non_initiating" />
        <xsd:enumeration value="bottom_non_initiating" />
    </xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="MessageVisibleKind">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="initiating" />
        <xsd:enumeration value="non_initiating" />
    </xsd:restriction>
</xsd:simpleType>

I'm newbie and have not experience with xsd's or linq-to-xml, but I think it's the better approach to work with strongly typed data/objects?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

总攻大人 2024-12-24 05:48:11

首先,我对你的问题投了赞成票,因为它确实提出了一种罕见的情况 - 从有多少人传递它来判断,它也很难得到回答......这也意味着你必须做一些阅读:) ...

简短的答案是:xsd.exe 创建可用的代码;它可能不是你所期望的,我会解释原因,但它有效(至少在我的测试中);如果您在交换该 XML 时没有问题,那么就按照它的生成方式进行处理即可。如果没有的话,Linq 肯定可以工作。

因此,主要问题始于 XML 模式是如何编写的;考虑到它来自何处,我很惊讶地看到这种(感知到的)歧义创作风格,这最终也是 xsd.exe 似乎没有产生预期结果的原因。

请首先阅读本文,重点关注名为“抽象属性”和“替换组属性”的部分。

通常,替换组的头应该是一个抽象元素。虽然规范没有强制执行这一点,但我怀疑许多人在他们的工具中做出了这一假设(xsd.exe 就是其中之一),否则存在 @xsi:type 含糊不清的风险。

在 BPMN 模式中,替换组的头不是抽象的(我查看的那个);此外,用作替换组头的元素是抽象类型 - 这在 xsi:type 中循环。长话短说,如果您查看生成的代码,xsd.exe 通过选择使用或不使用 xsi:type; 来创建完全有效的代码;它与前者一致。

此代码引用 xsd.exe 生成的代码来创建简单的 XML。

BPMNEdge edge = new BPMNEdge();
edge.id = "B2";
// more code here for waypoint
plane.DiagramElement1 = new DiagramElement[] { edge };

DiagramElement1 属性基本上会采用从DiagramElement 类型派生的任何类型,基本上满足契约(并在生成的XML 中为您提供DiagramElement 的@xsi:type)。

下面的 XML 是有效的;我不知道制作DiagramElement 摘要是否可以解决您的问题...我认为事情不会那么简单,但我将其留给您。

<?xml version="1.0" encoding="utf-16"?>
<BPMNPlane xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="A1" xmlns:q1="urn:tempuri-org:alpha" bpmnElement="q1:test" xmlns="http://www.omg.org/spec/BPMN/20100524/DI">
  <DiagramElement xmlns:q2="http://www.omg.org/spec/BPMN/20100524/DI" xsi:type="q2:BPMNEdge" id="B2" xmlns="http://www.omg.org/spec/DD/20100524/DI">
    <waypoint x="1" y="1" />
    <waypoint x="1" y="1" />
</DiagramElement>
</BPMNPlane> 

下面的(也是有效的)XML 是由工具生成的(不是 xsd.exe 生成的代码);它显示了上面 XML 的完全有效的替代方案,使用替换组的成员,这正是您想要的。您所要做的就是弄清楚还可以用什么来代替DiagramElement。我用这张图来描绘它:

在此处输入图像描述

<?xml version="1.0" encoding="utf-16"?>
<!-- Sample XML generated by QTAssistant (http://www.paschidev.com) -->
<BPMNPlane xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="A1" xmlns:q1="urn:tempuri-org:alpha" bpmnElement="q1:test" xmlns="http://www.omg.org/spec/BPMN/20100524/DI">
    <BPMNEdge xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" p4:any_Attr="anySimpleType" bpmnElement="qname1" sourceElement="qname1" targetElement="qname1" messageVisibleKind="initiating" id="ID1" xmlns:p4="otherNS" xmlns="http://www.omg.org/spec/BPMN/20100524/DI">
        <di:extension/>
        <di:waypoint x="1" y="1"/>
        <di:waypoint x="-1.7976931348623157E+308" y="-1.7976931348623157E+308"/>
        <BPMNLabel p4:any_Attr="anySimpleType" labelStyle="qname1" id="ID2">
            <di:extension/>
            <dc:Bounds x="1" y="1" width="1" height="1"/>
        </BPMNLabel>
    </BPMNEdge>
</BPMNPlane>

我认为这个模式是一个完美的例子,它展示了人们如何能够拥有两种方式(有或没有 xsi:type 创作风格)仅使用一种模式。一个很好的测试可能是查看后一个 XML 是否可以使用 xsd.exe 生成的代码进行反序列化,以及需要进行哪些更改才能使其工作。

Firstly, I've upvoted your question since it really brings up a rare scenario - it also had a hard time being answered, judging by how many people pass it on... Which also means you'll have to do some reading :)...

The short answer is: xsd.exe creates usable code; it may not be what you've expected, and I'll explain why, but it works (at least with my tests); if you don't have problems exchanging that XML, than just go with it the way it is generated. If not then, Linq will work for sure.

So, the main issue starts with how the XML Schema was authored; considering where it is coming from I was surprised to see this (perceived) ambiguity in the authoring style, which ultimately is also responsible to why xsd.exe doesn't seem to yield your expected result.

Please start by reading this paper, with a focus on the section named "Abstract Attribute" and "SubstitutionGroup Attribute".

Normally, the head of a substitution group is supposed to be an abstract element. While this is not enforced by the spec, I suspect that many people make this assumption in their tooling (xsd.exe being one) since otherwise there's a risk of ambiguity with @xsi:type.

In BPMN schema, the head of the substitution groups aren't abstract (the one I looked at); more, the elements used as head of a substitution group are of an abstract type - this rings in xsi:type. To make a long story short, if you take a look at the generated code, xsd.exe creates a perfectly valid code, by making a choice between to use or not to use xsi:type; it went with the former.

This code references the xsd.exe generated code to create a simple XML.

BPMNEdge edge = new BPMNEdge();
edge.id = "B2";
// more code here for waypoint
plane.DiagramElement1 = new DiagramElement[] { edge };

The DiagramElement1 property will basically take in any type that derives from the DiagramElement type, basically fullfilling the contract (and giving you the @xsi:type for the DiagramElement in the generated XML).

The XML below is valid; I couldn't figure out if making the DiagramElement abstract would solve your problem... I don't think it could be that simple but I'll leave it up to you.

<?xml version="1.0" encoding="utf-16"?>
<BPMNPlane xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="A1" xmlns:q1="urn:tempuri-org:alpha" bpmnElement="q1:test" xmlns="http://www.omg.org/spec/BPMN/20100524/DI">
  <DiagramElement xmlns:q2="http://www.omg.org/spec/BPMN/20100524/DI" xsi:type="q2:BPMNEdge" id="B2" xmlns="http://www.omg.org/spec/DD/20100524/DI">
    <waypoint x="1" y="1" />
    <waypoint x="1" y="1" />
</DiagramElement>
</BPMNPlane> 

The (also valid) XML below was generated by a tool (not code generated by xsd.exe); it shows a perfectly valid alternative to the XML above, using members of the substitution group, which is what you wanted. All you have to do is figure out what else to put in place of DiagramElement. I used this graph to picture it:

enter image description here

<?xml version="1.0" encoding="utf-16"?>
<!-- Sample XML generated by QTAssistant (http://www.paschidev.com) -->
<BPMNPlane xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="A1" xmlns:q1="urn:tempuri-org:alpha" bpmnElement="q1:test" xmlns="http://www.omg.org/spec/BPMN/20100524/DI">
    <BPMNEdge xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" p4:any_Attr="anySimpleType" bpmnElement="qname1" sourceElement="qname1" targetElement="qname1" messageVisibleKind="initiating" id="ID1" xmlns:p4="otherNS" xmlns="http://www.omg.org/spec/BPMN/20100524/DI">
        <di:extension/>
        <di:waypoint x="1" y="1"/>
        <di:waypoint x="-1.7976931348623157E+308" y="-1.7976931348623157E+308"/>
        <BPMNLabel p4:any_Attr="anySimpleType" labelStyle="qname1" id="ID2">
            <di:extension/>
            <dc:Bounds x="1" y="1" width="1" height="1"/>
        </BPMNLabel>
    </BPMNEdge>
</BPMNPlane>

I think this schema is a perfect example that shows how one could have it both ways (with or without xsi:type authoring style) using one schema only. A great test might be to see if this latter XML can be deserialized using the code generated by the xsd.exe, and what changes would need to be done in order to make it work.

离鸿 2024-12-24 05:48:11

我已经找到了解决方案。

据我了解,问题不在于抽象定义,因为DiagramElement类在规范中被定义为抽象,而在于BPMNShape类位于与DiagramElement类不同的另一个命名空间中。在这种情况下,替代组似乎不起作用。

在 BPMN 规范中,还有另一种类似的情况,但其中替换组是为同一名称空间中的类定义的(例如,参见 tUserTask 和 tFlowElement),在这种情况下,它是有效的。

我发现问题出在Plane类中DiagramElement1的定义处,其中xsd创建的类如下:

[System.Xml.Serialization.XmlElementAttribute("DiagramElement")]
    public DiagramElement[] DiagramElement1 {
        get {
            return this.diagramElement1Field;
        }
        set {
            this.diagramElement1Field = value;
        }
    }

我决定不更改原始xsd中的任何内容,而只是按以下方式更新该类:

    [System.Xml.Serialization.XmlElementAttribute("BPMNEdge", typeof(BPMNEdge), Namespace="http://www.omg.org/spec/BPMN/20100524/DI")]
    [System.Xml.Serialization.XmlElementAttribute("BPMNShape", typeof(BPMNShape), Namespace = "http://www.omg.org/spec/BPMN/20100524/DI")]
    [System.Xml.Serialization.XmlElementAttribute("DiagramElement")]
    public DiagramElement[] DiagramElement1 {
        get {
            return this.diagramElement1Field;
        }
        set {
            this.diagramElement1Field = value;
        }
    }

现在可以了!

显然,您必须记录并维护修改,以防重新生成类。

我无法找到更好的方法来实现这一目标。如果有人知道怎么做,请发表评论。

I have found a solution for this.

For what I have understood, the problem is not the astract definition, because the DiagramElement class is defined as abstract in the specifications, but the fact that the BPMNShape class is in another namespace than the DiagramElement class. In this situation, it seems that the substitution groups are not working.

In the BPMN specification there is another situation similar, but in which the substitution groups are defined for classes in the same namespace (see, for example the tUserTask and the tFlowElement), and, in that case, it works.

I have found that the problem is located at the definition of the DiagramElement1 in the Plane class, where the class created by xsd is as follows:

[System.Xml.Serialization.XmlElementAttribute("DiagramElement")]
    public DiagramElement[] DiagramElement1 {
        get {
            return this.diagramElement1Field;
        }
        set {
            this.diagramElement1Field = value;
        }
    }

I decided not to change anything in the original xsd, but just update this class in the following way:

    [System.Xml.Serialization.XmlElementAttribute("BPMNEdge", typeof(BPMNEdge), Namespace="http://www.omg.org/spec/BPMN/20100524/DI")]
    [System.Xml.Serialization.XmlElementAttribute("BPMNShape", typeof(BPMNShape), Namespace = "http://www.omg.org/spec/BPMN/20100524/DI")]
    [System.Xml.Serialization.XmlElementAttribute("DiagramElement")]
    public DiagramElement[] DiagramElement1 {
        get {
            return this.diagramElement1Field;
        }
        set {
            this.diagramElement1Field = value;
        }
    }

And now it works!

Obviously you must document and maintain the modification in case you regenerate the classes.

I was not able to figure out a better way to achieve this. if someone knows how to do it, please comment.

梦与时光遇 2024-12-24 05:48:11

谢谢您的宝贵时间!这是一个很好的解释!我还发现,执行此操作:

BPMNDiagram bpmnd = new BPMNDiagram();
BPMNPlane bpmnl = bpmnd.BPMNPlane;
 bpmnl.DiagramElement1.Add(new BPMNShape());

有效,它为我提供了以下 XML 结构:

但我真正想要的是这样的:

<bpmndi: BPMNDiagram name="bpmndiagramid">
<bpmndi: BPMNPlane>
    <bpmndi:BPMNShape id="11" bpmnElement="functionsname">
        <dc:Bounds x="0" y="0" width="0" height="0"/>
    </bpmndi:BPMNShape>
</bpmndi: BPMNPlane>
</bpmndi: BPMNDiagram >

所以,我可以写:

BPMNDiagram bpmnd = new BPMNDiagram();
BPMNPlane bpmnl = bpmnd.BPMNPlane;

这给了我:

< BPMNDiagram name="bpmndiagramid">
< BPMNPlane>...
</ BPMNPlane>
</ BPMNDiagram >

但不是直接这样:

BPMNDiagram bpmnd = new BPMNDiagram();
BPMNPlane bpmnl = bpmnd.BPMNPlane;
BPMNShape myShape = bpmnl.BPMNShape;

我想,它会比使用 LINQ 2 XML 生成 C# 类并使用它们更快,但我明白了现在我必须更深入地了解 XML 架构/元素等。

thank you for your time! Its a good explanation! I have also found, that doing this:

BPMNDiagram bpmnd = new BPMNDiagram();
BPMNPlane bpmnl = bpmnd.BPMNPlane;
 bpmnl.DiagramElement1.Add(new BPMNShape());

works, it gives me the following XML structure:

But what I actually want is this:

<bpmndi: BPMNDiagram name="bpmndiagramid">
<bpmndi: BPMNPlane>
    <bpmndi:BPMNShape id="11" bpmnElement="functionsname">
        <dc:Bounds x="0" y="0" width="0" height="0"/>
    </bpmndi:BPMNShape>
</bpmndi: BPMNPlane>
</bpmndi: BPMNDiagram >

So, I can write:

BPMNDiagram bpmnd = new BPMNDiagram();
BPMNPlane bpmnl = bpmnd.BPMNPlane;

which gives me:

< BPMNDiagram name="bpmndiagramid">
< BPMNPlane>...
</ BPMNPlane>
</ BPMNDiagram >

But but not directly this:

BPMNDiagram bpmnd = new BPMNDiagram();
BPMNPlane bpmnl = bpmnd.BPMNPlane;
BPMNShape myShape = bpmnl.BPMNShape;

I thought, it would be faster than working with LINQ 2 XML, to generate c# classes and work with them, but I see now that I have to go deeper in XML Schema/Elements etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文