hello,
I don't know Javascript but i can tell you how i've done that.
Once the event is fired, all you would have to do is through XPath get a collection of the nodes and then iterate through them.
in C# (and infopath 2007)
XpathNavigator navigator = CreatNavigator().Select("XpathToNodes",namespace);
while(navigator.movenext())
{
Console.WriteLine(navigator.current.innerxml);
}
Hope this helps.