Search code examples
javaxmlparsingwebxstream

Serialization Issues in XStream


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


Solution

  • 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!!