<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
<channel>
<title>CodeStore.net comments on "DOM Parsing With XPath and JavaScript"</title>
<description>Replies to blog "DOM Parsing With XPath and JavaScript" on codestore.net.</description>
<link>http://www.codestore.net/</link>
<lastBuildDate>Thu, 30 Apr 2009 17:20:50 -0500</lastBuildDate>
<atom:link href="http://www.codestore.net/store.nsf/blog.xml?Open=20050420" rel="self" type="application/rss+xml" />

<item>
	<title>Reply from Jeff G</title>
	<pubDate>Thu, 30 Apr 2009 17:20:50 -0500</pubDate>
	<author>Jeff G</author>
	<description><![CDATA[ 
		<p>Great post and great information.  Thanks Jake.  I have an issue here that you might be able to clarify based on your experience.  I built a nice Java Library that encapsulates my code and is reusable in a sister application.  I am using R7 and ensured all of my Java code was 1.4 compliant.  The problem I am having is that it seems XPath is not part of Domino's build of the JRE.  I am able to compile but get XPathFactory runtime errors all over the place.  If I include a 4MB jaxp-ri.jar I no longer get errors, but my performance gets killed loading the jar.  Is this a problem with my version of domino designer (7.0.1)???...ooops need to upgrade to 7.0.2 anyway.  Your thoughts?</p>

		<p><a href="http://www.codestore.net/store.nsf/reply?OpenForm&ParentUNID=224D72126C072241862575A8007AC18D"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p>
	]]></description>
	<link>http://www.codestore.net/store.nsf/unid/BLOG-20050420?OpenDocument#DOC_224D7212</link>
</item><item>
	<title>Reply from randall</title>
	<pubDate>Sun, 16 Nov 2008 02:27:39 -0600</pubDate>
	<author>randall</author>
	<description><![CDATA[ 
		<p>i am writing a multi-browser xml lib.  i came up with a fix for that to let me get string/number/bool results from IE with xpath queries.  if someone knows how to get the current html source from document in IE, i bet this could be modified to work with the current document and applied by IE's behaviors.</p>
		<p>if you know how to do xml transoformations in IE you should be able to understand the following snippet.  it returns a text output that js can convert.  the FF source is there too for comparison:</p>
		<p>this.query=function(udef_xpath, udef_resultType){</p>
		<p>var result=false;</p>
		<p>if(!udef_resultType) var udef_resultType="string";</p>
		<p>if( browser.isIE()==true ){</p>
		<p>var tmpStyleSheet='<?xml version="1.0"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="text"/><xsl:template match="/"><xsl:value-of select="'+udef_xpath+'"/></xsl:template></xsl:stylesheet>';</p>
		<p>var p=this.asXML();</p>
		<p>var newXML=new erjXMLDocument( p );</p>
		<p>newXML.loadXSLDocument( tmpStyleSheet );</p>
		<p>var q=newXML.transform();</p>
		<p>newXML=null;</p>
		<p>switch(udef_resultType.toLowerCase()){</p>
		<p>case "number":</p>
		<p>result=parseFloat(q);</p>
		<p>break;</p>
		<p>case "bool":</p>
		<p>result=( (q.indexOf("TRUE") > -1) || (q.indexOf("true") > -1) || (q.indexOf("1") > -1) ? true : false );</p>
		<p>break;</p>
		<p>default:</p>
		<p>result=q;</p>
		<p>break;</p>
		<p>}</p>
		<p>}else{</p>
		<p>udef_resultType=(  udef_resultType.toLowerCase().indexOf("number") > -1 ? XPathResult.NUMBER_TYPE : ( udef_resultType.toLowerCase().indexOf("bool") > -1 ? XPathResult.BOOLEAN_TYPE : XPathResult.STRING_TYPE ) );</p>
		<p>result=xmlDocument.evaluate( udef_xpath, xmlDocument, null, udef_resultType, null);</p>
		<p>switch(udef_resultType){</p>
		<p>case XPathResult.NUMBER_TYPE:</p>
		<p>result=result.numberValue;</p>
		<p>break;</p>
		<p>case XPathResult.BOOLEAN_TYPE:</p>
		<p>result=result.booleanValue;</p>
		<p>break;</p>
		<p>default:</p>
		<p>result=result.stringValue;</p>
		<p>break;</p>
		<p>}</p>
		<p>}</p>
		<p>return result;</p>
		<p>}</p>
		<p>--randall</p>

		<p><a href="http://www.codestore.net/store.nsf/reply?OpenForm&ParentUNID=1BA6B95555BC3AF786257503002E7A0B"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p>
	]]></description>
	<link>http://www.codestore.net/store.nsf/unid/BLOG-20050420?OpenDocument#DOC_1BA6B955</link>
</item><item>
	<title>Reply from Philippe Lhoste</title>
	<pubDate>Sat, 11 Feb 2006 09:33:00 +0100</pubDate>
	<author>Philippe Lhoste</author>
	<description><![CDATA[ 
		<p>Interesting. I was looking for a way to convert XPath to more classical JavaScript path: document.forms[1].elements[2] for example. This can be an alternative, but as usual, IE support is dragging behind...</p>
		<p>Of related interest: XPather, https://addons.mozilla.org/firefox/1192/</p>
		<p>It helps finding a XPath from the Web page.</p>

		<p><a href="http://www.codestore.net/store.nsf/reply?OpenForm&ParentUNID=301453DC05045B728625721A00558222"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p>
	]]></description>
	<link>http://www.codestore.net/store.nsf/unid/BLOG-20050420?OpenDocument#DOC_301453DC</link>
</item><item>
	<title>Reply from blundith</title>
	<pubDate>Fri, 7 Jan 2005 06:07:00 +0100</pubDate>
	<author>blundith</author>
	<description><![CDATA[ 
		<p>Em, using xsl as a webdeveloper, almost everyday from the last two years?</p>
		<p>Regards :)</p>

		<p><a href="http://www.codestore.net/store.nsf/reply?OpenForm&ParentUNID=93E825FCB1AEF4E586257031003D18FC"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p>
	]]></description>
	<link>http://www.codestore.net/store.nsf/unid/BLOG-20050420?OpenDocument#DOC_93E825FC</link>
</item><item>
	<title>Reply from Joel "Jaykul" Bennett</title>
	<pubDate>Sun, 6 Mar 2005 15:09:00 +0100</pubDate>
	<author>Joel "Jaykul" Bennett</author>
	<description><![CDATA[ 
		<p>Glazkov has some cool stuff there, but if you try to use document.evaluate in IE that way, it's horribly slow, compared to the native implementation. I'm not sure what needs to be done to improve that...</p>

		<p><a href="http://www.codestore.net/store.nsf/reply?OpenForm&ParentUNID=3AF60F669878978586257015006EC3C8"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p>
	]]></description>
	<link>http://www.codestore.net/store.nsf/unid/BLOG-20050420?OpenDocument#DOC_3AF60F66</link>
</item><item>
	<title>Reply from Bernardo</title>
	<pubDate>Sat, 21 May 2005 03:41:00 +0100</pubDate>
	<author>Bernardo</author>
	<description><![CDATA[ 
		<p>Jerry, take a look at </p>
		<p>{<a href="http://glazkov.com/blog/archive/2004/06/03/187.aspx">Link</a>}</p>
		<p>The guy there has built a handy js library that provides IE 5+ with the document.evaluate() method.  The code (a single .js file) is release under GPL, you can download it from sourceforge.</p>
		<p>I haven't played around with it yet, only tested the example html page that comes along with the code. Seems to work fine!</p>

		<p><a href="http://www.codestore.net/store.nsf/reply?OpenForm&ParentUNID=2B083D9B605CDCB386257008002FC021"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p>
	]]></description>
	<link>http://www.codestore.net/store.nsf/unid/BLOG-20050420?OpenDocument#DOC_2B083D9B</link>
