Closed lixun027 closed 1 year ago
Sorry, this case is not supported. XStream is in first line Java to XML (and back). So a class member is either a value (resulting in a value of a tag or attribute) or some object that is mapped to another tag, but never both.
This requirement meets the standards of XML, and I have used both jaxb and fastXML, both of which support the above implementation. But they cannot be used in Android. Are you considering implementing this feature in Xstream in the future. Not only me, but also others will encounter this need.
As said, XStream has a different purpose. It is a tool to persist any kind of Java object in a textual format; this implies that XStream can read XML it has created (and it offers quite some possibilities to tweak the written XML), but it was not made to read any arbitrary XML structure and turn it into Java objects.
I want to implement an XML where both text and sub tags exist. How should my class be written?
I've looked at all the annotations and I can't find any annotation like @XStreamText. Please teach me, How can I do that