<?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>
	Comments on: Parsing XML strings	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/parsing-xml-strings/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/parsing-xml-strings?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=parsing-xml-strings</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Tue, 19 Nov 2019 13:41:09 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.3</generator>
	<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/parsing-xml-strings#comment-507958</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 19 Nov 2019 13:41:09 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=6838#comment-507958</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/parsing-xml-strings#comment-507957&quot;&gt;KE&lt;/a&gt;.

I typically use structs, due to the easy and efficient way that I can aggregate data from different nodes (as long as the nesting is not too deep). For example, &lt;code&gt;[data.age]&lt;/code&gt; or &lt;code&gt;{data.name}&lt;/code&gt;.

There are numerous versions of &lt;code&gt;xml2struct&lt;/code&gt; on the Matlab File Exchange (&lt;a href=&quot;https://www.mathworks.com/matlabcentral/fileexchange?q=xml2struct&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;). Depending on your specific needs, you may find that some versions produce cleaner or more compact structs. I use a self-modified version of &lt;a href=&quot;https://www.mathworks.com/matlabcentral/fileexchange/28518-xml2struct&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Wouter Falkena&#039;s utility&lt;/a&gt;. My version handles a bunch of edge cases (CDATA entries etc.), and makes the resulting struct cleaner and more compact where possible - it can be &lt;a href=&quot;http://undocumentedmatlab.com/files/xml2struct.m&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;downloaded here&lt;/a&gt;.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/parsing-xml-strings#comment-507957">KE</a>.</p>
<p>I typically use structs, due to the easy and efficient way that I can aggregate data from different nodes (as long as the nesting is not too deep). For example, <code>[data.age]</code> or <code>{data.name}</code>.</p>
<p>There are numerous versions of <code>xml2struct</code> on the Matlab File Exchange (<a href="https://www.mathworks.com/matlabcentral/fileexchange?q=xml2struct" target="_blank" rel="nofollow">link</a>). Depending on your specific needs, you may find that some versions produce cleaner or more compact structs. I use a self-modified version of <a href="https://www.mathworks.com/matlabcentral/fileexchange/28518-xml2struct" target="_blank" rel="nofollow">Wouter Falkena&#8217;s utility</a>. My version handles a bunch of edge cases (CDATA entries etc.), and makes the resulting struct cleaner and more compact where possible &#8211; it can be <a href="http://undocumentedmatlab.com/files/xml2struct.m" rel="nofollow" target="_blank">downloaded here</a>.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: KE		</title>
		<link>https://undocumentedmatlab.com/articles/parsing-xml-strings#comment-507957</link>

		<dc:creator><![CDATA[KE]]></dc:creator>
		<pubDate>Tue, 19 Nov 2019 12:54:26 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=6838#comment-507957</guid>

					<description><![CDATA[Once you read your XML information into Matlab, what kind of &#039;container&#039; do you find it most useful for handing the data? I have tried nonscalar structure arrays (because that&#039;s what xml2struct produces) but it is hard to extract field data across records, for example to make a plot. Is there a better way?]]></description>
			<content:encoded><![CDATA[<p>Once you read your XML information into Matlab, what kind of &#8216;container&#8217; do you find it most useful for handing the data? I have tried nonscalar structure arrays (because that&#8217;s what xml2struct produces) but it is hard to extract field data across records, for example to make a plot. Is there a better way?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/parsing-xml-strings#comment-415552</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Thu, 26 Oct 2017 19:35:15 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=6838#comment-415552</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/parsing-xml-strings#comment-415551&quot;&gt;Peter Cook&lt;/a&gt;.

@Peter - in general, yes it would indeed be faster but you need to take into consideration that XML is much more than simple tags enclosed within &#060; and &#062;. Tags can have attributes, and comments and binary CData etc. etc. If your XML is very simple and does not contain such nuisances then text parsing would be simple and faster, but if there is a chance that the XML file contains them then you&#039;d better off rely on the more general parser for robustness.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/parsing-xml-strings#comment-415551">Peter Cook</a>.</p>
<p>@Peter &#8211; in general, yes it would indeed be faster but you need to take into consideration that XML is much more than simple tags enclosed within &lt; and &gt;. Tags can have attributes, and comments and binary CData etc. etc. If your XML is very simple and does not contain such nuisances then text parsing would be simple and faster, but if there is a chance that the XML file contains them then you&#8217;d better off rely on the more general parser for robustness.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Peter Cook		</title>
		<link>https://undocumentedmatlab.com/articles/parsing-xml-strings#comment-415551</link>

		<dc:creator><![CDATA[Peter Cook]]></dc:creator>
		<pubDate>Thu, 26 Oct 2017 18:58:01 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=6838#comment-415551</guid>

					<description><![CDATA[Yair,

I have an application I wrote that inhales rather large XML files using xml2struct and the performance is less-than-ideal. I&#039;ve got an idea from a different blog post of yours about faster ASCII file parsing via fread. The idea would be to inhale the xml file in binary mode, and look for ASCII 60 and ASCII 62 and partition the data from that starting point. Do you think this approach would lend itself to faster xml reads?]]></description>
			<content:encoded><![CDATA[<p>Yair,</p>
<p>I have an application I wrote that inhales rather large XML files using xml2struct and the performance is less-than-ideal. I&#8217;ve got an idea from a different blog post of yours about faster ASCII file parsing via fread. The idea would be to inhale the xml file in binary mode, and look for ASCII 60 and ASCII 62 and partition the data from that starting point. Do you think this approach would lend itself to faster xml reads?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/parsing-xml-strings#comment-414779</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 10 Oct 2017 23:44:37 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=6838#comment-414779</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/parsing-xml-strings#comment-414689&quot;&gt;Michal Kvasnicka&lt;/a&gt;.

@Michal - when you say that something &quot;does not work at all&quot; you provide zero information about what you tried to do and what happened. If you expect me to spend time to try to help you, then the minimum that you should do is to spend the time to include useful information that could help diagnose the problem. If you don&#039;t have the time to add this information, then I don&#039;t have the time to assist you, sorry.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/parsing-xml-strings#comment-414689">Michal Kvasnicka</a>.</p>
<p>@Michal &#8211; when you say that something &#8220;does not work at all&#8221; you provide zero information about what you tried to do and what happened. If you expect me to spend time to try to help you, then the minimum that you should do is to spend the time to include useful information that could help diagnose the problem. If you don&#8217;t have the time to add this information, then I don&#8217;t have the time to assist you, sorry.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Michal Kvasnicka		</title>
		<link>https://undocumentedmatlab.com/articles/parsing-xml-strings#comment-414689</link>

		<dc:creator><![CDATA[Michal Kvasnicka]]></dc:creator>
		<pubDate>Mon, 09 Oct 2017 14:16:40 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=6838#comment-414689</guid>

					<description><![CDATA[@Yair Undocumented functionality (first code box) does not work at all (R2017b)!!! 
I always got null result. Any workaround?]]></description>
			<content:encoded><![CDATA[<p>@Yair Undocumented functionality (first code box) does not work at all (R2017b)!!!<br />
I always got null result. Any workaround?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ondrej		</title>
		<link>https://undocumentedmatlab.com/articles/parsing-xml-strings#comment-403474</link>

		<dc:creator><![CDATA[Ondrej]]></dc:creator>
		<pubDate>Wed, 22 Mar 2017 07:47:51 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=6838#comment-403474</guid>

					<description><![CDATA[Hi Yair,
I am curious about some profiling and how fast each of the method is.
Thanks.]]></description>
			<content:encoded><![CDATA[<p>Hi Yair,<br />
I am curious about some profiling and how fast each of the method is.<br />
Thanks.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: americanlamboard.com		</title>
		<link>https://undocumentedmatlab.com/articles/parsing-xml-strings#comment-400208</link>

		<dc:creator><![CDATA[americanlamboard.com]]></dc:creator>
		<pubDate>Tue, 14 Feb 2017 09:55:33 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=6838#comment-400208</guid>

					<description><![CDATA[@shsteimer I am passing in xml string and it is returning null. It does not throw any exception. What must be wrong?]]></description>
			<content:encoded><![CDATA[<p>@shsteimer I am passing in xml string and it is returning null. It does not throw any exception. What must be wrong?</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
