<?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>Open formats &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/open-formats/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>PHP: Does SimpleXMLElement have toString() method? No, better use asXML()!</title>
		<link>/2011/10/10/php-does-simplexmlelement-have-tostring-method-no-better-use-asxml/</link>
		<comments>/2011/10/10/php-does-simplexmlelement-have-tostring-method-no-better-use-asxml/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 11:52:49 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[Computer file formats]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Markup languages]]></category>
		<category><![CDATA[Open formats]]></category>
		<category><![CDATA[OSI protocols]]></category>
		<category><![CDATA[Technical communication]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">/?p=2362</guid>
		<description><![CDATA[SimpleXML is a PHP extension that &#8220;provides a very simple and easily usable toolset to convert XML to an object&#8221; [1]. Thus you can pass a link to an XML file and SimpleXML will return an object. $xml = simplexml_load_file('path_to_the_file'); Sometimes you&#8217;d need to dump or save the entire XML as a string, but there’s &#8230; <a href="/2011/10/10/php-does-simplexmlelement-have-tostring-method-no-better-use-asxml/" class="more-link">Continue reading <span class="screen-reader-text">PHP: Does SimpleXMLElement have toString() method? No, better use asXML()!</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/07/29/php-strings-how-to-get-the-extension-of-a-file/" rel="bookmark" title="PHP Strings: How to Get the Extension of a File">PHP Strings: How to Get the Extension of a File </a></li>
<li><a href="/2010/04/20/how-to-sanitize-user-input-in-php/" rel="bookmark" title="How to Sanitize User Input in PHP?">How to Sanitize User Input in PHP? </a></li>
<li><a href="/2010/07/14/media-rss-and-zf-part-2/" rel="bookmark" title="Media RSS and ZF &#8211; Part 2">Media RSS and ZF &#8211; Part 2 </a></li>
<li><a href="/2011/10/20/some-notes-on-the-object-oriented-model-of-php/" rel="bookmark" title="Some Notes on the Object-oriented Model of PHP">Some Notes on the Object-oriented Model of PHP </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>SimpleXML is a PHP extension that &#8220;provides a very simple and easily usable toolset to convert XML to an object&#8221; [1]. Thus you can pass a link to an XML file and SimpleXML will return an object.</p>
<pre lang="php">$xml = simplexml_load_file('path_to_the_file');</pre>
<p>Sometimes you&#8217;d need to dump or save the entire XML as a string, but there’s no toString method! As you can see $xml is an instance of the SimpleXMLElement class.</p>
<pre lang="php">var_dump($xml); // object(SimpleXMLElement)...</pre>
<p>Actually if you take a closer look:</p>
<pre lang="php">$xml->toString();</pre>
<p>will return <strong>&#8220;Call to an undefined method toString()&#8221;</strong>, which is frustrating because the developers community is used to use toString() when converting an object into a string.</p>
<figure id="attachment_2395" style="width: 448px" class="wp-caption aligncenter"><a href="/wp-content/uploads/2011/10/XML.jpg"><img src="/wp-content/uploads/2011/10/XML.jpg" alt="XML" title="XML" width="448" height="269" class="size-full wp-image-2395" srcset="/wp-content/uploads/2011/10/XML.jpg 448w, /wp-content/uploads/2011/10/XML-300x180.jpg 300w" sizes="(max-width: 448px) 100vw, 448px" /></a><figcaption class="wp-caption-text">PHP&#039;s SimpleXML doesn&#039;t have toString() method. asXML() is used instead!</figcaption></figure>
<h2>The solution</h2>
<p>In fact there’s a method doing exactly what’s needed. This is <a title="SimpleXMLElement::asXML()" href="http://www.php.net/manual/en/simplexmlelement.asxml.php" target="_blank">SimpleXMLElement::asXML</a></p>
<p>As described in the manual page: &#8220;SimpleXMLElement::asXML — Return a well-formed XML string based on SimpleXML element&#8221; [2].</p>
<p>Besides that it does exactly what&#8217;s needed it sounds irrelevant, because you&#8217;ve an XML object and the name &#8220;asXML&#8221; doesn&#8217;t describe correctly what&#8217;s expected.</p>
<pre lang="php">$xml->asXML() // ?!</pre>
<ol>
<li><a title="SimpleXMLElement::asXML" href="http://www.php.net/manual/en/intro.simplexml.php" target="_blank">SimpleXMLElement::asXML</a></li>
<li><a title="SimpleXML Introduction" href="http://www.php.net/manual/en/intro.simplexml.php" target="_blank">SimpleXML Introduction</a></li>
</ol>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/07/29/php-strings-how-to-get-the-extension-of-a-file/" rel="bookmark" title="PHP Strings: How to Get the Extension of a File">PHP Strings: How to Get the Extension of a File </a></li>
<li><a href="/2010/04/20/how-to-sanitize-user-input-in-php/" rel="bookmark" title="How to Sanitize User Input in PHP?">How to Sanitize User Input in PHP? </a></li>
<li><a href="/2010/07/14/media-rss-and-zf-part-2/" rel="bookmark" title="Media RSS and ZF &#8211; Part 2">Media RSS and ZF &#8211; Part 2 </a></li>
<li><a href="/2011/10/20/some-notes-on-the-object-oriented-model-of-php/" rel="bookmark" title="Some Notes on the Object-oriented Model of PHP">Some Notes on the Object-oriented Model of PHP </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2011/10/10/php-does-simplexmlelement-have-tostring-method-no-better-use-asxml/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery: Setting Up a Vector Path Fill Color</title>
		<link>/2010/09/27/jquery-setting-up-a-vector-path-fill-color/</link>
		<comments>/2010/09/27/jquery-setting-up-a-vector-path-fill-color/#respond</comments>
		<pubDate>Mon, 27 Sep 2010 17:37:24 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[Attribute]]></category>
		<category><![CDATA[Computer file formats]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Markup languages]]></category>
		<category><![CDATA[Open formats]]></category>
		<category><![CDATA[path]]></category>
		<category><![CDATA[Scalable Vector Graphics]]></category>
		<category><![CDATA[svg]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[vector path]]></category>

		<guid isPermaLink="false">/?p=1997</guid>
		<description><![CDATA[It&#8217;s quite unusual to think of the jQuery&#8217;s attr() method as a generic method that can only change basic attributes as value, style, etc. However attr() can change whatever DOM element attribute. In this case you may know that the SVG path element can have a fill attribute, so you can simply setup a: $('path').attr('fill', &#8230; <a href="/2010/09/27/jquery-setting-up-a-vector-path-fill-color/" class="more-link">Continue reading <span class="screen-reader-text">jQuery: Setting Up a Vector Path Fill Color</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/09/13/looping-animation-with-javascript-and-raphael/" rel="bookmark" title="Looping Animation with JavaScript and Raphaël">Looping Animation with JavaScript and Raphaël </a></li>
<li><a href="/2010/04/06/jquery-what-about-this-title/" rel="bookmark" title="jQuery: what about this.title?">jQuery: what about this.title? </a></li>
<li><a href="/2010/03/31/jquery-get-the-id-of-the-current-element/" rel="bookmark" title="jQuery Get the Id of the Current Element">jQuery Get the Id of the Current Element </a></li>
<li><a href="/2010/06/22/jquery-get-the-selected-option-text/" rel="bookmark" title="jQuery: Get the Selected Option Text">jQuery: Get the Selected Option Text </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s quite unusual to think of the jQuery&#8217;s attr() method as a generic method that can only change basic attributes as value, style, etc. However attr() can change whatever DOM element attribute. In this case you may know that the SVG path element can have a fill attribute, so you can simply setup a:</p>
<pre lang="javascript">
$('path').attr('fill', '#ccc');
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/09/13/looping-animation-with-javascript-and-raphael/" rel="bookmark" title="Looping Animation with JavaScript and Raphaël">Looping Animation with JavaScript and Raphaël </a></li>
<li><a href="/2010/04/06/jquery-what-about-this-title/" rel="bookmark" title="jQuery: what about this.title?">jQuery: what about this.title? </a></li>
<li><a href="/2010/03/31/jquery-get-the-id-of-the-current-element/" rel="bookmark" title="jQuery Get the Id of the Current Element">jQuery Get the Id of the Current Element </a></li>
<li><a href="/2010/06/22/jquery-get-the-selected-option-text/" rel="bookmark" title="jQuery: Get the Selected Option Text">jQuery: Get the Selected Option Text </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/09/27/jquery-setting-up-a-vector-path-fill-color/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
