Vraag : XPath newbie

Bekijk gelieve te adviseren hieronder de code en me hoe ik terug in XPath niet alleen title but authorand price kan brengen? (Dank)

" codeBody "
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:


  

  


35 " onclick= " SelectTitleNode_price_gt_35 () „/> 
  
Attachments:

Antwoord : XPath newbie

controleer dit
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
weg = „/bookstore/book [price>35]“;

      // code voor D.W.Z.

      als (window.ActiveXObject) {
        xmlDoc.setProperty („SelectionLanguage“, „XPath“);
        var book_nodes = xmlDoc.selectNodes (weg);
        voor (I = 0; i < book="">„;
              als (book_fields [j] .nodeName == „prijs“)
                buf += „(D.W.Z.) prijs: “ + book_fields [j] .text + „
„; } } } anders { // code voor Mozilla, Firefox, Opera, enz. als (document.implementation && document.implementation.createDocument) { var knopen = xmlDoc.evaluate (de ongeldige weg, xmlDoc, XPathResult.ANY_TYPE, verklaart nietig); var resultaat = nodes.iterateNext (); terwijl (resultaat) { var book_fields = result.childNodes; voor (j = 0; j < book="">„; als (book_fields [j] .nodeName == „prijs“) buf += „(Firefox) prijs: “ + book_fields [j] .childNodes [0] .nodeValue + „
„; } resultaat = nodes.iterateNext (); } } }
Andere oplossingen  
 
programming4us programming4us