<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Xml on Living Systems_</title>
    <link>https://livesys.se/tags/xml/</link>
    <description>Recent content in Xml on Living Systems_</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 15 Mar 2018 15:19:00 +0100</lastBuildDate>
    <atom:link href="https://livesys.se/tags/xml/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Parsing DrugBank XML (or any large XML file) in streaming mode in Go</title>
      <link>https://livesys.se/posts/parsing-drugbank-xml-or-any-large-xml-file-in-streaming-mode-in-go/</link>
      <pubDate>Thu, 15 Mar 2018 15:19:00 +0100</pubDate>
      <guid>https://livesys.se/posts/parsing-drugbank-xml-or-any-large-xml-file-in-streaming-mode-in-go/</guid>
      <description>&lt;p&gt;I had a problem in which I thought I needed to parse the full&#xA;&lt;a href=&#34;https://www.drugbank.ca&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;DrugBank&lt;/a&gt;&#xA; dataset, which comes as a &lt;a href=&#34;https://www.drugbank.ca/releases/5-0-11/downloads/all-full-database&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;(670MB) XML file&lt;/a&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;(For open access papers describing DrugBank, see: &lt;!-- raw HTML omitted --&gt;[1]&lt;!-- raw HTML omitted --&gt;, &lt;!-- raw HTML omitted --&gt;[2]&lt;!-- raw HTML omitted --&gt;, &lt;!-- raw HTML omitted --&gt;[3]&lt;!-- raw HTML omitted --&gt; and &lt;!-- raw HTML omitted --&gt;[4]&lt;!-- raw HTML omitted --&gt;).&lt;!-- raw HTML omitted --&gt; It turned out what I needed was available as CSV&#xA;files under &amp;ldquo;&lt;a href=&#34;https://www.drugbank.ca/releases/latest#structures&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Structure External&#xA;Links&lt;/a&gt;&#xA;&amp;rdquo;. There is probably&#xA;still some other uses of this approach though, as the XML version of DrugBank&#xA;seems to contain a lot more information in a single format. And in any case,&#xA;this forced me to figure out how to parse large XML files in a streaming&#xA;fashion in Go, as older tools like&#xA;&lt;a href=&#34;http://xmlstar.sourceforge.net/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;XMLStarlet&lt;/a&gt;&#xA; chokes for many minutes upon the&#xA;DrugBank file (trying to read it all into memory?), killing any attempt at an&#xA;iterative development cycle. And, it turns out Go&amp;rsquo;s support for streaming XML&#xA;parsing is just great!&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
