我有這樣的事情(遺憾的壞話)如何爲此做一個序列化類?
<?xml version="1.0" encoding="utf-8" ?>
<root xmlns="http://www.domain.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.domain.com Schema.xsd">
<product></product>
<SomeHighLevelElement>
<anotherElment>
<lowestElement> </lowestElement>
</anotherElment>
</SomeHighLevelElement>
</root>
我有這樣的事情我的課
public class MyClass
{
public MyClass()
{
ListWrapper= new List<UserInfo>();
}
public string product{ get; set; }
public List<SomeHighLevelElement> ListWrapper{ get; set; }
}
public class SomeHighLevelElement
{
public string lowestElement{ get; set; }
}
但我不知道怎麼寫的代碼爲「另一個元素「不確定是否必須再製作一個包裝。
編輯
我知道在我實際的XML文件得到一個錯誤。我有這個在我的標籤
xmlns="http://www.domain.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.Domain.com Schema.xsd
在根行上拋出一個異常,說這個東西有錯誤。所以我不知道它是否對schemaLocation感到憤怒,因爲我現在正在使用本地主機或者什麼。
錯誤
System.InvalidOperationException was caught
Message="There is an error in XML document (2, 2)."
Source="System.Xml"
後實際的XML,而不是你認爲的摘錄可能是相關的。 – 2010-05-04 01:12:59
好的,我更新了原來用我認爲在崩潰的那一行崩潰的行的XML。它只是說錯誤Xml 2,2。 – chobo2 2010-05-04 01:17:33
如果這真的是你的XML,那麼它是畸形的; 'xsi:schemaLocation'缺少一個結束引用(它也有一個空格,通常不應該在那裏)。 – Aaronaught 2010-05-04 01:18:52