XPath基础语法(2)
7. name() :
//*[name()='BBB']
<AAA>
<BCC>
<BBB/>
<BBB/>
<BBB/>
BCC>
<DDB>
<BBB/>
<BBB/>
DDB>
<BEC>
<CCC/>
<DBD/>
BEC>
AAA>
//*[starts-with(name(),'B')]
<AAA>
<BCC>
<BBB/>
<BBB/>
<BBB/>
BCC>
<DDB>
<BBB/>
<BBB/>
DDB>
<BEC>
<CCC/>
<DBD/>
BEC>
AAA>
//*[contains(name(),'C')]
<AAA>
<BCC>
<BBB/>
<BBB/>
<BBB/>
BCC>
<DDB>
<BBB/>
<BBB/>
DDB>
<BEC>
<CCC/>
<DBD/>
BEC>
AAA>
8. string-length() :
//*[string-length(name()) = 3]
<AAA>
<Q/>
<SSSS/>
<BB/>
<CCC/>
<DDDDDDDD/>
<EEEE/>
AAA>
//*[string-length(name()) < 3]
<AAA>
<Q/>
<SSSS/>
<BB/>
<CCC/>
<DDDDDDDD/>
<EEEE/>
AAA>
//*[string-length(name()) > 3]
<AAA>
<Q/>
<SSSS/>
<BB/>
<CCC/>
<DDDDDDDD/>
<EEEE/>
AAA>
9. "|" :
//CCC | //BBB
<AAA>
<BBB/>
<CCC/>
<DDD>
<CCC/>
DDD>
<EEE/>
AAA>
/AAA/EEE | //BBB
<AAA>
<BBB/>
<CCC/>
<DDD>
<CCC/>
DDD>
<EEE/>
AAA>
/AAA/EEE | //DDD/CCC | /AAA | //BBB
<AAA>
<BBB/>
<CCC/>
<DDD>
<CCC/>
DDD>
<EEE/>
AAA>