xml xsd filling question

  • Thread starter Thread starter NS
  • Start date Start date
N

NS

Hello,
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
 
NS,

Import that XSD in your Visual Studio Net IDE, than you will probably direct
see every problem yourself in the schema view.

Cor
 
Back
Top