Is that possible to get an element's (child) element or an element's own attribute via xml annotation without phantom classes?
example current code snipet: XML:
<root>
...
<epno type="1">12</epno>
...
</root>
C# classes:
[XmlRoot("root")]
class Root {
...
[XmlElement("epno")]
public Epno epno;
...
}
class Epno { //"Phantom" class
[XmlAttribute("type")]
public int type;
[XmlText]
public int epno;
}
What I want is to remove that Epno class and move those props into the Root class...
[XmlRoot("root")]
class Root {
...
[XmlElement("epno")]
[XmlAttribute("type")] // I need a solution for this...
public int type;
[XmlElement("epno")]
public int epno;
...
}
Also theres another place, where is a plus level, there I want to get an element's attribute, which is an another element... Than I want to get the element's element value.
For this an Xml example:
<root>
<rates>
<permanent votes="100">6.54</permanent>
<temprate votes="100">6.54</temprate>
</rates>
</root>
Here I want to put those values in to the root class, but in this case, there's need minimum 2 classes for parse it.
So, there's exist a way to deserialize these classes via annotation without these phantom classes and without writing my own xml parser?