개체로 HTML 테이블을 deserialize하고 싶습니다. 그러나 다음 코드를 사용하면 <tr>
의 부모로 <Rows>
이 표시되고 <td>
의 부모는 <Cells>
으로 간주됩니다. 이 클래스 구조를 유지하고 싶습니다. 속성 선언이 누락 되었습니까?복수 부모 요소가없는 XML에서 목록을 어떻게 deserialize합니까?
<table>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
public class Table
{
[XmlArrayItem("tr")]
public List<Row> Rows { get; set; }
}
public class Row
{
[XmlArrayItem("td")]
public List<Cell> Cells { get; set; }
}
public class Cell
{
public object Value { get; set; }
}
가능한 복제 [내가 XmlSerializer가 컨테이너 태그를 직렬화하지 어떻게합니까?] (http://stackoverflow.com/questions/8199738/how-do-i-get-xmlserializer-to-not-serialize -container-tags) –