We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Parsing XML with simpleML
Page Index Toggle Pages: 1
Parsing XML with simpleML (Read 578 times)
Parsing XML with simpleML
Jan 21st, 2010, 6:59am
 
Hello hello, I am having trouble getting hold of a particular bit of data from an xml file, I have been able to retrieve arrays of recurring tags  ok, but this bit is coded slightly differently in the xml and I think its stopping my code from working.
The bit of xml I'm struggling with is here:
Code:
			<author>nobody@cagd.leedsmet.ac.uk (Josephine Payne)</author>
<pubDate>Thu, 21 Jan 2010 12:55:01 +0000</pubDate>
<link>http://cagd.leedsmet.ac.uk/show.php?ref=078501_87da0c</link>
<guid isPermaLink="false">cagd.leedsmet.ac.uk/3000002/078501_87da0c</guid>
</item>
<item>
<title>page3</title>
<description><![CDATA[

<p>Josephine Payne posted an image.</p>
<p>
<img src="http://cagd.leedsmet.ac.uk/media/8/078501_dc4539_m.jpg?r=2121155869">
</p>
]]></description>


I'm after this bit: <img src="http://cagd.leedsmet.ac.uk/media/8/078501_dc4539_m.jpg?r=2121155869">
..but I dont seem to be able to grab it like a normal attribute. - Should I resort to parsing through the full html for this(there are many links like this one)?

I am using the simpleML library. Thanks!
Re: Parsing XML with simpleML
Reply #1 - Jan 21st, 2010, 9:07am
 
I don't know simpleML, but I see the img isn't XML but HTML (it isn't closed). Actually, it is declared in a CDATA section, which allows to use free, unescaped text as a whole block. So you have to get this text and parse it in another way, from indexOf to regular expressions.
Re: Parsing XML with simpleML
Reply #2 - Jan 21st, 2010, 9:12am
 
Ok thanks I'll do that, thank you. L.
Page Index Toggle Pages: 1