Although the Title might not make sense (I had a hard time describing this problem to shortly) I will try to explain here.
I have some XML that contains some values that will always be there, but it also contains an undefined number of other variables, Such as this:
<fooElements>
<fooElement>
<name>fooElem1</name>
<barElement>
<name>foobarElem1</name>
</barElement> //There's an undefined number of these bar elements.
</fooElement>
</fooElements>
Is there anyway process those barElements with the fooElement class?
My first though was to place a list inside of the fooElement class and then load the barElement(s) into that, but when i then serialize it back i get:
<fooElements>
<fooElement>
<name>fooElem1</name>
<barList>
<barElement>
<name>foobarElem1</name>
</barElement> //There's an undefined number of these bar elements.
<barList>
</fooElement>
</fooElements>
Which is not what i am looking for.
Is there any way i can store this undefined number of barElements inside the fooElement class without it showing in the xml?
Just make your barList an
XmlElement. For example: