[Project_owners] Return the full node of a XPATH result

Ramiro Aparicio frisco82 at gmail.com
Thu Apr 27 11:33:36 EDT 2006


Hi,
I only can think in two solutions:

a) blabla.snapshotItem(0).parent.innerHTML but this will give you also the
code of other childs.
b) reconstruct the element.

var tag = "";
var temp = blabla.snapshotItem(0);
tag += "<"+temp.nodeName+" ";
for (var i = 0; i < temp.attributes.length; i++)
  tag += temp.attributes[0].nodeName+"='"+temp.attributes[0].nodeValue+"' ";
tag += "> "+temp.innerHTML+"</"+temp.nodeName+">";

On 4/27/06, Renato R. (RRaver) <rraver.sp at gmail.com> wrote:
>
> **Hi guys,
>
> I need a way to return the full node of a XPATH result, but I don't know
> how or even if it is possible.
> For example, if I try something like this,
>
> <a href="http://www.site.com">This is a Link</a>
> .......
>
> <script>
> .....
> var blabla = document.evaluate("//a", document, null, 7,null);
>
> blabla.snapshotItem(0) will return "This a Link" and blabla.snapshotItem(0).href
> will return "http://www.site.com" and so on... But what I really need is a
> way to return exactly "<a href="http://www.site.com">This is a Link</a>"
> that is the matched node.
>
> Is possible to do it? I've tried somethings like nodeValue e things like
> that but none of them worked.... Someone can help-me?
>
> Thanks for the attention
>
> --
> Renato Rodrigues
> http://www.renatorodrigues.com
> http://orkutbar.mozdev.org
>
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>
>
>


--
Hasta Otra

Ramiro Aparicio

---------------------------------------------------------------------------------
Webmaster de http://gs151.tk y http://www.climaxsl.es
Desarrollador de FoxGame http://foxgame.mozdev.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/project_owners/attachments/20060427/5cf57ebc/attachment.htm


More information about the Project_owners mailing list