java - xStream problems - How to deserialize multiple objects -
I'm using xStream to manipulate XML, all is well. However, I have a problem to put on XML archive and other things:
Example: My XML has a tag, and inside it, I have And progress can I tag 500 inside the tag. And these comments have commented types How can I sort by xStream to put all these tags in the squares? How do I create different classes in class? Obviously, I will do this with an array, or some other. But I do not know how I can do this. For that XML, you might look like a square structure: Your unmarshalling argument will be something like this: As a joint, Mark has mentioned in the comments, your XML is not exactly created. You will need to make sure that your & lt; Comment & gt; See some more examples of name tags:
& lt; Comments & gt; & Lt; Comment & gt; & Lt; ID & gt; 1 & lt; / Id & gt; & Lt; Desc & gt; A comment & lt; / Desc> & Lt; / Comment & gt; & Lt; Comment & gt; & Lt; ID & gt; 2 & lt; / Id & gt; & Lt; Desc & gt; Another comment & lt; / Desc> & Lt; / Comment & gt; & Lt; Comment & gt; & Lt; ID & gt; 3 & lt; / Id & gt; & Lt; Desc & gt; One more comment & lt; / Desc> & Lt; / Comment & gt; & Lt; / Comments & gt;
XStream xstream = new XStream (); Xstream.alias ("Comments", comments.class); Xstream.alias ("comment", comment class); Xstream.addImplicitCollection (comments category, "comments"); Comments Comments = (comments) xstream.fromXML (xml);
& lt; Comment & gt;
& lt; / Comment & gt; and
Comments
Post a Comment