var path1=
'//wine[country="Frankrike" and type="red" and dice > 5]/name/text()';
var path2=
'//wine[country="Italia" and type="red" and dice > 5]';
function getIt1(path){
$.ajax({
url:'viner.xml',
success:function(data,status,xhr)
{
var XMLDom=xhr.responseXML;
var nodes=XMLDom.evaluate(path, XMLDom, null,
XPathResult.ANY_TYPE, null);
var result=nodes.iterateNext();
var resT="";
while(result){
resT+=result.nodeValue + "<br>";
result=nodes.iterateNext();
}
document.getElementById("result").innerHTML=resT;
},
error:function(data)
{
document.getElementById("result").innerHTML="error";
}
});
}
function getIt2(path){
$.ajax({
url:'viner.xml',
success:function(data,status,xhr)
{
var XMLDom=xhr.responseXML;
var nodes=XMLDom.evaluate(path, XMLDom, null,
XPathResult.ANY_TYPE, null);
var result=nodes.iterateNext();
var resT="<ul>";
while(result){
var price=result.getElementsByTagName("price")[0].
firstChild.nodeValue;
var name=result.getElementsByTagName("name")[0].
firstChild.nodeValue;
resT+="<li>"+name+"<br/>"+price + "</li>";
result=nodes.iterateNext();
}
resT+="</ul>";
document.getElementById("result").innerHTML=resT;
},
error:function(data)
{
document.getElementById("result").innerHTML="error";
}
});
}