儘管標題可能沒有意義(我很快就很難描述這個問題),我會在這裏解釋一下。帶有未編號屬性的Xml序列化/反序列化
我有一些XML包含一些值,將永遠在那裏,但它也包含其他變量,如這一個未定義的數字:
<fooElements>
<fooElement>
<name>fooElem1</name>
<barElement>
<name>foobarElem1</name>
</barElement> //There's an undefined number of these bar elements.
</fooElement>
</fooElements>
反正是有處理這些barElements
與fooElement
類?
我的第一個雖然是放置fooElement
類的內部列表,然後加載barElement
(S)成,但是當我再序列化回我得到:
<fooElements>
<fooElement>
<name>fooElem1</name>
<barList>
<barElement>
<name>foobarElem1</name>
</barElement> //There's an undefined number of these bar elements.
<barList>
</fooElement>
</fooElements>
這是不是我正在尋找。
有沒有什麼辦法可以在fooElement
類中存儲這個不明確數量的barElements
而不顯示在xml中?
僅供參考,那些是元素,而不是屬性。 –