{"id":378,"date":"2011-02-03T00:02:00","date_gmt":"2011-02-03T00:02:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/2012\/10\/android-xml-binding-with-simple-framework-tutorial.html"},"modified":"2012-10-21T19:38:26","modified_gmt":"2012-10-21T19:38:26","slug":"android-xml-binding-simple-tutorial","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html","title":{"rendered":"Android XML Binding with Simple Framework Tutorial"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left\">XML is still important in the area of web services even though <a href=\"http:\/\/www.javacodegeeks.com\/?tag=restful-web-service\">REST<\/a> has gained significant attention lately. Exposed APIs via <a href=\"http:\/\/www.javacodegeeks.com\/?tag=web-services\">web services<\/a> is the main reason I have to manipulate XML content in my <a href=\"http:\/\/www.javacodegeeks.com\/2010\/10\/android-full-application-tutorial.html\">Android applications<\/a>. For that reason I need to parse XML documents even though it is a tedious procedure. <\/p>\n<p>In the past, I showed you <a href=\"http:\/\/www.javacodegeeks.com\/2010\/10\/android-full-app-part-3-parsing-xml.html\">how to parse XML using the SAX approach<\/a> and <a href=\"http:\/\/www.javacodegeeks.com\/2010\/11\/boost-android-xml-parsing-xml-pull.html\">how to boost your Android XML parsing with XML Pull<\/a>. Both these techniques work, but are rather boring since they qualify as \u201cplumbing code\u201d. In this tutorial I am going to show you how to perform XML binding in Android using the <a href=\"http:\/\/simple.sourceforge.net\/\">Simple framework<\/a>.<\/p>\n<p><a href=\"http:\/\/en.wikipedia.org\/wiki\/XML_data_binding\">XML data binding<\/a> is quite popular in Java and there are multiple frameworks that allow binding. Solutions like <a href=\"http:\/\/www.oracle.com\/technetwork\/articles\/javase\/index-140168.html\">JAXB<\/a> and <a href=\"http:\/\/xstream.codehaus.org\/\">XStream<\/a> are well established and heavily used. However, these libraries come with a large footprint, something that makes them inappropriate for use in the resources constraint world of mobiles. The good news is that there is a new kid on the block, the <a href=\"http:\/\/simple.sourceforge.net\/\">Simple framework<\/a>. As its name implies, it strives to bring some simplicity in the bloated world of XML.<\/p>\n<p>From the official Simple framework site:<br \/>\n<span style=\"font-style: italic\"><br \/>\nSimple is a high performance XML serialization and configuration framework for Java. Its goal is to provide an XML framework that enables rapid development of XML configuration and communication systems. This framework aids the development of XML systems with minimal effort and reduced errors. It offers full object serialization and deserialization, maintaining each reference encountered.<\/span><\/p>\n<p>Very nice. You can get started with the framework by visiting the <a href=\"http:\/\/simple.sourceforge.net\/download\/stream\/doc\/tutorial\/tutorial.php\">documentation page<\/a> and you should also read <a href=\"http:\/\/bdoughan.blogspot.com\/2010\/10\/how-does-jaxb-compare-to-simple.html\">how does JAXB compare to Simple<\/a>. Simple could change the way you handle XML in your Java applications, give it a try.<\/p>\n<p>The big question is whether Simple is supported in Android&#8217;s JVM. <a href=\"http:\/\/www.javacodegeeks.com\/2010\/06\/embracing-android-awesomeness-quick.html\">Android uses Dalvik<\/a>, a specialized virtual machine optimized for mobile devices. Additionally, Dalvik use a subset of <a href=\"http:\/\/en.wikipedia.org\/wiki\/Apache_Harmony\">Apache&#8217;s Harmony<\/a> project for the core of its <a href=\"http:\/\/en.wikipedia.org\/wiki\/Java_Class_Library\">Class Library<\/a>. Not all Java core classes are supported. For example, some of the javax.xml.* subpackages are not included.<\/p>\n<p>Well, Simple CAN work with Android. More specifically, I managed to use <span style=\"font-weight: bold\">version 2.3.2<\/span> which can be found in <a href=\"http:\/\/simple.sourceforge.net\/download.php\">Simple&#8217;s download page<\/a>. The corresponding JAR has a size of 287KB. The release notes for that version mention:<\/p>\n<ul style=\"text-align: left\">\n<li>Addition of DOM provider so that StAX is not a required dependency<\/li>\n<li>Fix made to ensure property defaults are applied correctly to classes<\/li>\n<\/ul>\n<p>The first issue is very important because <a href=\"http:\/\/code.google.com\/p\/android\/issues\/detail?id=1332\">the StAX API is not included in Android&#8217;s SDK<\/a>. Note that <strong>the latest versions of Simple (after v2.3.2) also work<\/strong> and can be used for our purposes.<\/p>\n<p>Let&#8217;s cut to the chase and see how to perform the binding. As an example I will use an XML document that is returned as a response from the <a href=\"http:\/\/api.themoviedb.org\/2.1\">TMDb API<\/a> which I use in the <a href=\"http:\/\/www.javacodegeeks.com\/2010\/10\/android-full-application-tutorial.html\">sample full Android application<\/a> I build. Here is the document:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><a href=\"http:\/\/dl.dropbox.com\/u\/7215751\/JavaCodeGeeks\/AndroidFullAppTutorialPart03\/Transformers+2007.xml\">Movies search for \u201cTransformers\u201d and (year) \u201c2007\u201d<\/a><\/p>\n<p>The response example can also be found <a href=\"http:\/\/api.themoviedb.org\/2.1\/methods\/Movie.search\">here<\/a>.<\/p>\n<p>First of all <a href=\"http:\/\/simple.sourceforge.net\/track\/get.php?version=2.3.2&amp;package=simple-xml-2.3.2.zip\">download Simple version 2.3.2<\/a> and include it in your project&#8217;s classpath. Then take a quick look at the <a href=\"http:\/\/simple.sourceforge.net\/download\/stream\/doc\/javadoc\/\">Simple framework Javadocs<\/a>.<\/p>\n<p>The most important thing is to create our model objects and map the  appropriately to the XML formatted document. If we take a look at the XML file, we shall see that the root element is called OpenSearchDescription and it includes a Query element, a \u201ctotalResults\u201d element and a number of movies. Here how our main model class looks like:<\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.xml.bind.model;\r\n\r\nimport java.util.List;\r\n\r\nimport org.simpleframework.xml.Element;\r\nimport org.simpleframework.xml.ElementList;\r\nimport org.simpleframework.xml.Root;\r\n\r\n@Root\r\npublic class OpenSearchDescription {\r\n \r\n @Element(name=\"Query\")\r\n public Query query;\r\n \r\n @Element\r\n public int totalResults;\r\n \r\n @ElementList\r\n public List&lt;Movie&gt; movies;\r\n\r\n}\r\n<\/pre>\n<p>The <a href=\"http:\/\/simple.sourceforge.net\/download\/stream\/doc\/javadoc\/org\/simpleframework\/xml\/Root.html\">Root<\/a> annotation denotes that the specific class represents a root XML element. We also use the <a href=\"http:\/\/simple.sourceforge.net\/download\/stream\/doc\/javadoc\/org\/simpleframework\/xml\/Element.html\">Element<\/a> and <a href=\"http:\/\/simple.sourceforge.net\/download\/stream\/doc\/javadoc\/org\/simpleframework\/xml\/ElementList.html\">ElementList<\/a> annotations for the nested elements. Note that Simple can handle both \u201cgetters\/setters\u201d and \u201cpublic fields\u201d approaches. I use the latter in this example. One thing to be aware of is that we use the <a href=\"http:\/\/simple.sourceforge.net\/download\/stream\/doc\/javadoc\/org\/simpleframework\/xml\/Element.html#name%28%29\">name<\/a> field (for \u201cQuery\u201d) in order to provide the corresponding XML element name. This should be done when the XML element has a different name than the Java field, since Simple by default looks for an element with the same name as the field.<\/p>\n<p>Let&#8217;s now see the Query class:<\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.xml.bind.model;\r\n\r\nimport org.simpleframework.xml.Attribute;\r\nimport org.simpleframework.xml.Element;\r\n\r\n@Element\r\npublic class Query {\r\n \r\n @Attribute\r\n public String searchTerms;\r\n \r\n}\r\n<\/pre>\n<p>This class contains only an attribute called \u201csearchTerms\u201d so the relevant field is annotated with <a href=\"http:\/\/simple.sourceforge.net\/download\/stream\/doc\/javadoc\/org\/simpleframework\/xml\/Attribute.html\">Attribute<\/a>.<\/p>\n<p>Very easy until now. Let&#8217;s check the Movie class:<\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.xml.bind.model;\r\n\r\nimport java.util.List;\r\n\r\nimport org.simpleframework.xml.Element;\r\nimport org.simpleframework.xml.ElementList;\r\n\r\n@Element(name=\"movie\")\r\npublic class Movie {\r\n \r\n @Element(required=false)\r\n public String score;\r\n \r\n @Element(required=false)\r\n public String popularity;\r\n \r\n @Element(required=false)\r\n public String name;\r\n \r\n @Element(required=false)\r\n public String id;\r\n \r\n @Element(required=false)\r\n public String biography;\r\n \r\n @Element(required=false)\r\n public String url;\r\n \r\n @Element(required=false)\r\n public String version;\r\n \r\n @Element(required=false)\r\n public String lastModifiedAt;\r\n \r\n @ElementList\r\n public List&lt;Image&gt; images;\r\n\r\n}\r\n<\/pre>\n<p>The only new thing is that the <a href=\"http:\/\/simple.sourceforge.net\/download\/stream\/doc\/javadoc\/org\/simpleframework\/xml\/Element.html#required%28%29\">required<\/a> field is used in order to declare that a field is not required (can be null). This is done because some fields are empty in the API response.<\/p>\n<p>Let&#8217;s see the Image class:<\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.xml.bind.model;\r\n\r\nimport org.simpleframework.xml.Attribute;\r\nimport org.simpleframework.xml.Element;\r\n\r\n@Element(name=\"image\")\r\npublic class Image {\r\n\r\n @Attribute\r\n public String type;\r\n \r\n @Attribute\r\n public String url;\r\n \r\n @Attribute\r\n public String size;\r\n \r\n @Attribute\r\n public int width;\r\n \r\n @Attribute\r\n public int height;\r\n \r\n @Attribute\r\n public String id;\r\n\r\n}\r\n<\/pre>\n<p>This class includes only attributes so we annotate the fields accordingly.<\/p>\n<p>The final step is to read the source XML and let Simple wire all the classes and populate the fields. This is done by using the <a href=\"http:\/\/simple.sourceforge.net\/download\/stream\/doc\/javadoc\/org\/simpleframework\/xml\/core\/Persister.html\">Persister<\/a> class which provides an implementation for the <a href=\"http:\/\/simple.sourceforge.net\/download\/stream\/doc\/javadoc\/org\/simpleframework\/xml\/Serializer.html\">Serializer<\/a> interface. We shall use its read method which reads the contents of the XML document from a provided source and convert it into an object of the specified type. Note that we have disabled the strict mode. Here is how it looks inside an Android <a href=\"http:\/\/developer.android.com\/reference\/android\/app\/Activity.html\">Activity<\/a>:<\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.xml.bind;\r\n\r\nimport java.io.IOException;\r\nimport java.io.Reader;\r\nimport java.io.StringReader;\r\n\r\nimport org.apache.http.HttpEntity;\r\nimport org.apache.http.HttpResponse;\r\nimport org.apache.http.HttpStatus;\r\nimport org.apache.http.client.methods.HttpGet;\r\nimport org.apache.http.impl.client.DefaultHttpClient;\r\nimport org.apache.http.util.EntityUtils;\r\nimport org.simpleframework.xml.Serializer;\r\nimport org.simpleframework.xml.core.Persister;\r\n\r\nimport android.app.Activity;\r\nimport android.os.Bundle;\r\nimport android.util.Log;\r\nimport android.widget.Toast;\r\n\r\nimport com.javacodegeeks.xml.bind.model.OpenSearchDescription;\r\n\r\npublic class SimpleExampleActivity extends Activity {\r\n    \r\n    private static final String url = \r\n        \"http:\/\/dl.dropbox.com\/u\/7215751\/JavaCodeGeeks\/AndroidFullAppTutorialPart03\/Transformers+2007.xml\";\r\n    \r\n    private DefaultHttpClient client = new DefaultHttpClient();\r\n    \r\n    @Override\r\n    public void onCreate(Bundle savedInstanceState) {\r\n        \r\n        super.onCreate(savedInstanceState);\r\n        setContentView(R.layout.main);\r\n        \r\n        try {\r\n            \r\n            String xmlData = retrieve(url);\r\n            Serializer serializer = new Persister();        \r\n            \r\n            Reader reader = new StringReader(xmlData);\r\n            OpenSearchDescription osd = \r\n                serializer.read(OpenSearchDescription.class, reader, false);\r\n            \r\n            Log.d(SimpleExampleActivity.class.getSimpleName(), osd.toString());\r\n            \r\n        } \r\n        catch (Exception e) {\r\n            Toast.makeText(this, \"Error Occured\", Toast.LENGTH_LONG).show();\r\n        }\r\n        \r\n    }\r\n    \r\n    public String retrieve(String url) {\r\n\r\n        HttpGet getRequest = new HttpGet(url);\r\n\r\n        try {\r\n\r\n            HttpResponse getResponse = client.execute(getRequest);\r\n            final int statusCode = getResponse.getStatusLine().getStatusCode();\r\n\r\n            if (statusCode != HttpStatus.SC_OK) {\r\n                return null;\r\n            }\r\n\r\n            HttpEntity getResponseEntity = getResponse.getEntity();\r\n\r\n            if (getResponseEntity != null) {\r\n                return EntityUtils.toString(getResponseEntity);\r\n            }\r\n\r\n        } \r\n        catch (IOException e) {\r\n            getRequest.abort();\r\n            Log.w(getClass().getSimpleName(), \"Error for URL \" + url, e);\r\n        }\r\n\r\n        return null;\r\n\r\n    }\r\n    \r\n}\r\n<\/pre>\n<p>This is a typical <a href=\"http:\/\/www.javacodegeeks.com\/2010\/10\/android-full-app-part-1-main-activity.html\">Android Activity<\/a>. We retrieve the XML document as an internet resource (check my tutorial on <a href=\"http:\/\/www.javacodegeeks.com\/2010\/10\/android-full-app-part-2-using-http-api.html\">how to use the HTTP API<\/a>) and then create a <a href=\"http:\/\/download.oracle.com\/javase\/1.5.0\/docs\/api\/java\/io\/StringReader.html\">StringReader<\/a> from the response. We feed the <a href=\"http:\/\/simple.sourceforge.net\/download\/stream\/doc\/javadoc\/org\/simpleframework\/xml\/Serializer.html\">Serializer<\/a> with that and then let Simple perform its magic and return as a full class with the appropriate fields and embedded classes all populated. The specific app will just dump the classes string representations to the system&#8217;s log, which can be monitored in the DDMS view.<\/p>\n<p>That&#8217;s all guys. No more manual XML parsing for me. As always, you can <a href=\"http:\/\/dl.dropbox.com\/u\/7215751\/JavaCodeGeeks\/AndroidXmlBindSimpleTutorial\/AndroidXmlBindSimpleProject.zip\">download the Eclipse project<\/a> created for this tutorial.<\/p>\n<p>Happy Android coding! And don&#8217;t forget to share!<\/p>\n<p><strong>Related Articles:<\/strong> <\/p>\n<ul style=\"text-align: left\">\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2010\/10\/android-full-application-tutorial.html\">\u201cAndroid Full Application Tutorial\u201d series<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2010\/11\/boost-android-xml-parsing-xml-pull.html\">Boost your Android XML parsing with XML Pull<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2010\/09\/android-text-to-speech-application.html\">Android Text-To-Speech Application<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2010\/09\/android-location-based-services.html\">Android Location Based Services Application \u2013 GPS location<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2010\/06\/install-android-os-on-pc-with.html\">Install Android OS on your PC with VirtualBox<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>XML is still important in the area of web services even though REST has gained significant attention lately. Exposed APIs via web services is the main reason I have to manipulate XML content in my Android applications. For that reason I need to parse XML documents even though it is a tedious procedure. In the &hellip;<\/p>\n","protected":false},"author":3,"featured_media":232,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[83,154,107],"class_list":["post-378","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android-core","tag-android-tutorial","tag-simple","tag-xml"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android XML Binding with Simple Framework Tutorial - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"XML is still important in the area of web services even though REST has gained significant attention lately. Exposed APIs via web services is the main\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android XML Binding with Simple Framework Tutorial - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"XML is still important in the area of web services even though REST has gained significant attention lately. Exposed APIs via web services is the main\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2011-02-03T00:02:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-10-21T19:38:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/simple-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ilias Tsagklis\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ilias Tsagklis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/android-xml-binding-simple-tutorial.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/android-xml-binding-simple-tutorial.html\"},\"author\":{\"name\":\"Ilias Tsagklis\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/9a83496b285d30c61e8a674625c1350e\"},\"headline\":\"Android XML Binding with Simple Framework Tutorial\",\"datePublished\":\"2011-02-03T00:02:00+00:00\",\"dateModified\":\"2012-10-21T19:38:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/android-xml-binding-simple-tutorial.html\"},\"wordCount\":1015,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/android-xml-binding-simple-tutorial.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/simple-logo.jpg\",\"keywords\":[\"Android Tutorial\",\"Simple\",\"XML\"],\"articleSection\":[\"Android Core\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/android-xml-binding-simple-tutorial.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/android-xml-binding-simple-tutorial.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/android-xml-binding-simple-tutorial.html\",\"name\":\"Android XML Binding with Simple Framework Tutorial - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/android-xml-binding-simple-tutorial.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/android-xml-binding-simple-tutorial.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/simple-logo.jpg\",\"datePublished\":\"2011-02-03T00:02:00+00:00\",\"dateModified\":\"2012-10-21T19:38:26+00:00\",\"description\":\"XML is still important in the area of web services even though REST has gained significant attention lately. Exposed APIs via web services is the main\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/android-xml-binding-simple-tutorial.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/android-xml-binding-simple-tutorial.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/android-xml-binding-simple-tutorial.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/simple-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/simple-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/android-xml-binding-simple-tutorial.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/android\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Android Core\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/android\\\/android-core\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Android XML Binding with Simple Framework Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/9a83496b285d30c61e8a674625c1350e\",\"name\":\"Ilias Tsagklis\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/43505f28bb49f6e290c24be0b209ccc1af350f0f6587025ffd4847ef44bf6b78?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/43505f28bb49f6e290c24be0b209ccc1af350f0f6587025ffd4847ef44bf6b78?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/43505f28bb49f6e290c24be0b209ccc1af350f0f6587025ffd4847ef44bf6b78?s=96&d=mm&r=g\",\"caption\":\"Ilias Tsagklis\"},\"description\":\"Ilias is a software developer turned online entrepreneur. He is co-founder and Executive Editor at Java Code Geeks.\",\"sameAs\":[\"http:\\\/\\\/www.iliastsagklis.com\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/iliastsagklis\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/ilias-tsagklis\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android XML Binding with Simple Framework Tutorial - Java Code Geeks","description":"XML is still important in the area of web services even though REST has gained significant attention lately. Exposed APIs via web services is the main","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html","og_locale":"en_US","og_type":"article","og_title":"Android XML Binding with Simple Framework Tutorial - Java Code Geeks","og_description":"XML is still important in the area of web services even though REST has gained significant attention lately. Exposed APIs via web services is the main","og_url":"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2011-02-03T00:02:00+00:00","article_modified_time":"2012-10-21T19:38:26+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/simple-logo.jpg","type":"image\/jpeg"}],"author":"Ilias Tsagklis","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Ilias Tsagklis","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html"},"author":{"name":"Ilias Tsagklis","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/9a83496b285d30c61e8a674625c1350e"},"headline":"Android XML Binding with Simple Framework Tutorial","datePublished":"2011-02-03T00:02:00+00:00","dateModified":"2012-10-21T19:38:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html"},"wordCount":1015,"commentCount":5,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/simple-logo.jpg","keywords":["Android Tutorial","Simple","XML"],"articleSection":["Android Core"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html","url":"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html","name":"Android XML Binding with Simple Framework Tutorial - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/simple-logo.jpg","datePublished":"2011-02-03T00:02:00+00:00","dateModified":"2012-10-21T19:38:26+00:00","description":"XML is still important in the area of web services even though REST has gained significant attention lately. Exposed APIs via web services is the main","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/simple-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/simple-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/android-xml-binding-simple-tutorial.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Android","item":"https:\/\/www.javacodegeeks.com\/category\/android"},{"@type":"ListItem","position":3,"name":"Android Core","item":"https:\/\/www.javacodegeeks.com\/category\/android\/android-core"},{"@type":"ListItem","position":4,"name":"Android XML Binding with Simple Framework Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/9a83496b285d30c61e8a674625c1350e","name":"Ilias Tsagklis","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/43505f28bb49f6e290c24be0b209ccc1af350f0f6587025ffd4847ef44bf6b78?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/43505f28bb49f6e290c24be0b209ccc1af350f0f6587025ffd4847ef44bf6b78?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/43505f28bb49f6e290c24be0b209ccc1af350f0f6587025ffd4847ef44bf6b78?s=96&d=mm&r=g","caption":"Ilias Tsagklis"},"description":"Ilias is a software developer turned online entrepreneur. He is co-founder and Executive Editor at Java Code Geeks.","sameAs":["http:\/\/www.iliastsagklis.com\/","https:\/\/www.linkedin.com\/in\/iliastsagklis"],"url":"https:\/\/www.javacodegeeks.com\/author\/ilias-tsagklis"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/378","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=378"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/378\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/232"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=378"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=378"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}