I'm getting this exception when i'm parsing with Simple XML:

03-20 12:43:38.163: WARN/System.err(1886):
org.simpleframework.xml.core.ElementException: Element 'Magazine' does
not have a match in class com.Magazine.Magazines at line 1

This is the XML file:

<Magazines>
 <Magazine title="APP 1" id="1">
  <description>Prueba real</description>
   <miniature>http://web/miniature.jpg</miniature>
 </Magazine>
 <Magazine title="APP 2" id="2">
  <description>Prueba real 2</description>
   <miniature>http://web/miniature2.jpg</miniature>
 </Magazine>
 <Magazine title="APP 3" id="3">
  <description>Prueba real 3</description>
   <miniature>http://web/miniature3.jpg</miniature>
 </Magazine>
</Magazines>

And these are my Java classes for Simple XML:

public class Magazine {
@Attribute
String title;
@Attribute
String id;
@Element
String description;
@Element
String miniature;

Bitmap miniatureBitmap;

public String getTitle() {
    return title;
}
public String getId() {
    return id;
}
public String getDescription() {
    return description;
}
public Bitmap getMiniature() {
    return Util.getRemoteBitmap(miniature);
}
}

Another class:

@Root
public class Magazines{
  @ElementList(name="Magazine", inline=true)
  public ArrayList<Magazine> previews;

  public static Magazines Load(String xml){
    Serializer serializer = new Persister();
    try{
        return serializer.read(Magazines.class, xml);
    }catch (Exception e) {e.printStackTrace();}
    return null; //si llega aquĆ­ es que ha fallado.
  }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to