Dear all,
Please forgive me if my terminology isn't accurate, it's a new field for me. :)
I have implemented a class in VB which is serialized to xml (actually the xml-file will be deserialized to the class, however)
So the XML:
<Universe>
<Jedi>
<Person Name="Yoda" Age="1000"/>
</Jedi>
</Universe>
resulting Class:
<XmlRoot ("Universe"), Serializable()> _
Public Class Universe
<XmlArray("Jedi")> _
<XmlArrayItem("Person")>
Public Persons as list(Of Person)
End Class
Public Class Person
<XmlAttributeAttribute ("Name")> _
Public Name as string
<XmlAttributeAttribute ("Age")> _
Public Age as String
End Class
So far so good...
Now I have a situation, where an unknown amount of additional Attributes needed to be added to some "Persons", just like
<Person Name="Obi Van" Age="2000" isMaster="yes" isAlive="no">
<Person Name="Luke" Age="300" isMaster="no">
So my idea was to add a Dictionary(Of String, String) to my Person Class to collect all the "is..."-Attributes of the Xelement Person into.
First of it, I cant use a Dictionary at this point (as the debugging pointed to me...) and I have no idea how to collect all attributes of an XElement to a List or some for further processing.
Public Class Person
<XmlAttributeAttribute ("Name")> _
Public Name as string
<XmlAttributeAttribute ("Age")> _
Public Age as String
public myAttributes as [Attributes of Element startwith "is"]
End Class
Anyway, I don't really see, how to get the Xelement at all... (althought I had to implement a Function with a different reader, or so.... )
Actually, if there is a better way to handle this at all, I was thankful for any alternatives!
Any hints are appreciated!
Thanks in advance,
Daniel