xml - Xpath expression for an element that has two child elements with the same name. -
i need figure out xpath expression sections co-taught 2 instructors. know how sections instructor child, i'm lost on how sections more 1 instructor child.
<?xml version="1.0" encoding="utf-8"?> <courses> <course number="341" credits="4.0"> <title>data structures</title> <section number="01" delivery="classroom"> <enrollment>15</enrollment> <room>ea244</room> <instructor> <first>nicole</first> <last>anderson</last> </instructor> </section> <section number="02" delivery="online"> <enrollment>10</enrollment> <instructor> <first>nicole</first> <last>anderson</last> </instructor> <instructor> <first>chi-cheng</first> <last>lin</last> </instructor> </section> <section number="03" delivery="classroom"> <enrollment>12</enrollment> <room>sh102</room> <instructor> <first>mark</first> <last>funk</last> </instructor> </section> </course> <course number="368" credits="4.0"> <title>introduction bioinformatics</title> <section number="01" delivery="classroom"> <enrollment>9</enrollment> <room>at102</room> <instructor> <first>chi-cheng</first> <last>lin</last> </instructor> <instructor> <first>mingrui</first> <last>zhang</last> </instructor> </section> </course> <course number="375" credits="4.0"> <title>computer systems</title> <section number="01" delivery="itv"> <enrollment>18</enrollment> <room>ea244</room> <instructor> <first>chi-cheng</first> <last>lin</last> </instructor> </section> </course> <course number="385" credits="3.0"> <title>applied database management systems</title> <section number="01" delivery="classroom"> <enrollment>26</enrollment> <room>st108</room> <instructor> <first>nicole</first> <last>anderson</last> </instructor> </section> </course> <course number="413" credits="3.0"> <title>advanced networking</title> <section number="01" delivery="online"> <enrollment>10</enrollment> <instructor> <first>chi-cheng</first> <last>lin</last> </instructor> </section> </course> </courses>
you can use //section[instructor[2]]
or //section[count(instructor) > 1]
.
Comments
Post a Comment