#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0

    XML serializer help


    Hi guys, I'm very new to programming (especially Android/Java)

    I was originally making a game using XNA/C# as I found a very good program called SpriteVortex and an example of how to animate irregular spritesheets.

    However, i've lost interest in XNA (even though I find it amazing and easy to use) as I bought a Nexus 7 and want to program for it!

    I've converted most of the SpriteAnimationManager class to Java however I can't get the serializer/deserializer to work! I even tried installing Simple however I don't understand programming well enough to use it.


    The following 3 lines are giving me the biggest headaches:

    The errors are :

    Cannot instantiate the type XMLserializer

    for this line: XmlSerializer serializer = new XmlSerializer(AnimationSet.class);

    the XmlSerializer after "new" is in red.


    the Method deserialize(XMLreader) is undefined for the type XMLserializer

    in this line: animationSet = (AnimationSet)serializer.Deserialize(reader);

    and finally: the method dispose() is undefined for the type XMLReader

    in this line: reader.dispose();


    The full class is in a pastebin however as a new user I can't post URLs

    Thanks in advance for any help as I've been stuck for a week now
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0
    I've rewritten the entire class (well, just added some @attributes and @root however I'm not sure if I did this correctly as I never had to do this in XNA)

    Also I'm fairly certain I'm passing the XML file to the class correctly, so the possible problems could be that the class structure is incorrect or I'm missing a step.

    In the XNA class (which I didn't write by the way), first a serializer is created and then a deserializer takes in the data from the XML file directly to the class.

    In my code I'm currently just trying to deserialize to the class.

    Would pasting in a stack trace help? Where would I find the stack trace .txt file as I searched but didn't find it?

IMN logo majestic logo threadwatch logo seochat tools logo