<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">
	<channel>
		<title>To Parse or Not to Parse XML on Android in 2019 | Infinum</title>
		<atom:link href="https://infinum.com/blog/to-parse-or-not-to-parse-xml-on-android-in-2019/feed/" rel="self" type="application/rss+xml" />
		<link>https://infinum.com/blog/to-parse-or-not-to-parse-xml-on-android-in-2019/</link>
		<description>Building digital products</description>
		<lastBuildDate>Wed, 08 Apr 2026 14:17:14 +0000</lastBuildDate>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>

					<item>
				<image>
					<url>7950https://infinum.com/uploads/2019/08/to-parse-or-not-to-parse-xml-on-android-in-2019-0.webp</url>
				</image>
				<title>To Parse or Not to Parse XML on Android in 2019</title>
				<link>https://infinum.com/blog/to-parse-or-not-to-parse-xml-on-android-in-2019/</link>
				<pubDate>Wed, 28 Aug 2019 11:30:00 +0000</pubDate>
				<dc:creator>Bojan Komljenović</dc:creator>
				<guid isPermaLink="false">https://infinum.com/the-capsized-eight/to-parse-or-not-to-parse-xml-on-android-in-2019/</guid>
				<description>
					<![CDATA[<p>XML support on Android sucks. Would it be more efficient to propose an alternative solution to parsing XML altogether?</p>
<p>The post <a href="https://infinum.com/blog/to-parse-or-not-to-parse-xml-on-android-in-2019/">To Parse or Not to Parse XML on Android in 2019</a> appeared first on <a href="https://infinum.com">Infinum</a>.</p>
]]>
				</description>
				<content:encoded>
					<![CDATA[<div
	class="wrapper"
	data-id="es-198"
	 data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-blog-content js-block-blog-content">
	
<div class="block-blog-content-sidebar" data-id="es-92">
	</div>

<div class="block-blog-content-main">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-95"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-93">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-94'
	>
	<strong>In the early days of Android development, it was an exhaustive task to cover all tags in the document and provide a structured hierarchy for the rest of the project business logic. Nowadays, we are presented with various libraries to parse an XML document– does it mean we can do it more efficiently?</strong></p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-98"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-96">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-97'
	>
	Occasionally, you will be challenged to parse XML in your Android project. Most often, this is a case of parsing XML HTTP responses from a remote server or perhaps a static asset file packaged and provided within the application.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-101"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-99">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-100'
	>
	Once upon a time in Android</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-104"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-102">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-103'
	>
	In the early days of Android development, covering all tags in a document and providing a structured hierarchy for the rest of the project business logic used to be an exhaustive task.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-107"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-105">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-106'
	>
	Whether you decide to use <a href="https://www.w3schools.com/xml/xml_dom.asp">DOM</a> or <a href="https://docs.oracle.com/javase/tutorial/jaxp/sax/parsing.html">SAX</a> parsing, performance and memory footprint will eventually become an issue when processing XML on a mobile platform like Android. XML is document-oriented, and these documents grow in size quickly, spending more and more resources to accomplish the same task.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-110"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-108">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-109'
	>
	A structured document in XML has a beginning and an end tag which by itself is unnecessary and results in more data for the same amount of information. For example, compared to JSON, XML doesn’t support arrays, but it does support many more data types than just text, numbers and booleans. However, these so-called benefits, often lead to a fragile codebase with high maintenance.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-113"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-111">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-112'
	>
	Nowadays, you are presented with various libraries to parse an XML document, so let’s see whether anything has improved and can we do this more efficiently today.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-116"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-114">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-115'
	>
	To parse or not to parse?</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-119"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-117">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-118'
	>
	<a href="https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html">XmlPullParser</a> is available as the go-to solution ever since API 1. It’s an interface based on specification found on <a href="http://www.xmlpull.org/">xmlpull.org</a> . A minimal implementation example is provided in the documentation, but once you look at it, you realize how its footprint will grow as your XML document grows.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-122"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-120">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-121'
	>
	The natural decision would be to look for a higher level of implementation–which brings us to <a href="https://github.com/stefanhaustein/kxml2">kxml2</a>. Unfortunately, it’s very old and borderline obsolete. Furthermore, your boilerplate would have boilerplate, execution can be linear and very slow, and there aren‘t any integrations with modern Android tooling.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-125"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-123">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-124'
	>
	<a href="http://simple.sourceforge.net/">Simple XML Serialization</a>, or just SimpleXML as we all know it, has been the preferred solution for most Android developers for at least half a dozen years now. It’s a high-performance serialization and configuration framework for Java which works on Android and doesn’t demand any additional configuration in order to serialize objects.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-128"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-126">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-127'
	>
	However, when it comes to Android, as a dependency, there are issues with latently dependent libraries with a high collision risk.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-131"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-129">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-130'
	>
	The Android implementation assumes excluding <a href="https://docs.oracle.com/javase/tutorial/jaxp/stax/why.html">StAX</a> modules because they are already included in Android. Reminiscing about this implementation recipe seems redundant, but when encountered for the first time, it will cost you several hours to figure out.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-134"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-132">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-133'
	>
	SimpleXML has a bare minimum Kotlin support and relatively hideous model mapping, but the worst part about it is its <a href="https://github.com/square/retrofit/tree/master/retrofit-converters/simplexml">deprecated Retrofit converter</a>.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-137"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-media">
	<div	class="media block-media__media media__border--none media__align--center-center"
	data-id="es-135"
	 data-media-type='image'>

	<figure class="image block-media__image-figure image--size-stretch" data-id="es-136">
	<picture class="image__picture block-media__image-picture">
								
			<source
				srcset=https://infinum.com/uploads/2019/08/to-parse-or-not-to-parse-xml-on-android-in-2019-1-1400x384.webp				media='(max-width: 699px)'
				type=image/webp								height="384"
												width="1400"
				 />
												<img
					src="https://infinum.com/uploads/2019/08/to-parse-or-not-to-parse-xml-on-android-in-2019-1.webp"
					class="image__img block-media__image-img"
					alt=""
										height="403"
															width="1469"
										loading="lazy"
					 />
					</picture>

	</figure></div></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-140"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-138">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-139'
	>
	Looking at <a href="https://github.com/square/retrofit/tree/master/retrofit-converters/jaxb">JAXB converter</a> only resulted in an encapsulated disappointment. It’s allegedly fast, but we’ll never know because it does not work on Android.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-143"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-media">
	<div	class="media block-media__media media__border--none media__align--center-center"
	data-id="es-141"
	 data-media-type='image'>

	<figure class="image block-media__image-figure image--size-stretch" data-id="es-142">
	<picture class="image__picture block-media__image-picture">
								
			<source
				srcset=https://infinum.com/uploads/2019/08/to-parse-or-not-to-parse-xml-on-android-in-2019-2-1400x404.webp				media='(max-width: 699px)'
				type=image/webp								height="404"
												width="1400"
				 />
												<img
					src="https://infinum.com/uploads/2019/08/to-parse-or-not-to-parse-xml-on-android-in-2019-2.webp"
					class="image__img block-media__image-img"
					alt=""
										height="420"
															width="1454"
										loading="lazy"
					 />
					</picture>

	</figure></div></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-146"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-144">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-145'
	>
	There are other viable options like <a href="https://x-stream.github.io/index.html">XStream</a> or <a href="https://commons.apache.org/proper/commons-digester/">Digester</a>, but each one has its own set of issues and requires a complex initial setup and additional code just to parse one XML document. Not to mention writing and maintaining a dedicated Retrofit converter for each of them.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-149"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-147">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-148'
	>
	What are your options, really</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-152"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-150">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-151'
	>
	Honestly, there is only one option. You probably want to parse an XML document and be done with it in the most simple way there is. You don’t want to bloat your codebase by writing a parser from scratch just for this task or project and, of course, you want the best value with the least implementing effort.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-157"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="blockquote block-blockquote__blockquote" data-id="es-153">
	
	<div class="blockquote__content">
		<i
	class="icon blockquote__icon icon--size-16 icon--scale-100"
	 aria-hidden='true' data-name='blockquote-24' data-id='es-154'>
	<svg fill='none' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='m12 24c6.6274 0 12-5.3726 12-12 0-2.79685-.9568-5.37021-2.561-7.41062-.581.22951-1.0832.60583-1.5069 1.12898-.5132.60844-.7698 1.41969-.7698 2.43375v.07605h2.5789v5.59004h-5.6197v-5.01962c0-1.11547.154-2.06616.4619-2.85205.3336-.81125.757-1.48307 1.2702-2.01545.528-.52161 1.1175-.92155 1.7687-1.1998-2.0728-1.70651-4.7279-2.73128-7.6223-2.73128-6.62742 0-12 5.37258-12 12 0 6.6274 5.37258 12 12 12zm-3.53811-18.05347c-.30793.78589-.46189 1.73658-.46189 2.85205v5.01962h5.6197v-5.59004h-2.5789v-.07605c0-1.01406.2566-1.82531.7698-2.43375.5389-.63379 1.1804-1.05209 1.9245-1.2549v-2.28164c-.7441.07605-1.4626.25351-2.1555.53238-.6928.27887-1.3086.68449-1.84752 1.21688-.51321.53238-.9366 1.2042-1.27019 2.01545z' fill='currentColor' fill-rule='evenodd'/></svg></i><p	class='typography typography--size-36-text js-typography blockquote__quote'
	data-id='es-155'
	>
	SimpleXML is your only viable choice if you don’t mind deprecation and ugly Kotlin code.</p>
		<div class="blockquote__caption-wrap">
					</div>
	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-160"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-158">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-159'
	>
	How to use SimpleXML, that is the question</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-163"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-161">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-162'
	>
	Start by properly adding dependencies.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-165"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-php github-light" data-language="php" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">
</span></span><span class="line"><span class="token" style="color: #6f42c1;">implementation</span><span class="token">(</span><span class="token" style="color: #005cc5;">’com</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #005cc5;">squareup</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #005cc5;">retrofit2</span><span class="token">:</span><span class="token" style="color: #005cc5;">converter</span><span class="token" style="color: #d73a49;">-</span><span class="token" style="color: #005cc5;">simplexml</span><span class="token">:</span><span class="token" style="color: #005cc5;">2</span><span class="token" style="color: #005cc5;">.</span><span class="token" style="color: #005cc5;">6</span><span class="token" style="color: #005cc5;">.</span><span class="token" style="color: #005cc5;">1</span><span class="token" style="color: #005cc5;">’</span><span class="token">)</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #005cc5;">exclude</span><span class="token"> </span><span class="token" style="color: #005cc5;">module</span><span class="token">:</span><span class="token"> </span><span class="token" style="color: #005cc5;">’stax’</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #005cc5;">exclude</span><span class="token"> </span><span class="token" style="color: #005cc5;">module</span><span class="token">:</span><span class="token"> </span><span class="token" style="color: #005cc5;">’stax</span><span class="token" style="color: #d73a49;">-</span><span class="token" style="color: #005cc5;">api’</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #005cc5;">exclude</span><span class="token"> </span><span class="token" style="color: #005cc5;">module</span><span class="token">:</span><span class="token"> </span><span class="token" style="color: #005cc5;">’xpp3’</span><span class="token">
</span></span><span class="line"><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-168"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-166">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-167'
	>
	Create a simple model with correct annotations.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-170"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-php github-light" data-language="php" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">import</span><span class="token"> </span><span class="token" style="color: #005cc5;">org</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #005cc5;">simpleframework</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #005cc5;">xml</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #005cc5;">Attribute</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">import</span><span class="token"> </span><span class="token" style="color: #005cc5;">org</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #005cc5;">simpleframework</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #005cc5;">xml</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #005cc5;">Element</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">import</span><span class="token"> </span><span class="token" style="color: #005cc5;">org</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #005cc5;">simpleframework</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #005cc5;">xml</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #005cc5;">Root</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token" style="color: #d73a49;">@</span><span class="token" style="color: #005cc5;">Root</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">data</span><span class="token"> </span><span class="token" style="color: #d73a49;">class</span><span class="token"> </span><span class="token" style="color: #6f42c1;">RssResource</span><span class="token">(
</span></span><span class="line"><span class="token">    @field:Attribute(name = &quot;version&quot;, required = false)
</span></span><span class="line"><span class="token">    @param:Attribute(name = &quot;version&quot;, required = false)
</span></span><span class="line"><span class="token">    val version: String? = null,
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    @field:Attribute(name = &quot;base&quot;, required = false)
</span></span><span class="line"><span class="token">    @param:Attribute(name = &quot;base&quot;, required = false)
</span></span><span class="line"><span class="token">    val base: String? = null,
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    @field:Element(name = &quot;channel&quot;, required = false)
</span></span><span class="line"><span class="token">    @param:Element(name = &quot;channel&quot;, required = false)
</span></span><span class="line"><span class="token">    val channel: ChannelResource? = null
</span></span><span class="line"><span class="token">)
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-173"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-171">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-172'
	>
	JSON to the rescue?</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-176"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-174">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-175'
	>
	It would be great if you can avoid parsing XML entirely when working on an Android or any other mobile project. Like any other tool, protocol, or language, it has its advantages. However, these are neither relevant nor utilized on a mobile platform.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-181"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="blockquote block-blockquote__blockquote" data-id="es-177">
	
	<div class="blockquote__content">
		<i
	class="icon blockquote__icon icon--size-16 icon--scale-100"
	 aria-hidden='true' data-name='blockquote-24' data-id='es-178'>
	<svg fill='none' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='m12 24c6.6274 0 12-5.3726 12-12 0-2.79685-.9568-5.37021-2.561-7.41062-.581.22951-1.0832.60583-1.5069 1.12898-.5132.60844-.7698 1.41969-.7698 2.43375v.07605h2.5789v5.59004h-5.6197v-5.01962c0-1.11547.154-2.06616.4619-2.85205.3336-.81125.757-1.48307 1.2702-2.01545.528-.52161 1.1175-.92155 1.7687-1.1998-2.0728-1.70651-4.7279-2.73128-7.6223-2.73128-6.62742 0-12 5.37258-12 12 0 6.6274 5.37258 12 12 12zm-3.53811-18.05347c-.30793.78589-.46189 1.73658-.46189 2.85205v5.01962h5.6197v-5.59004h-2.5789v-.07605c0-1.01406.2566-1.82531.7698-2.43375.5389-.63379 1.1804-1.05209 1.9245-1.2549v-2.28164c-.7441.07605-1.4626.25351-2.1555.53238-.6928.27887-1.3086.68449-1.84752 1.21688-.51321.53238-.9366 1.2042-1.27019 2.01545z' fill='currentColor' fill-rule='evenodd'/></svg></i><p	class='typography typography--size-36-text js-typography blockquote__quote'
	data-id='es-179'
	>
	In most cases, XML can be replaced with JSON or similar.</p>
		<div class="blockquote__caption-wrap">
					</div>
	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-184"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-182">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-183'
	>
	JSON outperforms XML in terms of speed and memory usage, it supports arrays and has a limited number of supported data types and a simple syntax which implies a robust and stable parsing codebase. Because a mobile platform is connected to the Internet most of the time, dealing with network traffic and bandwidth, JSON has less overhead and uses less data than XML to transfer the same set of information.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-187"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-185">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-186'
	>
	The takeaway</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-190"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-188">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-189'
	>
	Personally, I think XML support on Android sucks and there is no elegant way of dealing with it.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-193"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-191">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-192'
	>
	When a legitimate use case strikes, you need to decide what is it you need for parsing and how would you go about implementing it, or whether it would be more efficient to propose an alternative solution to parsing XML altogether.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-196"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-194">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-195'
	>
	To parse or not to parse–what’s it going to be?</p></div>	</div>
</div>
</div>		</div>
	</div><p>The post <a href="https://infinum.com/blog/to-parse-or-not-to-parse-xml-on-android-in-2019/">To Parse or Not to Parse XML on Android in 2019</a> appeared first on <a href="https://infinum.com">Infinum</a>.</p>
]]>
				</content:encoded>
			</item>
		
	</channel>
</rss>