<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>protung.ro &#187; xml</title>
	<atom:link href="http://www.protung.ro/tag/xml/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.protung.ro</link>
	<description></description>
	<lastBuildDate>Tue, 16 Feb 2010 18:03:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Simple XML Parser Namespace support</title>
		<link>http://www.protung.ro/2009/10/simple-xml-parser-namespace-support/</link>
		<comments>http://www.protung.ro/2009/10/simple-xml-parser-namespace-support/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 20:49:25 +0000</pubDate>
		<dc:creator>Dragos</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[namespace]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[php class]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.protung.ro/?p=241</guid>
		<description><![CDATA[I have added support for namespaces to the parser. What this means, you are now able to register a namspace in order to be able to parse the XML. Also the usage of this class changed. &#60;?php $xml = "http://www.protung.ro/feed/atom/"; // parse an Atom feed // create a new object $parser = new SimpleLargeXMLParser(); // [...]]]></description>
			<content:encoded><![CDATA[<p>I have added support for namespaces to the parser.<br />
What this means, you are now able to register a namspace in order to be able to parse the XML.</p>
<p>Also the usage of this class changed.</p>
<pre class="brush: php">&lt;?php

$xml = "http://www.protung.ro/feed/atom/"; // parse an Atom feed

// create a new object
$parser = new SimpleLargeXMLParser();
// load the XML
$parser->loadXML($xml);

// register the namespace
$parser->registerNamespace("atom", "http://www.w3.org/2005/Atom");
// this will get an array of entries
$array = $parser->parseXML("//atom:feed/atom:entry");

?&gt;
</pre>
<p>As always, you can download the new version from <a href="http://www.phpclasses.org/browse/package/5667.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.protung.ro/2009/10/simple-xml-parser-namespace-support/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>New PHP Simple Large XML Parser version</title>
		<link>http://www.protung.ro/2009/10/new-php-simple-large-xml-parser-version/</link>
		<comments>http://www.protung.ro/2009/10/new-php-simple-large-xml-parser-version/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 10:56:20 +0000</pubDate>
		<dc:creator>Dragos</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[php class]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.protung.ro/?p=225</guid>
		<description><![CDATA[I have added support for node attributes to the PHP Simple Large XML Parser class. Now it&#8217;s possible to retrieve the structure of the XML document with the attributes of the nodes. If you choose to get the nodes also the structure of the result array will be different from the non-attribute array. The new [...]]]></description>
			<content:encoded><![CDATA[<p>I have added support for node attributes to the PHP Simple Large XML Parser class.</p>
<p>Now it&#8217;s possible to retrieve the structure of the XML document with the attributes of the nodes. If you choose to get the nodes also the structure of the result array will be different from the non-attribute array.</p>
<p>The new structure will be like this:</p>
<pre class="brush: php">&lt;?php

array('value'=&gt; 'another node / value' ,
     'attributes'=&gt;array('attribute name'=&gt;'attribute value',
                    'another attribute'=&gt;'some value',
                    'yet another attribute'=&gt;'other value'
                    )
);

?&gt;</pre>
<p>In order to get the array with attributes you need to pass the 3rd parameter as true:</p>
<pre class="brush: php">&lt;?php

   SimpleLargeXMLParser::parseXML($xml, "//myFirstNode", true);

?&gt;</pre>
<p>You can download the new version from <a href="http://www.phpclasses.org/browse/package/5667.html">here</a>.</p>
<p>Please <a href="http://www.protung.ro/2009/09/php-simple-large-xml-parser/">read this post</a> for more information about the functionality of the class:</p>
]]></content:encoded>
			<wfw:commentRss>http://www.protung.ro/2009/10/new-php-simple-large-xml-parser-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP simple large XML parser</title>
		<link>http://www.protung.ro/2009/09/php-simple-large-xml-parser/</link>
		<comments>http://www.protung.ro/2009/09/php-simple-large-xml-parser/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 15:55:24 +0000</pubDate>
		<dc:creator>Dragos</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[php class]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.protung.ro/?p=180</guid>
		<description><![CDATA[I needed a simple PHP script to parse large XML files fast and without huge memory consumption, so I&#8217;ve written a small class for this. This class can be used to parse large XML files (it works with small one also) fast and with minimum of memory consumption. It can parse any valid XML and [...]]]></description>
			<content:encoded><![CDATA[<p>I needed a simple PHP script to parse large XML files fast and without huge memory consumption, so I&#8217;ve written a small class for this.</p>
<p>This class can be used to parse large XML files (it works with small one also) fast and with minimum of memory consumption.<br />
It can parse any valid XML and convert it to an array. What it does not do is to get the attributes of the nodes.<br />
If you need it, contact me and i can implement it for you if you want.</p>
<p>You can parse any part of the XML as it supports XPath with the same performance as parsing the entire XML (well, a little bit faster as it&#8217;s less data to parse)</p>
<h2><span id="more-180"></span>Here is an example</h2>
<p>Let&#8217;s say we have the following XML file (called example.xml)</p>
<pre class="brush: xml">&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
&lt;!--
/**********************
 * Example XML (not that large, but it's for demo purpose only)
 **********************/
 --&gt;
&lt;myFirstNode&gt;
	&lt;color-palettes&gt;
		&lt;color type='txt'&gt;red&lt;/color&gt;
		&lt;color type='txt'&gt;yellow&lt;/color&gt;
		&lt;color type='txt'&gt;lime&lt;/color&gt;
		&lt;color type='txt'&gt;cyan&lt;/color&gt;
		&lt;color type='txt'&gt;blue&lt;/color&gt;
		&lt;color type='txt'&gt;magenta&lt;/color&gt;
		&lt;color type='txt'&gt;white&lt;/color&gt;
		&lt;color type='txt'&gt;black&lt;/color&gt;
		&lt;color type='hex'&gt;#FF0000&lt;/color&gt;
		&lt;color type='hex'&gt;#FFFF00&lt;/color&gt;
		&lt;color type='hex'&gt;#00FF00&lt;/color&gt;
		&lt;color type='hex'&gt;#00FFFF&lt;/color&gt;
		&lt;color type='hex'&gt;#0000FF&lt;/color&gt;
		&lt;color type='hex'&gt;#FF00FF&lt;/color&gt;
		&lt;color type='hex'&gt;#FFFFFF&lt;/color&gt;
		&lt;color type='hex'&gt;#000000&lt;/color&gt;
	&lt;/color-palettes&gt;
	&lt;first-100-numbers&gt;
		&lt;number n='1'&gt;1&lt;/number&gt;
		&lt;number n='2'&gt;2&lt;/number&gt;
		&lt;number n='3'&gt;3&lt;/number&gt;
		...
		&lt;number n='97'&gt;97&lt;/number&gt;
		&lt;number n='98'&gt;98&lt;/number&gt;
		&lt;number n='99'&gt;99&lt;/number&gt;
		&lt;number n='100'&gt;100&lt;/number&gt;
	&lt;/first-10-numbers&gt;
	&lt;searchengines&gt;
		&lt;engine&gt;
			&lt;name&gt;Google&lt;/name&gt;
			&lt;website&gt;http://www.google.com&lt;/website&gt;
		&lt;/engine&gt;
		&lt;engine&gt;
			&lt;name&gt;Yahoo&lt;/name&gt;
			&lt;website&gt;http://www.yahoo.com&lt;/website&gt;
		&lt;/engine&gt;
		&lt;engine&gt;
			&lt;name&gt;Bing&lt;/name&gt;
			&lt;website&gt;http://www.bing.com&lt;/website&gt;
		&lt;/engine&gt;
	&lt;/searchengines&gt;
&lt;/myFirstNode&gt;</pre>
<p>And here is the PHP code to extract some data from it as an array:</p>
<pre class="brush: php">&lt;php

// include the class
require_once('SimpleLargeXMLParser.class.php');
$xml = "example.xml";

// get all colors in hex format as an array
$array = SimpleLargeXMLParser::parseXML($xml, "//myFirstNode/color-palettes/color[@type='hex']");

// get all numbers bigger then 50 as an array
$array = SimpleLargeXMLParser::parseXML($xml, "//myFirstNode/first-100-numbers/number[@n&gt;'50']");

// get all search engines as an array
$array = SimpleLargeXMLParser::parseXML($xml, "//myFirstNode/searchengines");

// get the full XML file as an array
// if you don't specify the first node the script will search for it and use the root node
// for performance reasons is better to specify it if you know it
$array = SimpleLargeXMLParser::parseXML($xml, "//myFirstNode"); 

?&gt;</pre>
<p>A new version is available. See <a href="http://www.protung.ro/2009/10/new-php-simple-large-xml-parser-version/">this post</a> for more information about what&#8217;s new.</p>
<h2>Download</h2>
<p>Download <a href="http://www.phpclasses.org/browse/package/5667.html">here</a>. (there are some examples in the package)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.protung.ro/2009/09/php-simple-large-xml-parser/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

