Serialization Issues in XStream

强颜欢笑 提交于 2019-12-11 13:49:52

问题


So I am having a problem serializing my Java code. This is a web scraper, scraping pages from our school's course selection website for a project I'm working on and I'm trying to output all the Class information for the designated Subject in an XML file. The problem is, some classes have more than one section, and rather than just re-writing these file names and wasting space, I wanted them all to stay under a section called "Sections" in my XML. Any idea what is wrong with my code? Here's a link to the gist, I don't want to stretch the page with my code: Gist


回答1:


Handling List through xstream is bit tricky. You need to add an implicitCoolection for sections

    //xstream.alias("list", Class.class);
    xstream.addImplicitCollection(Class.class, "sections");

Hope this helps!!



来源:https://stackoverflow.com/questions/13078289/serialization-issues-in-xstream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!