नामस्थान अज्ञेय वाक्यविन्यास मैंने चारों ओर देखा है मुझे भ्रमित कर रहा है।तत्व सामग्री के साथ नेमस्पेस अज्ञेयवादी XPath क्वेरी
मेरे पास है कहते हैं:
<root>
<parent attribute="A">A<child>A</child></parent>
<parent attribute="B">B<child>B</child></parent>
</root>
अब तक मैं देख रहा हूँ कि कैसे:
/root/parent/child/text()
करने के लिए अनुवाद:
/*[local-name()='root']/*[local-name()='parent']/*[local-name()='child']/text()
लेकिन मैं इस तरह चीजों के साथ संघर्ष कर रहा हूँ:
/root/parent[@attribute="A"]/child/text()
या:
/root/parent[text()="B"]/child/text()
या:
/root/parent[1]/child/text()
इन अनुवाद कैसे करूं?
धन्यवाद,
संपादित करें: एक और :-)
<root>
<parent>
<childName>serverName</childName>
<childValue>MyServer</childValue>
</parent>
<parent>
<childName>ServerLocation</childName>
<childValue>Somewhere</childValue>
</parent>
</root>
इस का अनुवाद कैसे करता है?
/root/parent[childName="serverName"]/childValue/text()
अच्छा सवाल है, +1 बन जाएगा। सभी प्रदान किए गए XPath अभिव्यक्तियों की अनुशंसा, चेतावनी और पूर्ण अनुवाद के लिए मेरा उत्तर देखें। –