XML tutorial question

  • 5 November 2006
  • 0 replies
  • 0 views

Badge +5
Hello,
In the K2 tutorial, there is a XMLfield that is filled trough a XSD in a webform.

I have used this method in my webform, but I have a question about multiple xml value rows (eg multiple products) that is not covered in the tutorial:

I have a XSD that looks like this:

<xs:schema id="FlowInfo" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="FlowInfoRoot">
<xs:complexType>
<xs:sequence>
<xs:element name="FlowInfoData">
<xs:complexType>
<xs:sequence>
<xs:element name="flowState" type="xs:string" minOccurs="0" />
<xs:element name="traceRoot">
<xs:complexType>
<xs:sequence>
<xs:element name="trace">
<xs:complexType>
<xs:sequence>
<xs:element name="traceComment" type="xs:string" minOccurs="0"
/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


If I want to fill this, I use the following c# code:
dsFlowInfo.FlowInfoData.Rows.Add(dsFlowInfo.FlowInfoData.NewFlowInfoDataRow());
dsFlowInfo.FlowInfoData[0].flowState = flowstate;

This works without any problem.
However,
If I want to fill multiple "trace" rows, how do I do that ?
I want to add a row of type "trace" to "traceRoot"

dsFlowInfo.FlowInfoData.Rows.Add(dsFlowInfo.FlowInfoData.NewFlowInfoDataRow());
dsFlowInfo.traceRoot.Rows.Add(dsFlowInfo.traceRoot.NewtraceRootDataRow());
dsFlowInfo.trace.Rows.Add(dsFlowInfo.trace.NewtraceDataRow());

//filling of the elements is not included

This results in that <traceRoot /> is empty and that <trace> is filled
correctly but is placed on the FlowInfoData level. What must I do to create
a new row of type "trace" on the level of "traceRoot" ?

Regards,
Nicolas

0 replies

Be the first to reply!

Reply