<?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 for lalit.org</title>
	<atom:link href="http://www.lalit.org/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lalit.org</link>
	<description>greater than 0, less than 1</description>
	<lastBuildDate>Wed, 02 May 2012 13:30:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>Comment on Array2XML: convert PHP Array to XML (with attributes and CDATA) by Lalit</title>
		<link>http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes/#comment-30326</link>
		<dc:creator>Lalit</dc:creator>
		<pubDate>Wed, 02 May 2012 13:30:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.lalit.org/?p=513#comment-30326</guid>
		<description>Hi Ben,
XML tag names cannot be numbers or start with numbers. Hence I treat it as multiple &lt;code&gt;similarArtists&lt;/code&gt; tags</description>
		<content:encoded><![CDATA[<p>Hi Ben,<br />
XML tag names cannot be numbers or start with numbers. Hence I treat it as multiple <code>similarArtists</code> tags</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Array2XML: convert PHP Array to XML (with attributes and CDATA) by Lalit</title>
		<link>http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes/#comment-30325</link>
		<dc:creator>Lalit</dc:creator>
		<pubDate>Wed, 02 May 2012 13:26:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.lalit.org/?p=513#comment-30325</guid>
		<description>Thanks for pointing it out. I have fixed the issue and uploaded the new version 0.8!</description>
		<content:encoded><![CDATA[<p>Thanks for pointing it out. I have fixed the issue and uploaded the new version 0.8!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Array2XML: convert PHP Array to XML (with attributes and CDATA) by vladimir onisim</title>
		<link>http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes/#comment-30150</link>
		<dc:creator>vladimir onisim</dc:creator>
		<pubDate>Mon, 30 Apr 2012 11:45:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.lalit.org/?p=513#comment-30150</guid>
		<description>Hello, 

I think there is a small issue still. The &amp; is xml escaped twice.
The problem comes from the fact that you don&#039;t need to xml escape your data yourself with neither htmlspecialchars nor htmlentities because the DomDocument takes care of this protection. I removed those instructions and it works. 
Of course, you can&#039;t simply display this output XML in a web page, you must do a htmlentities( $xml-&gt;saveXML() ) to see the final string. 

The only thing I don&#039;t like with the DomDocument class, is that it doesn&#039;t xml escape the simple quote (&#039;) as it should (it works for  &amp; &quot; but not &#039; ). They consider they will never internally use a (&#039;)  as reserved xml char (but use &quot; instead) so they don&#039;t need to encode the (&#039;). It&#039;s a small mistake in my humble opinion.</description>
		<content:encoded><![CDATA[<p>Hello, </p>
<p>I think there is a small issue still. The &amp; is xml escaped twice.<br />
The problem comes from the fact that you don&#8217;t need to xml escape your data yourself with neither htmlspecialchars nor htmlentities because the DomDocument takes care of this protection. I removed those instructions and it works.<br />
Of course, you can&#8217;t simply display this output XML in a web page, you must do a htmlentities( $xml-&gt;saveXML() ) to see the final string. </p>
<p>The only thing I don&#8217;t like with the DomDocument class, is that it doesn&#8217;t xml escape the simple quote (&#8216;) as it should (it works for  &amp; &#8221; but not &#8216; ). They consider they will never internally use a (&#8216;)  as reserved xml char (but use &#8221; instead) so they don&#8217;t need to encode the (&#8216;). It&#8217;s a small mistake in my humble opinion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Array2XML: convert PHP Array to XML (with attributes and CDATA) by Ben</title>
		<link>http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes/#comment-30143</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Mon, 30 Apr 2012 10:54:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.lalit.org/?p=513#comment-30143</guid>
		<description>Possible bug?

When converting Arrays where the index is a numeric version, eg:
&lt;pre lang=&quot;php&quot;&gt;[similarArtists] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [name] =&gt; Freddie Mercury
                    [match] =&gt; 1
                )

            [1] =&gt; Array
                (
                    [name] =&gt; Brian May
                    [match] =&gt; 0.656711
                )&lt;/pre&gt;
Converts into XML as...
&lt;pre lang=&quot;xml&quot;&gt;
&lt;similarArtists&gt;
&lt;name&gt;Freddie Mercury&lt;/name&gt;
&lt;match&gt;1&lt;/match&gt;
&lt;/similarArtists&gt;
&lt;similarArtists&gt;
&lt;name&gt;Brian May&lt;/name&gt;
&lt;match&gt;0.656711&lt;/match&gt;
&lt;/similarArtists&gt;
&lt;/pre&gt;

Where &#039;similarArtists&#039; should be one container node with 0,1,2 etc sub nodes.

Any thoughts?</description>
		<content:encoded><![CDATA[<p>Possible bug?</p>
<p>When converting Arrays where the index is a numeric version, eg:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #009900;">&#91;</span>similarArtists<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
                <span style="color: #009900;">&#40;</span>
                    <span style="color: #009900;">&#91;</span>name<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> Freddie Mercury
                    <span style="color: #009900;">&#91;</span>match<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span>
                <span style="color: #009900;">&#41;</span>
&nbsp;
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
                <span style="color: #009900;">&#40;</span>
                    <span style="color: #009900;">&#91;</span>name<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> Brian May
                    <span style="color: #009900;">&#91;</span>match<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color:#800080;">0.656711</span>
                <span style="color: #009900;">&#41;</span></pre></div></div>

<p>Converts into XML as&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="xml"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;similarArtists<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Freddie Mercury<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;match<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/match<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/similarArtists<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;similarArtists<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Brian May<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;match<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>0.656711<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/match<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/similarArtists<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Where &#8216;similarArtists&#8217; should be one container node with 0,1,2 etc sub nodes.</p>
<p>Any thoughts?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Array2XML: convert PHP Array to XML (with attributes and CDATA) by Ario</title>
		<link>http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes/#comment-23469</link>
		<dc:creator>Ario</dc:creator>
		<pubDate>Sun, 25 Mar 2012 11:14:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.lalit.org/?p=513#comment-23469</guid>
		<description>This code of yours is the most complete solution I found on the interwebs. So great work :)

I just did a little tweak to your code though, in method Array2XML::createXML, I replaced this line:

&lt;code&gt;
    $xml-&gt;appendChild(self::convert($node_name, $arr));
&lt;/code&gt;

to this.

&lt;code&gt;
    if (count($arr) &gt; 1) {
      $xml-&gt;appendChild(self::convert($node_name, $arr));
    } else {
      $root_element = array_pop(array_keys($arr));
      $xml-&gt;insertBefore(self::convert($root_element, $arr[$root_element]));
    }
&lt;/code&gt;

Why? Because sometimes I want to use the first array key found to be the root element. Instead of having to specify a new root element as the container.</description>
		<content:encoded><![CDATA[<p>This code of yours is the most complete solution I found on the interwebs. So great work <img src='http://www.lalit.org/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I just did a little tweak to your code though, in method Array2XML::createXML, I replaced this line:</p>
<p><code><br />
    $xml-&gt;appendChild(self::convert($node_name, $arr));<br />
</code></p>
<p>to this.</p>
<p><code><br />
    if (count($arr) &gt; 1) {<br />
      $xml-&gt;appendChild(self::convert($node_name, $arr));<br />
    } else {<br />
      $root_element = array_pop(array_keys($arr));<br />
      $xml-&gt;insertBefore(self::convert($root_element, $arr[$root_element]));<br />
    }<br />
</code></p>
<p>Why? Because sometimes I want to use the first array key found to be the root element. Instead of having to specify a new root element as the container.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Array2XML: convert PHP Array to XML (with attributes and CDATA) by Lalit</title>
		<link>http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes/#comment-23244</link>
		<dc:creator>Lalit</dc:creator>
		<pubDate>Sat, 24 Mar 2012 09:27:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.lalit.org/?p=513#comment-23244</guid>
		<description>vernes,
I have fixed the issue. This bug was introduced in v0.7
Can you please try out your example and let me know if the new version works for you.</description>
		<content:encoded><![CDATA[<p>vernes,<br />
I have fixed the issue. This bug was introduced in v0.7<br />
Can you please try out your example and let me know if the new version works for you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Array2XML: convert PHP Array to XML (with attributes and CDATA) by Lalit</title>
		<link>http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes/#comment-23242</link>
		<dc:creator>Lalit</dc:creator>
		<pubDate>Sat, 24 Mar 2012 09:26:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.lalit.org/?p=513#comment-23242</guid>
		<description>Ario,
I have fixed the issue. This bug was introduced in v0.7</description>
		<content:encoded><![CDATA[<p>Ario,<br />
I have fixed the issue. This bug was introduced in v0.7</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Array2XML: convert PHP Array to XML (with attributes and CDATA) by Lalit</title>
		<link>http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes/#comment-23241</link>
		<dc:creator>Lalit</dc:creator>
		<pubDate>Sat, 24 Mar 2012 09:24:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.lalit.org/?p=513#comment-23241</guid>
		<description>kor3k,
I have fixed the issue. This bug was introduced in v0.7</description>
		<content:encoded><![CDATA[<p>kor3k,<br />
I have fixed the issue. This bug was introduced in v0.7</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Array2XML: convert PHP Array to XML (with attributes and CDATA) by Lalit</title>
		<link>http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes/#comment-23231</link>
		<dc:creator>Lalit</dc:creator>
		<pubDate>Sat, 24 Mar 2012 08:50:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.lalit.org/?p=513#comment-23231</guid>
		<description>Ario,
That was some debug line that I forgot to remove. 
I have uploaded a new version after removing that line.
Thanks for reporting!</description>
		<content:encoded><![CDATA[<p>Ario,<br />
That was some debug line that I forgot to remove.<br />
I have uploaded a new version after removing that line.<br />
Thanks for reporting!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on XML2Array: Convert XML to Array in PHP by Lalit</title>
		<link>http://www.lalit.org/lab/convert-xml-to-array-in-php-xml2array/#comment-23230</link>
		<dc:creator>Lalit</dc:creator>
		<pubDate>Sat, 24 Mar 2012 08:49:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.lalit.org/?p=592#comment-23230</guid>
		<description>Vicary,
Using this solution, you would loose the attributes of the leaf nodes of the XML.</description>
		<content:encoded><![CDATA[<p>Vicary,<br />
Using this solution, you would loose the attributes of the leaf nodes of the XML.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

