<?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>blog.swapnilsarwe.com</title>
	<atom:link href="http://blog.swapnilsarwe.com/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.swapnilsarwe.com</link>
	<description>this blog is all about, what i do, what i feel, what i think &#38; how i deal.</description>
	<lastBuildDate>Mon, 16 Apr 2012 19:57:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>FB like Page details extractor from URL with PHP DOMDocument</title>
		<link>http://blog.swapnilsarwe.com/fb-page-details-extractor-url-php-domdocument.html</link>
		<comments>http://blog.swapnilsarwe.com/fb-page-details-extractor-url-php-domdocument.html#comments</comments>
		<pubDate>Fri, 13 Apr 2012 20:29:26 +0000</pubDate>
		<dc:creator>swapnilsarwe</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[DOMDocument]]></category>
		<category><![CDATA[getElementsByTagName]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.swapnilsarwe.com/?p=193</guid>
		<description><![CDATA[Introduction to DOMDocument class of PHP and its usage to create a facebook like URL page details extractor <a href="http://blog.swapnilsarwe.com/fb-page-details-extractor-url-php-domdocument.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I like one feature about facebook while updating status is that whenever I paste a URL, it grabs the primary details about the page and shows immediately. Which increases the chances that person viewing the post will more likely will click on it since he/she gets the summary right away.</p>
<p> I thought of mimicking the similar functionality using PHP. Well so why not lets try it.</p>
<p>Level: Beginner
<p>
You should be aware of the DOMDocument Class of PHP. If not please have a look at <a href="http://in.php.net/manual/en/class.domdocument.php" title="PHP: DOMDocument - Manual">DOMDocument</a> on <a href="http://in.php.net" title="php.net">php.net</a>. Manual is more than enough to learn DOMDocument.</p>
<p>
We are going to use very basic functions of the DOMDocument viz:<br />
1. <a title="PHP: DOMDocument::loadHTMLFile" href="http://in.php.net/manual/en/domdocument.loadhtmlfile.php">loadHTMLFile</a><br />
2. <a title="PHP: DOMDocument::getElementsByTagName" href="http://in.php.net/manual/en/domdocument.getelementsbytagname.php">getElementsByTagName</a>
</p>
<p>
We are going to create this in 3 very simple steps:</p>
<ol>
<li>Get a URL for which we want to fetch the details</li>
<li>With the use of DOMDocument fetch the details</li>
<li>Print the essential details</li>
</ol>
<p>We are going to create a class for the same, so that if required we can use it anywhere we want.</p>
<p>TO START WITH:<br />
We will create a very simple HTML form where the user will enter the URL:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;Page Extractor&lt;/title&gt;
	&lt;/head&gt;
&lt;body&gt;
	&lt;form method=&quot;get&quot; action=&quot;&quot;&gt;
		&lt;input type=&quot;text&quot; name=&quot;url&quot; /&gt;
	&lt;/form&gt;
	&lt;div class=&quot;pageinfo&quot;&gt;
		&lt;!-- --&gt;
	&lt;/div&gt;
&lt;/body&gt;
</pre>
<p>Also we will use the following class skeleton to write the feature</p>
<pre class="brush: php; title: ; notranslate">
// its the very basic singleton class
class Extractor
{
	private static $instance;
	public $url;

	public function __construct()
	{
		if(!self::$instance)
		{
			self::$instance = $this;
		}
		return self::$instance;
	}

	private function getUrl()
	{
		// it will check for the url
	}

	private function extractDetails()
	{
		// it will actually extract the details using DOMDocument
	}

	private function printDetails()
	{
		// it will just organise the fetched/extracted details
	}

	public function getPageDetails()
	{
		// this is the only exposed function to public
	}

}
</pre>
<p>Lets move on to steps now:<br />
<h3>Step 1: Get a URL for which we want to fetch the details</h3>
<p>We will just check whether the user has entered the URL before submitting the form in the following way.</p>
<pre class="brush: php; title: ; notranslate">
private function getUrl()
{
	// you should also add the validation of URL over here to check for valid url
	if(isset($_GET['url']) &amp;&amp; $_GET['url'] != '')
	{
		return $_GET['url'];
	}
	else
	{
		return false;
	}
}
</pre>
<h3>Step 2: With the use of DOMDocument fetch the details</h3>
<p>We will use the loadHTMLFile to load the URL and then perform operations to get the details out of it.</p>
<p>We are basically looking for following things:</p>
<ol>
<li>title of the page</li>
<li>images on the page</li>
<li>meta information about the page</li>
</ol>
<pre class="brush: php; title: ; notranslate">
private function extractPageDetails()
{
	$arrDetails =  null;
	$doc = new DOMDocument();
	// added @ to suppress the errors
	@$doc-&gt;loadHTMLFile($this-&gt;url);

	foreach($doc-&gt;getElementsByTagName('title') as $title)
	{
		$arrDetails['title'] = $title-&gt;nodeValue;
	}

	foreach($doc-&gt;getElementsByTagName('meta') as $meta)
	{
		// since there are lot of meta tags available with name:content
		// we will create a array of meta tags and lets see ahead what all we can use
		$arrDetails['meta'][$meta-&gt;getAttribute('name')] = $meta-&gt;getAttribute('content');
	}

	foreach($doc-&gt;getElementsByTagName('img') as $img)
	{
		// we will fetch all the images on the page and put it in array
		$arrDetails['images'][] = $img-&gt;getAttribute('src');
	}

	return $arrDetails;
}
</pre>
<h3>Step 3: Print the essential details.</h3>
<p>Well this is the just the function which will print the details fetched in Step 2</p>
<pre class="brush: php; title: ; notranslate">
private function printDetails($pageDetails)
{
	$strHTML = '';

	$strHTML .= '&lt;h2&gt;'.$pageDetails['title'].'&lt;/h2&gt;';
	$strHTML .= '&lt;div&gt;';
		if(isset($pageDetails['images']))
		{
			$strHTML .= '&lt;img src=&quot;'.$pageDetails['images'][0].'&quot; /&gt;';
		}
		if(isset($pageDetails['meta']['description']))
		{
			$strHTML .= '&lt;p&gt;';
				$strHTML .= $pageDetails['meta']['description'];
			$strHTML .= '&lt;/p&gt;';
		}

	$strHTML .= '&lt;/div&gt;';

	return $strHTML;
}
</pre>
<p>Here how the complete program will look. Have added very basic CSS to it</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
	// FB like Page details extractor from URL with PHP DOMDocument
	class Extractor
	{
		private static $instance;
		public $url;

		public function __construct()
		{
			if(!self::$instance)
			{
				$this-&gt;url = $this-&gt;getUrl();
				self::$instance = $this;
			}
			return self::$instance;
		}

		private function getUrl()
		{
			if(isset($_GET['url']) &amp;&amp; $_GET['url'] != '')
			{
				return $_GET['url'];
			}
			else
			{
				return false;
			}
		}

		private function extractPageDetails()
		{
			$arrDetails =  null;
			$doc = new DOMDocument();
			@$doc-&gt;loadHTMLFile($this-&gt;url);

			foreach($doc-&gt;getElementsByTagName('title') as $title)
			{
				$arrDetails['title'] = $title-&gt;nodeValue;
			}

			foreach($doc-&gt;getElementsByTagName('meta') as $meta)
			{

				$arrDetails['meta'][$meta-&gt;getAttribute('name')] = $meta-&gt;getAttribute('content');
			}

			foreach($doc-&gt;getElementsByTagName('img') as $img)
			{
				$arrDetails['images'][] = $img-&gt;getAttribute('src');
			}

			return $arrDetails;
		}

		private function printDetails($pageDetails)
		{
			$strHTML = '';

			$strHTML .= '&lt;h2&gt;'.$pageDetails['title'].'&lt;/h2&gt;';
			$strHTML .= '&lt;div&gt;';
				if(isset($pageDetails['images']))
				{
					$strHTML .= '&lt;img src=&quot;'.$pageDetails['images'][0].'&quot; /&gt;';
				}
				if(isset($pageDetails['meta']['description']))
				{
					$strHTML .= '&lt;p&gt;';
						$strHTML .= $pageDetails['meta']['description'];
					$strHTML .= '&lt;/p&gt;';
				}

			$strHTML .= '&lt;/div&gt;';

			return $strHTML;
		}

		public function getPageDetails()
		{
			if($this-&gt;url)
			{
				$pageDetails = $this-&gt;extractPageDetails();
				return $this-&gt;printDetails($pageDetails);
			}
			else
			{
				return '';
			}

		}
	}
	$ext = new Extractor;
?&gt;
&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;Page Extractor&lt;/title&gt;
		&lt;style type=&quot;text/css&quot;&gt;
			h2,p,img,div{ padding:0;margin:0 }
			.pageinfo{ background:#eee; font-family: Tahoma; padding:10px; overflow:hidden; }
			.pageinfo h2{ }
			.pageinfo img{ float:left; height:100px; width:100px; }
			.pageinfo p{ float:left }
		&lt;/style&gt;
	&lt;/head&gt;
&lt;body&gt;
	&lt;form method=&quot;get&quot; action=&quot;&quot;&gt;
		&lt;input type=&quot;text&quot; name=&quot;url&quot; /&gt;
	&lt;/form&gt;
	&lt;div class=&quot;pageinfo&quot;&gt;
		&lt;?php
			if($ext-&gt;url)
			{
				echo $ext-&gt;getPageDetails();
			}
		?&gt;
	&lt;/div&gt;
&lt;/body&gt;
</pre>
<p>Well thats it, this is for the beginners level. Its not even a tutorial but just the introduction to DOMDocument class and how it can be used.</p>
<p><a href="http://demos.swapnilsarwe.com/fbpagextractor/" title="Demo Page of FB like Page details extractor from URL with PHP DOMDocument">Demo Page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.swapnilsarwe.com/fb-page-details-extractor-url-php-domdocument.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Directory Listing with PHP file &amp; dir functions</title>
		<link>http://blog.swapnilsarwe.com/directory-listing-php-file-dir-functions.html</link>
		<comments>http://blog.swapnilsarwe.com/directory-listing-php-file-dir-functions.html#comments</comments>
		<pubDate>Fri, 06 Jan 2012 06:30:06 +0000</pubDate>
		<dc:creator>swapnilsarwe</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[directory]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.swapnilsarwe.com/?p=179</guid>
		<description><![CDATA[Simple beginner's tutorial to learn basic directory and file function and create a directory listing in a neatly presented with HTML &#038; CSS <a href="http://blog.swapnilsarwe.com/directory-listing-php-file-dir-functions.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I always had a habit of managing everything in different folders, be it the documents, photographs, programs or projects. So when I started web development, everyday I use to endup creating something new in the new folder. <br />
But then more the folders, more difficult to manage and remember whats in it although I use to make sure to give it a intutive name.
</p>
<p>
Then one day I decided to make my www folder more manageable or basically more identifiable. So I wrote a small program to display all the folders in an HTML file neatly.<br />
And dropped a README file into the folder with very short description which would displayed along with the folder name on the HTML page.
</p>
<p><strong>Level:</strong> Beginner</p>
<p><strong>Requirements:</strong> What we require here are very basic directory &#038; file operations in PHP. We will learns them while on the way. Classes in PHP.</p>
<p>So lets get started!!</p>
<h3>Step 1:</h3>
<p>We are going to write few independent functions.</p>
<h4>A. Function getFolders():<br />
<h4>
<p>
We are going to open the directory with <a href="http://in.php.net/manual/en/function.opendir.php">opendir()</a> function.<br />
The we are going to read each and every file and folder from the opened directory with <a href="http://in.php.net/manual/en/function.readdir.php">readdir()</a> and if its directory we are going to make a list of it.<br />
And in the end we are going to close the directory using the <a href="http://in.php.net/manual/en/function.closedir.php">closedir()</a> function.
</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
function getFolders($dir) {
    $arrFolder = null;
    if ($handle = opendir($dir)) {
        while (false !== ($file = readdir($handle))) {
            if ($file != &quot;.&quot; &amp;&amp; $file != &quot;..&quot; &amp;&amp; is_dir($file) &amp;&amp; strpos($file, '.') === false) {
                $arrFolder[] = $file;
            }
        }
        closedir($handle);
    }
    return $arrFolder;
}
echo '&lt;pre&gt;';
// we are providing '.' since it means the current directory.
print_r(getFolders('.'));
?&gt;
</pre>
<p><strong>This is how it will work. <a href="http://demos.swapnilsarwe.com/dirlist/step1a.php">Click Here</a>.</strong></p>
<h4>B. Function getReadMe():</h4>
<p>
This function will take the directory path as a parameter and then its going to check if README file exists under that folder by using the <a href="http://in.php.net/manual/en/function.file-exists.php">file_exists()</a> function.<br />
If the file exists then we are going to read the content of the file with <a href="http://in.php.net/manual/en/function.file-get-contents.php">file_get_content()</a> function.<br />
if the README file does not exists then we going to put a default message.
</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
function getReadMe($dir) {
    $filepath = $dir . '/README';
    if (file_exists($filepath)) {
        return substr(file_get_contents($filepath), 0, 100);
    } else {
        return 'No README file found for this folder';
    }
}

echo getReadMe('testfolder1');
echo '&lt;hr /&gt;';
echo getReadMe('testfolder2');
?&gt;
</pre>
<p><strong>This is how it will work. <a href="http://demos.swapnilsarwe.com/dirlist/step1b.php">Click Here</a>.</strong></p>
<h3>Step 2:</h3>
<p>
Now we are going to use the above written function to complete out program. We are going to write a simple class to achive this.<br />
Final script would be like this &#8211; with little loops of arrays and HTML and CSS.
</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

error_reporting(E_ALL);

class DirList {

    public $dirtoread = null;
    function __construct($dir) {
        $this-&gt;dirtoread = $dir;
    }

    function getFolders($dir) {
        $arrFolder = null;
        if ($handle = opendir($dir)) {
            while (false !== ($file = readdir($handle))) {
                if ($file != &quot;.&quot; &amp;&amp; $file != &quot;..&quot; &amp;&amp; is_dir($file) &amp;&amp; strpos($file, '.') === false) {
                    $arrFolder[] = $file;
                }
            }
            closedir($handle);
        }
        return $arrFolder;
    }

    function getReadMe($dir) {
        $filepath = $dir . '/README';
        if (file_exists($filepath)) {
            return substr(file_get_contents($filepath), 0, 100);
        } else {
            return 'No README file found for this folder';
        }
    }

    function printList() {
        $strHTML = '&lt;ul&gt;';

        $arrFolderList = $this-&gt;getFolders($this-&gt;dirtoread);

        if (!empty($arrFolderList) &amp;&amp; is_array($arrFolderList)) {
            if (count($arrFolderList) &gt; 0) {
                foreach ($arrFolderList as $directory) {
                    $strHTML .= '&lt;li&gt;&lt;h2&gt;&lt;a href=&quot;' . $directory . '&quot;&gt;' . $directory . '&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;' . $this-&gt;getReadMe($directory) . '&lt;/p&gt;&lt;/li&gt;';
                }
            } else {
                $strHTML .= '&lt;li&gt;no folder found&lt;/li&gt;';
            }
        }
        $strHTML .= '&lt;/ul&gt;';
        return $strHTML;
    }

}

$dir = new DirList('.');
echo '&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;List of demos&lt;/title&gt;
&lt;style&gt;
body,ul,li,a,h2,p{padding:0;margin:0}
body{background:#EEE;font-family:Verdana, Ubuntu;}
ul{list-style:none;padding:15px;}
li{background:#aaa;display:block;float:left;width: 18%;margin: 10px;padding: 5px 10px;height:150px;}
h2{border-bottom:1px solid #DDD}
a{text-decoration:none;}
p{padding:15px 5px;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;' . $dir-&gt;printList() . '&lt;/body&gt;
&lt;/html&gt;';
?&gt;
</pre>
<p><strong>This is the final step. <a href="http://demos.swapnilsarwe.com/dirlist/finalstep.php">Click Here</a>.</strong></p>
<h3>Conclusion:</h3>
<p>I hope you liked very simple but kind of effective PHP snippet. Will like if you got any suggestions or comments to make.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.swapnilsarwe.com/directory-listing-php-file-dir-functions.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Regular Expressions &#8211; Resource</title>
		<link>http://blog.swapnilsarwe.com/learning-regular-expressions-resource.html</link>
		<comments>http://blog.swapnilsarwe.com/learning-regular-expressions-resource.html#comments</comments>
		<pubDate>Thu, 15 Dec 2011 18:36:51 +0000</pubDate>
		<dc:creator>swapnilsarwe</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regular expression]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.swapnilsarwe.com/?p=165</guid>
		<description><![CDATA[Nice resource to learn the different concepts of regular expression and mastering it simultaneously. <a href="http://blog.swapnilsarwe.com/learning-regular-expressions-resource.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Regular Expression is one the the powerful term in programming world. It has become the part of the daily programming world. Although it might be simple form validation in javascript or pattern matching while crawling the webpage and yes you can do it with Regular Expression.</p>
<p>Javascript, PHP, MySQL, Python&#8230;. list does not end&#8230;. regular expression is an in built part of it. And if not then surely it has some library to support it in some way or the other.</p>
<p>Those who know it, can create magic on the go, and those who don&#8217;t know it are afraid like hell. My suggestion go visit the hell and you will never regret a thing about it.</p>
<p>Following are the the few resource from the site <a href="http://webtechtuts.com" title="Webtechtuts.com - Web development tutorial blog">www.webtechtuts.com</a></p>
<p>All Regular Expression articles on Webtechtuts.com<br />
<a href="http://webtechtuts.com/category/technology/regex/">Regex Category on Webtechtuts.com</a></p>
<p>Regular Expression:</p>
<ol>
<li><a href="http://webtechtuts.com/2011/05/24/learn-writing-regular-expression-in-60-minutes/" title="Learn writing regular expression in 60 minutes ">Learn writing regular expression in 60 minutes </a>
</li>
<li><a href="http://webtechtuts.com/2011/06/06/regex-literal-characters-and-special-characters/" title="Regex – Literal Characters And Special Characters ">Regex – Literal Characters And Special Characters </a></li>
<li><a href="http://webtechtuts.com/2011/06/06/regex-how-a-regex-engine-works-internally/" title="Regex – How a Regex Engine Works Internally? ">Regex – How a Regex Engine Works Internally? </a></li>
<li><a href="http://webtechtuts.com/2011/06/07/regex-character-classes-or-character-sets/" title="Regex – Character Classes or Character Sets ">Regex – Character Classes or Character Sets </a></li>
<li><a href="http://webtechtuts.com/2011/06/09/regex-dot-matches-almost-any-character/" title="Regex – Dot Matches (Almost) Any Character  ">Regex – Dot Matches (Almost) Any Character  </a></li>
<li><a href="http://webtechtuts.com/2011/06/23/regex-start-and-end-of-string-or-line-anchors/" title="Regex – Start and End of String or Line Anchors ">Regex – Start and End of String or Line Anchors </a></li>
<li><a href="http://webtechtuts.com/2011/07/01/regex-word-boubdries-in-regular-expression/" title="Regex – Word Boundries in Regular Expression ">Regex – Word Boundries in Regular Expression </a>
</li>
<li><a title="Regex – Alternation " href="http://webtechtuts.com/2011/07/08/regex-how-to-find-more-than-one-pattern-using-alternation/">Regex – Alternation </a>
</li>
<li><a href="http://webtechtuts.com/2011/07/18/regex-optional-item/" title="Regex – Optional Item ">Regex – Optional Item </a>
</li>
<li><a href="http://webtechtuts.com/2011/07/27/regex-repetition-using-various-quantifiers/" title="Regex – Repetition Using Various Quantifiers ">Regex – Repetition Using Various Quantifiers </a>
</li>
<li><a href="http://webtechtuts.com/2011/08/31/regex-matching-modes/" title="Regex – Matching Modes ">Regex – Matching Modes </a>
</li>
<li><a href="http://webtechtuts.com/2011/09/06/regex-free-spacing/" title="Regex – Free Spacing ">Regex – Free Spacing </a>
</li>
<li><a href="http://webtechtuts.com/2011/09/07/regex-comments/" title="Regex – Adding Comments ">Regex – Adding Comments </a>
</li>
</ol>
<p>All the best. Rule Regular Expression.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.swapnilsarwe.com/learning-regular-expressions-resource.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Javascript &#8211; Traversing the HTML DOM recursively</title>
		<link>http://blog.swapnilsarwe.com/javascript-traversing-html-dom-recursively.html</link>
		<comments>http://blog.swapnilsarwe.com/javascript-traversing-html-dom-recursively.html#comments</comments>
		<pubDate>Thu, 24 Nov 2011 19:22:30 +0000</pubDate>
		<dc:creator>swapnilsarwe</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[getElementById]]></category>
		<category><![CDATA[getElementsByTagName]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[tree]]></category>

		<guid isPermaLink="false">http://blog.swapnilsarwe.com/?p=143</guid>
		<description><![CDATA[Javscript tutorial to learn basic HTML DOM methods and implement it to traverse the HTML element tree. <a href="http://blog.swapnilsarwe.com/javascript-traversing-html-dom-recursively.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This post will give idea about HTML DOM Objects and way we can use its methods and attributes to navigate or traverse through it.</p>
<p>Introduction:<br />
How to traverse the complete HTML BODY covering each HTML element recursively and forming a tree You need to be aware of very basic Javscript DOM methods. W3schools is the wonderful resource to learn this basics. Go through all the functions but what we need for this exercise is <a href="http://www.w3schools.com/jsref/met_doc_getelementbyid.asp">getElementById()</a> and <a href="http://www.w3schools.com/jsref/met_doc_getelementsbytagname.asp">getElementsByTagName()</a></p>
<p>Eg: HTML</p>
<pre class="brush: xml; title: ; notranslate">
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;
      Javascript - HTML Tree Parser
    &lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id=&quot;header&quot;&gt;
      &lt;h1&gt;Javascript - HTML Tree Parser&lt;/h1&gt;
    &lt;/div&gt;
    &lt;ul id=&quot;nav&quot;&gt;
      &lt;li&gt;&lt;a href=&quot;one.html&quot;&gt;one&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;two.html&quot;&gt;two&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div id=&quot;footer&quot;&gt;
    &lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>
<p><b>Step I:</b> <br />
We are going to write a javascript function &#8211; lets call it htmlTree</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
   function htmlTree(){}
&lt;/script&gt;
</pre>
<p><b>Step II:</b> <br />
We will need to first get the body element, we can do it with the help of getElementsByTagName(&#8216;body&#8217;), which will return you the body tag. But since the function itself is plural it will always return you an array even if it has only one single element. Since body is the present only once we will refer to the 0th element of an array.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
  function htmlTree(){
    var body = document.getElementsByTagName('body')[0];
  }
&lt;/script&gt;
</pre>
<p><b>Step III:</b> <br />
Now we will check if the body tag has any children &#8211; we can do that by using hasChildNodes() method, if yes then we will first refer to the first child, we can do that with the attribute &#8220;firstChild&#8221;. Also we can get the name of the tag with an attribute &#8220;tagName&#8221;. After reading the first child we will go to the next child, with use of an attribute &#8220;nextSibling&#8221;</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
  function htmlTree(){
    var body = document.getElementsByTagName('body')[0];
    if (body.hasChildNodes()) {
      var child = body.firstChild;
      alert(child.tagName); // as per the above HTML example it will alert &quot;div&quot;
      var next = child.nextSibling;
      alert(next.tagName); // as per the above HTML example it will alert &quot;ul&quot;
    }
  }
&lt;/script&gt;
</pre>
<p>But this wont meet our purpose, we dont know the length of the tree and we also dont know how deep each branch is going to be, so we will make this function recursive to perform these similar step for eavery branch till it reaches it leaves. </p>
<p><b>Step IV:</b><br />
We will print the name of the tag identified and check if it has children if yes then we will recursively call the function again which will print its name and check if it has child &#8211; it will happen till it reaches element with no child</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
  function htmlTree(obj){
    var obj = obj || document.getElementsByTagName('body')[0];
    alert(obj.tagName);
    if (obj.hasChildNodes()) {
      var child = obj.firstChild;
      htmlTree(child);
    }
  }
&lt;/script&gt;
</pre>
<p>When you execute this, you get first alert as BODY but very next alert as undefined &#8211; where in it should have been DIV. This is because between BODY and the DIV tag there is the white space which is considered to be an empty text &#8211; well we need to avoid such occurrences </p>
<p><b>Step V:</b> <br />
Go through <a href="http://www.w3schools.com/htmldom/dom_nodes_info.asp">nodeType</a> on W3schools. Since here we are looking for an HTML elements, we will check for nodeType = 1. If it is 1 then we will recursively call the function if not we will move onto its sibling</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
  function htmlTree(obj){
    var obj = obj || document.getElementsByTagName('body')[0];
    alert(obj.tagName);
    if (obj.hasChildNodes()) {
      var child = obj.firstChild;
      while(child){
        if (child.nodeType === 1) {
          htmlTree(child);
        }
        child = child.nextSibling;
      }
    }
  }
&lt;/script&gt;
</pre>
<p><b>Step VI:</b> <br />
These alerts are quiet annoying, so lets make some subtle changes so that this function returns us complete tree. I personally like &#8220;ul li ul li&#8221; to represent a tree. Here is the modified function</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
  function htmlTree(obj){
    var obj = obj || document.getElementsByTagName('body')[0];
    var str = &quot;&lt;ul&gt;&lt;li&gt;&quot; + obj.tagName;
    if (obj.hasChildNodes()) {
      var child = obj.firstChild;
      while (child) {
        if (child.nodeType === 1) {
          str += htmlTree(child)
        }
        child = child.nextSibling;
      }
    }
    str += &quot;&lt;/li&gt;&lt;/ul&gt;&quot;;
    return str;
  }
  document.write(htmlTree());
&lt;/script&gt;
</pre>
<p><b>Step VII:</b> <br />
Since at the very beginning we were talking about just HTML elements, we will get rid of all the javascript inside HTML. We can achieve that by simply adding a simple check in the condition where we check the nodeType. </p>
<pre class="brush: xml; title: ; notranslate">
// Change
if (child.nodeType === 1)
// to
if (child.nodeType === 1 &amp;&amp; child.nodeName != 'SCRIPT')
</pre>
<p>Demo:<br />
<a href="http://demos.swapnilsarwe.com/html-tree-parser/" title="Javascript - HTML Tree Parser">Javascript &#8211; HTML Tree Parser</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.swapnilsarwe.com/javascript-traversing-html-dom-recursively.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>dovalidate-js &#8211; Javascript Form Validation Library</title>
		<link>http://blog.swapnilsarwe.com/dovalidate-js-javascript-form-validation-library.html</link>
		<comments>http://blog.swapnilsarwe.com/dovalidate-js-javascript-form-validation-library.html#comments</comments>
		<pubDate>Mon, 10 Oct 2011 19:23:19 +0000</pubDate>
		<dc:creator>swapnilsarwe</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://blog.swapnilsarwe.com/?p=131</guid>
		<description><![CDATA[dovalidate-js is the javascript validation library. It is one of the plugin which comes under the SWAPJS namespace - which is the core library still in development process. <a href="http://blog.swapnilsarwe.com/dovalidate-js-javascript-form-validation-library.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have been working on the javascript library to meet my everyday basic needs. dovalidate-js is the result of it.</p>
<p>Client side validation of form submission is very crucial and important. This is an attempt to create a dynamic library which will do the basic validation with some amount of configuration available to the user using it as per the requirement.</p>
<p>The main goal behind building the validator is to avoid playing with html form and let javascript do the validation and css highlight it.</p>
<p>So that it can be applicable to the already created form without touching it but by just configuring it through javascript and css.</p>
<p>Steps to use it:<br />
<strong>Step 1:</strong><br />
Include a javscript file</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;scripts/dovalidate-0.1.js&quot;&gt;&lt;/script&gt;
</pre>
<p><strong>Step 2:</strong><br />
Create the instance of validator</p>
<pre class="brush: xml; title: ; notranslate">
var dovalidate = new SWAPJS.doValidate();
</pre>
<p><strong>Step 3:</strong><br />
Call the validator init function with appropriate parameters.<br />
The parameters foremost consists of the id of the HTML form which you want to validate. Second the set of ids of the elements which you want to validate with the type of validation you want to have on it.</p>
<pre class="brush: xml; title: ; notranslate">
dovalidate.init('form_id', {
   name: ['empty'], // Comment 1
   email: ['empty', 'email'], // Comment 2
   webpage: ['url'] // Comment 3
});
</pre>
<p><strong>Comment 1:</strong> &#8216;name&#8217; is the id of an element. &#8216;empty&#8217; is the type of validation<br />
&#8216;empty&#8217; is in other words required field, if &#8216;name&#8217; field is empty form would not submit<br />
<strong>Comment 2:</strong> &#8216;email&#8217; is the id of an element. &#8216;empty&#8217; and &#8216;email&#8217; are the type of validations<br />
if more than one type validation specified. then both the validation should pass so that form can be submitted<br />
<strong>Comment 3:</strong> &#8216;webpage&#8217; is the id of an element. &#8216;url&#8217; is the type of validation<br />
no &#8216;empty&#8217; specified means, the field is not mandatory, but if it has some content it has to be of the specified type or else it wont submit</p>
<p>Example:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;scripts/dovalidate-0.1.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
	var dovalidate = new SWAPJS.doValidate();
	dovalidate.init('form1', {
		name: ['empty'],
		email: ['empty', 'email'],
		webpage: ['url'],
		comment: ['empty'],
		phone: ['digits']
	});
&lt;/script&gt;
</pre>
<p><strong>dovalidate-js:</strong><br />
<a title="dovalidate-js - Javascript Form Validation Demo" href="http://demos.swapnilsarwe.com/dovalidate-js/dovalidate.0.1.html">dovalidate-js demo</a><br />
<a title="dovalidate-js - Javascript Form Validation Download" href="https://dovalidate-js.googlecode.com/files/dovalidate-js.zip">dovalidate-js download</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.swapnilsarwe.com/dovalidate-js-javascript-form-validation-library.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wondering n&#8217; Finding the reason</title>
		<link>http://blog.swapnilsarwe.com/wondering-n-finding-the-reason.html</link>
		<comments>http://blog.swapnilsarwe.com/wondering-n-finding-the-reason.html#comments</comments>
		<pubDate>Thu, 03 Jun 2010 12:28:05 +0000</pubDate>
		<dc:creator>swapnilsarwe</dc:creator>
				<category><![CDATA[poems]]></category>
		<category><![CDATA[feelings]]></category>
		<category><![CDATA[hope]]></category>
		<category><![CDATA[love]]></category>
		<category><![CDATA[philosophy]]></category>
		<category><![CDATA[poem]]></category>
		<category><![CDATA[song]]></category>
		<category><![CDATA[woman]]></category>

		<guid isPermaLink="false">http://blog.swapnilsarwe.com/?p=76</guid>
		<description><![CDATA[Just curious about why sometimes things don't happen the way we think. <a href="http://blog.swapnilsarwe.com/wondering-n-finding-the-reason.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I saw her walking down the street,<br />
She didn&#8217;t let our eyes to meet.<br />
Something was going in her mind,<br />
My eyes were trying to find.</p>
<p>But she didn&#8217;t let it happen,<br />
I don&#8217;t know why was she feeling shy.<br />
We didn&#8217;t have any relation,<br />
But my heart gave out a cry.</p>
<p>Hey girl, why you let this happen,<br />
Why the feeling in your heart is denied.<br />
Why don&#8217;t you let our love to sharpen,<br />
Baby, I&#8217;m one of the kind.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.swapnilsarwe.com/wondering-n-finding-the-reason.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why the hell !!!</title>
		<link>http://blog.swapnilsarwe.com/why-the-hell.html</link>
		<comments>http://blog.swapnilsarwe.com/why-the-hell.html#comments</comments>
		<pubDate>Sun, 28 Feb 2010 12:27:03 +0000</pubDate>
		<dc:creator>swapnilsarwe</dc:creator>
				<category><![CDATA[inspiration]]></category>
		<category><![CDATA[philosophy]]></category>
		<category><![CDATA[poems]]></category>
		<category><![CDATA[experience]]></category>
		<category><![CDATA[faith]]></category>
		<category><![CDATA[feelings]]></category>
		<category><![CDATA[hope]]></category>
		<category><![CDATA[idol]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[love]]></category>
		<category><![CDATA[song]]></category>
		<category><![CDATA[woman]]></category>

		<guid isPermaLink="false">http://blog.swapnilsarwe.com/?p=74</guid>
		<description><![CDATA[I don't know what made me write this..., just few thoughts flew in my head and here is the result. <a href="http://blog.swapnilsarwe.com/why-the-hell.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Why the hell can&#8217;t I get you out of my mind,<br />
Why the hell you are just one of the kind,<br />
Why the hell you are such an inspiration,<br />
The hells in this phrase seems to me like a heaven&#8230;,<br />
Why the hell&#8230;!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.swapnilsarwe.com/why-the-hell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>20 years of Sachin Tendulkar</title>
		<link>http://blog.swapnilsarwe.com/20-years-of-sachin-tendulkar.html</link>
		<comments>http://blog.swapnilsarwe.com/20-years-of-sachin-tendulkar.html#comments</comments>
		<pubDate>Tue, 24 Nov 2009 12:24:47 +0000</pubDate>
		<dc:creator>swapnilsarwe</dc:creator>
				<category><![CDATA[experiences]]></category>
		<category><![CDATA[inspiration]]></category>
		<category><![CDATA[sports]]></category>
		<category><![CDATA[cricket]]></category>
		<category><![CDATA[experience]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[idol]]></category>
		<category><![CDATA[sportsman]]></category>

		<guid isPermaLink="false">http://blog.swapnilsarwe.com/?p=72</guid>
		<description><![CDATA[An era of 20 years owned by one and only Sachin Tendulkar. Source: <a href="http://www.facebook.com/notes/rakesh-patel/celebrating-20-years-of-god-on-the-field/180602166547" title="celebrating-20-years-of-god-on-the-field">Celebrating 20 years of God on the field</a> <a href="http://blog.swapnilsarwe.com/20-years-of-sachin-tendulkar.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<blockquote><p>When Sachin Tendulkar travelled to Pakistan to face one of the finest bowling attacks ever assembled in cricket,</p>
<p>Michael Schumacher was yet to race a F1 car,<br />
Lance Armstrong had never been to the Tour de France,<br />
Diego Maradona was still the captain of a world champion Argentina team,<br />
Pete Sampras had never won a Grand Slam.</p>
<p>When Tendulkar embarked on a glorious career taming Imran and company,<br />
Roger Federer was a name unheard of;<br />
Lionel Messi was in his nappies,<br />
Usain Bolt was an unknown kid in the Jamaican backwaters.</p>
<p>The Berlin Wall was still intact,<br />
USSR was one big, big country,<br />
Dr Manmohan Singh was yet to &#8220;open&#8221; the Nehruvian economy.</p>
<p>It seems while Father Time was having his toll on every individual on the face of this planet,<br />
he excused one man.</p>
<p>Time stands frozen in front of our Sachin.</p>
<p>We have had champions, we have had legends, but we have never had a Sachin Tendulkar and we never will.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.swapnilsarwe.com/20-years-of-sachin-tendulkar.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Text Area Auto Xpander v1.0</title>
		<link>http://blog.swapnilsarwe.com/text-area-auto-xpander-v1-0.html</link>
		<comments>http://blog.swapnilsarwe.com/text-area-auto-xpander-v1-0.html#comments</comments>
		<pubDate>Mon, 28 Sep 2009 12:22:30 +0000</pubDate>
		<dc:creator>swapnilsarwe</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[expander]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[textarea]]></category>

		<guid isPermaLink="false">http://blog.swapnilsarwe.com/?p=70</guid>
		<description><![CDATA[This is an update to the Text Area Auto Xpander with couple of improvements compared to the previous <a title="Text Area Auto Xpander 0.9" href="http://blog.swapnilsarwe.com/text-area-auto-xpander-09.html">Text Area Auto Xpander 0.9</a> <a href="http://blog.swapnilsarwe.com/text-area-auto-xpander-v1-0.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Text Area Auto Xpander 1.0 has couple of new features which were promised in the <a href="http://blog.swapnilsarwe.com/text-area-auto-xpander-09.html" title="Text Area Auto Xpander 0.9">last post</a> :</p>
<h3>Features Added:</h3>
<ul>
<li>The ability to give the Xpander functionality to the selected textareas.</li>
<li>on load expansion of the textareas if the text is more than the textarea.</li>
</ul>
<h3>Options</h3>
<ul>
<li><strong>animation</strong> &#8211; true or false will have the text area &#8216;expand with ease&#8217; or &#8216;expand directly&#8217;.</li>
<li><strong>xtraSpace </strong>- The extra space  or height in pixels by which the textarea should expand.</li>
<li><strong>delay </strong>- The delay in milliseconds in ease for the expansion of the textarea.</li>
<li><strong>callBack </strong>- The callback function which executes eveytime the text area expands.</li>
<li><strong>ids </strong>- List of textarea ids to which Xpander has to be applied.</li>
</ul>
<h3>Example:</h3>
<h3>Xpander with specific textarea ids</h3>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;Xpander1.0.js&quot;&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
  window.onload = function(){
	  Xpander({
ids: ['textarea1','textarea2'],
		  animation: true,
		  xtraSpace: 15,
		  delay: 10,
		  callBack: function(){
			  /* Your callback function here */
		  }
	  });
  }
&lt;/script&gt;
</pre>
<h3>Xpander for all textarea (no ids mentioned) </h3>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;Xpander1.0.js&quot;&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
    window.onload = function(){
        Xpander({
            animation: true,
            xtraSpace: 15,
            delay: 10,
            callBack: function(){
                /* Your callback function here */
            }
        });
    }
&lt;/script&gt;
</pre>
<h3>Xpander 1.0</h3>
<ul class="dl">
<li> <a class="button demo" href="http://demos.swapnilsarwe.com/xpander1.0/" title="Demo Xpander 1.0">Xpander 1.0 Demo</a></li>
<li><a class="button download" href="http://demos.swapnilsarwe.com/xpander1.0/Xpander1.0.js" title="Download Xpander 1.0">Xpander1.0.js</a></li>
</ul>
<p> If you find any bug, or have something which will improve this plug in just let me know in the comment section. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.swapnilsarwe.com/text-area-auto-xpander-v1-0.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Text Area Auto Xpander 0.9</title>
		<link>http://blog.swapnilsarwe.com/text-area-auto-xpander-0-9.html</link>
		<comments>http://blog.swapnilsarwe.com/text-area-auto-xpander-0-9.html#comments</comments>
		<pubDate>Sun, 05 Jul 2009 12:20:11 +0000</pubDate>
		<dc:creator>swapnilsarwe</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[expander]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[textarea]]></category>

		<guid isPermaLink="false">http://blog.swapnilsarwe.com/?p=68</guid>
		<description><![CDATA[This is just the new version of Text Area Auto Xpander with few little fixes and improvements compared to the previous <a title="Text Area Auto Xpander" href="http://swapnilsarwe.phpnet.us/text-area-auto-xpander.html">Text Area Auto Xpander</a> <a href="http://blog.swapnilsarwe.com/text-area-auto-xpander-0-9.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Text Area Auto Xpander 0.2 had few issues and very limited options. But there is a good news, Xpander 0.2 has grown up to Xpander 0.9 and now there are fewer issues and couple of more options:</p>
<h3>Issues Fixed:</h3>
<ul>
<li>The previous version used negative marginLeft to hide the cloned textarea which used to make the other element  				following the textarea to be not visible on the page. Now textarea are absolutely positioned them as in jquery-plugin-autoresize 				of James Padolsey to fix the issue.</li>
<li>Also the tab index of -1 has ben added to avoid the focus being taken to the hidden textareas.</li>
<li>The animation has been given as option rather than having two different JS files (one for easing effect and one without it), you can now just turn on or  				turn off the animation for expanding the textarea.</li>
</ul>
<h3>Options</h3>
<ul>
<li><strong>animation</strong> &#8211; true or false will have the text area &#8216;expand with ease&#8217; or &#8216;expand directly&#8217;.</li>
<li><strong>xtraSpace </strong>- The extra space  or height in pixels by which the textarea should expand.</li>
<li><strong>delay	  </strong>- The delay in milliseconds in ease for the expansion of the textarea.</li>
<li><strong>callBack  </strong>- The callback function which executes eveytime the text area expands.</li>
</ul>
<h3>Possible future changes/options:</h3>
<ul>
<li>In this 0.9 version too, by default all textarea gets this Xpansion functionality. Because I think its must for all textareas and not for just selected texareas. Still having an option to do it either way would be nice to have.</li>
<li>Also if textarea at the beginning itself has more text that the specific height of the texarea, in that case the change in the texarea is necessary to trigger the expand in textarea as per the content. Thats the tough one since I am not that good in events. Still would like to fix this issue to soon.</li>
</ul>
<h3>Example:</h3>
<h3>Xpander</h3>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;Xpander0.9.js&quot;&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
    window.onload = function(){
        Xpander({
            animation: true,
            xtraSpace: 15,
            delay: 10,
            callBack: function(){
                /* Your callback function here */
            }
        });
    }
&lt;/script&gt;
</pre>
<h3>Xpander 0.9</h3>
<ul class="dl">
<li> <a class="button demo" href="http://swapnilsarwe.110mb.com/xpander0.9/" title="Demo Xpander 0.9">Xpander 0.9 Demo</a></li>
<li><a class="button download" href="http://swapnilsarwe.110mb.com/xpander0.9/Xpander0.9.js" title="Download Xpander 0.9">Xpander0.9.js</a></li>
</ul>
<p>
If you find any bug, or have something which will improve this plug in just let me know in the comment section.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.swapnilsarwe.com/text-area-auto-xpander-0-9.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
