xml xsd filling question

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
 
C

Cor Ligthert [MVP]

NS,

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

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top