2013-07-14 29 views
-1

我有以下xml文档我需要选择components/section/templateid = 3.11的所有入口节点。什么应该是XPath的呢?用于复杂文档的XPath

 <component> 
     <structuredBody> 
       <component> 
        <section> 
         <templateId root="1.11"/>   
         <entry>......</entry>                
        </section>    
       </component>  
       <component> 
        <section> 
         <templateId root="2.11"/> 
         <templateId root="2.12"/>     
         <entry>......</entry> 
         <entry>......</entry> 
        </section> 
       </component> 
       <component> 
        <section> 
         <templateId root="3.11"/> 
         <templateId root="3.12"/>     
         <entry>......</entry> 
         <entry>......</entry> 
        </section> 
       </component>    
     <structuredBody> 
    </component> 

回答

0

这会满足您的需求吗?

//component/section/templateId[@root='3.11']/following-sibling::entry 
+0

我试过了,它没有返回任何东西。 – user1649941

+0

对不起,我忘记提及我应该在这添加命名空间? – user1649941

+0

您是否会建议我可以获取复杂XPath样本列表的任何链接? – user1649941