我已经使用biztalk几个月了,并且已经学习了基础和中级项目创建的内部和外部。然而今天我注意到了我必须错过的初级概念(模式创建)。在我使用名为" NewSchema"的Schema创建的项目中。我创建了一个带有id和parentid属性的屏幕记录,msg元素和四个名为A-D的记录,这些记录是元素,但有一个名为ChildID的属性。
我最初在一个C#程序中完成了这个项目,我编写这个程序是为了更好地教会自己如何迭代XML元素。现在我已经将程序改编为biztalk,我注意到元素不能具有"属性"?要解决这个问题,A-D必须是带有属性的记录,然后我必须为每个A-D记录创建一个与记录同名的子元素。 biztalk中的属性元素是否可用?我很惊讶我之前从未见过这个。
如果我这样做,它会起作用:
<ns0:Root xmlns:ns0="http://WcfServerProject.NewSchema">
<Screen ID="ID_0" ParentID="ParentID_1">
<MSG>MSG_0</MSG>
<A ChildID="ChildID_0">
**<A>Hello World</A>**
</A>
<B ChildID="ChildID_0" />
<C ChildID="ChildID_0" />
<D ChildID="ChildID_0" />
</Screen>
</ns0:Root>
但我可以在biztalk中以这种方式创建我的项目吗?:
<ns0:Root xmlns:ns0="http://WcfServerProject.NewSchema">
<Screen ID="ID_0" ParentID="ParentID_1">
<MSG>MSG_0</MSG>
**<A ChildID="ChildID_0">
Hello World
</A>**
<B ChildID="ChildID_0" />
<C ChildID="ChildID_0" />
<D ChildID="ChildID_0" />
</Screen>
</ns0:Root>
答案 0 :(得分:1)
尝试使用格式良好的xml函数生成xsd,你会得到xsd这样的:
<xs:element name="A">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="ChildID" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
答案 1 :(得分:1)
Ok我的元素在切换后可以拥有属性和数据&#34;混合&#34; to&#34; True&#34;。