XPath Axes(အဆင်း)
- အရှေ့အစီအစဉ် XPath အောင်းပါး
- နောက်အစီအစဉ် XPath တုံ့ပြန်သူ
XML အမှတ်အသား စာရင်း
အောက်ပါ အမှတ်အသားများတွင် သင်တန်းသုံးသည့် XML စာရင်းကို အသုံးပြုပါမည်
<?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> <book> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore>
XPath axis
axis can define a node set relative to the current node
axis-name | ရလဒ် |
---|---|
ancestor | select all ancestor (parent, grandparent, etc.) |
ancestor-or-self | select all ancestor (parent, grandparent, etc.) and the current node itself |
attribute | ယခု အခြေအနေ အကိုယ်အော်၏ အခြေအနေများကို စည်းကြပ်သည်။ |
child | child::* |
descendant | select all descendant elements (children, grandchildren, etc.) |
descendant-or-self | select all descendant elements (children, grandchildren, etc.) and the current node itself |
following | select all nodes after the end tag of the current node in the document |
namespace | select all namespace nodes of the current node |
parent | select the parent node of the current node |
preceding | select all nodes before the start tag of the current node in the document |
preceding-sibling | select all preceding sibling nodes of the current node |
self | select the current node |
position path expression
အခြေအနေ လိုင်း အဆိုပါ အပိုင်းအခြား သည် အခြေအနေ လိုင်း ဖြစ်ပေါ်လာသည်။ အခြေအနေ လိုင်း သည် အခြေအနေ လိုင်း အတွင်း၌ အခြေအနေ များ ကို တစ်ခါတစ်ရံ အစီအစဉ်ထားသည်
အခြေအနေ လိုင်း အဆိုပါ အပိုင်းအခြား သည် အခြေအနေ လိုင်း ဖြစ်ပေါ်လာသည်။ အခြေအနေ လိုင်း သည် အခြေအနေ လိုင်း အတွင်း၌ အခြေအနေ များ ကို တစ်ခါတစ်ရံ အစီအစဉ်ထားသည်
အခြေအနေ လိုင်း အဆိုပါ အပိုင်းအခြား သည် အခြေအနေ လိုင်း ဖြစ်ပေါ်လာသည်။ အခြေအနေ လိုင်း သည် အခြေအနေ လိုင်း အတွင်း၌ အခြေအနေ များ ကို တစ်ခါတစ်ရံ အစီအစဉ်ထားသည်
/step/step/...
အခြေအနေ လိုင်း အဆိုပါ
step/step/...
မည်သည့် step လိုင်း လည်း ယခု အခြေအနေ အတွင်း၏ အခြေအနေများ အပေါ်မူတည်၍ တစ်ခါတစ်ရံ အစီအစဉ်ထားသည်
step လိုင်း အပါအဝင်
- axis
- ရွှေ့ပြောင်းထားသော အခြေအနေ အတွင်း၏ အခြေအနေ နှင့် ယခု အခြေအနေ အကြား၏ အပိုင်းပိုင်း ဆိုင်သော အပိုင်းအခြား
- node-test
- အခြေအနေ အတွင်း၏ အခြေအနေကို ဖော်ထုတ်သည်
- အဆင့်မဲ့သို့မဟုတ် အဆင့်အရှစ် သုံးပုံတစ်ပုံ
- ရွှေ့ပြောင်းထားသော အခြေအနေ စည်းကြပ်ကို ပို၍ သန့်ရှင်းစေသည်
step လိုင်း၏ ပုံစံ
axis-name::node-test[predicate]
ဌာန်းကျည်း
ဌာန်းကျည်း | ရလဒ် |
---|---|
child::book | child::book |
attribute::lang | attribute::lang |
child::* | child::* |
attribute::* | ယခု အခြေအနေ အကိုယ်အော်၏ အခြေအနေများကို စည်းကြပ်သည်။ |
child::text() | ယခု အခြေအနေ အကိုယ်အော်၏ စက်တင်ကို စည်းကြပ်သည်။ |
child::node() | ယခု အခြေအနေ အကိုယ်အော်၏ စက်တင်ကို စည်းကြပ်သည်။ |
descendant::book | 选取当前节点的所有 book 后代。 |
ancestor::book | book အစိတ်အစိတ် အရာ အစိတ်အစိတ် အရာ ရှာဖွေ |
ancestor-or-self::book | book အစိတ်အစိတ် အရာ အစိတ်အစိတ် အရာ နှင့် လက်ရှိ အစိတ်အစိတ် အရာ (အရာတွက် လက်ရှိ အစိတ်အစိတ် အရာ ဖြစ်ခဲ့လျှင်) |
child::*/child::price | လက်ရှိ အစိတ်အစိတ် အရာ၏ အချက်အလက် အား ခွင့်ပြု |
- အရှေ့အစီအစဉ် XPath အောင်းပါး
- နောက်အစီအစဉ် XPath တုံ့ပြန်သူ