</item><item>
	<title>Reply from Jerry Carter</title>
	<pubDate>Tue, 17 May 2005 15:19:00 +0100</pubDate>
	<author>Jerry Carter</author>
	<description><![CDATA[ 
		<p>Another thing I'm finding, IE doesn't support document.evaluate, unfortunately.  I was hoping to build some post load page modification into my document to save manually writing HTML into a form.  Oh well.</p>

		<p><a href="http://www.codestore.net/store.nsf/reply?OpenForm&ParentUNID=D428D8055B90A47886257004006F9BC1"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p>
	]]></description>
	<link>http://www.codestore.net/store.nsf/unid/BLOG-20050420?OpenDocument#DOC_D428D805</link>
</item><item>
	<title>Reply from Jake Howlett</title>
	<pubDate>Wed, 20 Apr 2005 12:09:00 +0100</pubDate>
	<author>Jake Howlett</author>
	<description><![CDATA[ 
		<p>Fredrik. I think that's why I don't get to use XML all that much - I rarely get to make one system talk to another...</p>
		<p>Jerry. There's some interesting XPath in the Linkify script (turns plain text links in to actual clickable links) which would give us something like this for finding the word "test" in a P (I think):</p>
		<p>//text()[(parent::p) and contains(.,'test')]</p>
		<p>Search highlighting is an interesting one. Hadn't thought of that. Codestore's search results don't use &highlight= because I use HTML for the view. GM could easily add this parameter back in. Another script could then do the actual highlighting (Domino won't do it as I am using PTHTML!). If only I had the time...</p>

		<p><a href="http://www.codestore.net/store.nsf/reply?OpenForm&ParentUNID=ACE038C4FE139D6686256FE9005E440D"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p>
	]]></description>
	<link>http://www.codestore.net/store.nsf/unid/BLOG-20050420?OpenDocument#DOC_ACE038C4</link>
</item><item>
	<title>Reply from Jerry Carter</title>
	<pubDate>Wed, 20 Apr 2005 10:32:00 +0100</pubDate>
	<author>Jerry Carter</author>
	<description><![CDATA[ 
		<p>Thanks Jake, That's a handy little snippet.  </p>
		<p>Unfortunately, the only useful ideas immediately coming to mind all revolve around variations of 'Mad-Libs' where I might use a regexp to look for certain words within p nodes and replace them with certain other words...  actually, not useful, but amusing. </p>
		<p>Come to think of it, a while back, Julian was workign on a text highlighting function that was intended to enhance domino search results pages to be more googlish (ala cache view).  I played with that quite a bit on my own - it would make a great GreaseMonkey add on, extending Firefox's highlight to fuzzy search phrase - word highlighting.</p>

		<p><a href="http://www.codestore.net/store.nsf/reply?OpenForm&ParentUNID=904C997C7EA85CAF86256FE900555B7E"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p>
	]]></description>
	<link>http://www.codestore.net/store.nsf/unid/BLOG-20050420?OpenDocument#DOC_904C997C</link>
</item><item>
	<title>Reply from Fredrik</title>
	<pubDate>Wed, 20 Apr 2005 04:44:00 +0100</pubDate>
	<author>Fredrik</author>
	<description><![CDATA[ 
		<p>Very Nice! I tend to use XML (et al) more often in my everyday development (but not with javascript). </p>
		<p>It's a really nice way to integrate and process information between different systems. </p>
		<p>In most cases you don't need spend big $ on a big "bloated" middleware product to share information between domino and other systems/technologies (unless the integration between the systems plays a major part and contains a complex set of rules and involves many systems in different flavours) </p>
		<p>For 1 to 1 integration/communication, XML over HTTP or similar often solves the problem.</p>

		<p><a href="http://www.codestore.net/store.nsf/reply?OpenForm&ParentUNID=AC732EB0D388B47F86256FE900358DE8"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p>
	]]></description>
	<link>http://www.codestore.net/store.nsf/unid/BLOG-20050420?OpenDocument#DOC_AC732EB0</link>
</item>

</channel>
</rss> 
