turiu xml, is jo pasidariau xml schema, po to pasidariau klase.
deserializuoju klase, bet objekte blogai buna "tbody" objektas t.y. jame
niekada nebuna "tr" objektu, kur cia darau klaida ?
failu sourcus parasiau zemiau, is anksto aciu :)
=============================================
xml:
=============================================
<?xml version="1.0" encoding="utf-8" ?>
<TSResponse>
<table>
<tr>
<td></td>
<td><h2>test</h2></td>
<td><a><span>test</span></a></td>
</tr>
</table>
<table>
<tbody>
<tr>
<td><p>test</p></td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td></td>
</tr>
<tr>
<td>1</td>
<td><p>test</p></td>
<td><a>1</a></td>
<td><a>1</a></td>
<td><a>1</a></td>
<td>1</td>
<td>1</td>
<td>1</td>
<td></td>
</tr>
<tr>
<td><p>test</p></td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td></td>
</tr>
<tr>
<td>1</td>
<td><p>test</p></td>
<td><a>1</a></td>
<td><a>1</a></td>
<td><a>1</a></td>
<td><a>1</a></td>
<td><a>1</a></td>
<td>1</td>
<td><a>1</a></td>
</tr>
</tbody>
</table>
</TSResponse>
=============================================
xml schema (xsd):
=============================================
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="data">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element ref="a"/>
<xs:element ref="table"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="table">
<xs:complexType>
<xs:choice>
<xs:element ref="tr"/>
<xs:element ref="tbody"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="tbody">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="tr"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="a">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="span"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="span" type="xs:NCName"/>
<xs:element name="tr">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="td"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="td">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="a"/>
<xs:element ref="h2"/>
<xs:element ref="p"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="h2" type="xs:string"/>
<xs:element name="p" type="xs:string"/>
</xs:schema>
=============================================
klase:
=============================================
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd",
"2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable =
false)]
public partial class TSResponse
{
private table[] tableField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("table")]
public table[] table
{
get{return this.tableField;}
set{this.tableField = value;}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd",
"2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable =
false)]
public partial class table
{
private object itemField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("tbody",
typeof(tbody))]
[System.Xml.Serialization.XmlElementAttribute("tr", typeof(tr))]
public object Item
{
get{return this.itemField;}
set{this.itemField = value;}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd",
"2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable =
false)]
public partial class tbody
{
private tr[] trField;
/// <remarks/>
[System.Xml.Serialization.XmlArrayItemAttribute("tr", typeof(tr),
IsNullable = false)]
public tr[] tr
{
get{return this.trField;}
set{this.trField = value;}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd",
"2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable =
false)]
public partial class tr
{
private td[] tdField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("td")]
public td[] td
{
get{return this.tdField;}
set{this.tdField = value;}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd",
"2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable =
false)]
public partial class td
{
private object[] itemsField;
private ItemsChoiceType[] itemsElementNameField;
private string[] textField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("a", typeof(a))]
[System.Xml.Serialization.XmlElementAttribute("h2", typeof(string))]
[System.Xml.Serialization.XmlElementAttribute("p", typeof(string))]
[System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemsElementName")]
public object[] Items
{
get{return this.itemsField;}
set{this.itemsField = value;}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("ItemsElementName")]
[System.Xml.Serialization.XmlIgnoreAttribute()]
public ItemsChoiceType[] ItemsElementName
{
get{return this.itemsElementNameField;}
set{this.itemsElementNameField = value;}
}
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
public string[] Text
{
get{return this.textField;}
set{this.textField = value;}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd",
"2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable =
false)]
public partial class a
{
private string[] spanField;
private string[] textField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("span", DataType =
"NCName")]
public string[] span
{
get{return this.spanField;}
set{this.spanField = value;}
}
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
public string[] Text
{
get{return this.textField;}
set{this.textField = value;}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd",
"2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(IncludeInSchema = false)]
public enum ItemsChoiceType
{
/// <remarks/>
a,
/// <remarks/>
h2,
/// <remarks/>
p,
}