<?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>myXMLProject &#187; Javascript</title>
	<atom:link href="http://www.myxmlproject.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.myxmlproject.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 05 Jun 2011 23:58:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>XML Transformation using Sarissa</title>
		<link>http://www.myxmlproject.com/xml-transformation-using-sarissa/</link>
		<comments>http://www.myxmlproject.com/xml-transformation-using-sarissa/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 16:24:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.myxmlproject.com/?p=4</guid>
		<description><![CDATA[Sarissa was developed to allow cross-browser support for manipulating XML files.  This is important for web pages accessing XML with JavaScript.  Firefox, IE and Safari implementations of JavaScript each handle XML files differently.  Sarissa is a set of downloadable JavaScript files that standardize XML manipulation.
PHOTO GALLERY USING XML
Several popular web based photo applications (Picasa [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Sarissa was developed to allow cross-browser support for manipulating XML files.  This is important for web pages accessing XML with JavaScript.  Firefox, IE and Safari implementations of JavaScript each handle XML files differently.  Sarissa is a set of downloadable JavaScript files that standardize XML manipulation.</strong></p>
<p><strong>PHOTO GALLERY USING XML</strong></p>
<p>Several popular web based photo applications (Picasa and JAlbum) have export options that can generate XML files along with photo images to create a photo album in a web page.  I have created a simple implementation that uses a similar approach.  Sarissa methods parse the file:  sherrypicsmenu.xml for image files and thumbnail files.  HTML code is inserted into the web page to display a thumbnail bar, and detail photo images.<br />
<span id="more-4"></span><br />
Here&#8217;s the XML file:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;iso-8859-1&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;photogallery<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;photo</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;buttonarmsxdcat.jpg&quot;</span> <span style="color: #000066;">image</span>=<span style="color: #ff0000;">&quot;armsxdcat.jpg&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;photo</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;buttoncatbasket.jpg&quot;</span> <span style="color: #000066;">image</span>=<span style="color: #ff0000;">&quot;catbasket.jpg&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;photo</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;buttondogsniff.jpg&quot;</span> <span style="color: #000066;">image</span>=<span style="color: #ff0000;">&quot;dogsniff.jpg&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;photo</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;buttonyawndog.jpg&quot;</span> <span style="color: #000066;">image</span>=<span style="color: #ff0000;">&quot;yawndog.jpg&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;photo</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;buttondbeagle.jpg&quot;</span> <span style="color: #000066;">image</span>=<span style="color: #ff0000;">&quot;dbeagle.jpg&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/photogallery<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>When the HTML page is loading, sherrypicsmenu.xml loads and is parsed.  Each photo tag from the xml file becomes a thumbnail with a link to the full sized image.</p>
<p>Here&#8217;s the JavaScript:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot;&gt;
function initMenu(xmlFile) {
	var xml = Sarissa.getDomDocument();
	xml.async = false;
	xml.load(xmlFile);
&nbsp;
	var nodes = xml.documentElement.childNodes;
	var output = '';
&nbsp;
	for (var i = 0; i &lt;= nodes.length - 1; i++) {
		if (nodes.item(i).nodeType != Node.ELEMENT_NODE) continue;
&nbsp;
		output += '&lt;div id=&quot;photobutton&quot;&gt;';
		output += '&lt;a onclick=&quot;showpicture(\'../images/' + nodes.item(i).getAttribute('image') + '\')&quot;&gt;' +
			'&lt;img src=&quot;../images/' + nodes.item(i).getAttribute('target') + '&quot; /&gt;' + '&lt;/a&gt;&lt;br /&gt;';
		output += '&lt;/div&gt;';
&nbsp;
	}
	document.getElementById('photomenu').innerHTML = output;
    showpicture(&quot;../images/catbasket.jpg&quot;);
}
&nbsp;
window.onload = function() {
	initMenu('sherrypicsmenu.xml');
};
&lt;/script&gt;</pre></div></div>

<p><br/><br />
<br/><br />
RELATED POSTS:</p>
<ul>
<li><a href="http://sourceforge.net/projects/sarissa/" target="blank">Download Sarissa</a></li>
<li><a href="http://www.janbthomas.com/jansblog/photo-gallery-from-picasa-album/" target="blank">Export a Picasa Photo Album</a> </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.myxmlproject.com/xml-transformation-using-sarissa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

