0
我有,我想提取節點值的XML屬性:XPATH C#返回一個XML節點與含有一定值
<oslc:creation rdf:resource="https://timo-pcvirtual:9443/qm/oslc_qm/contexts/_yAh_8gCIEeS7hY-fywlluw/resources/com.ibm.rqm.planning.VersionedExecutionScript" />
<oslc:resourceShape rdf:resource="https://timo-pcvirtual:9443/qm/oslc_qm/contexts/_yAh_8gCIEeS7hY-fywlluw/shape/creation/com.ibm.rqm.planning.VersionedExecutionScript" />
<oslc:resourceType rdf:resource="http://open-services.net/ns/qm#TestScript" />
</oslc:CreationFactory>
</oslc:creationFactory>
<oslc:creationFactory>
<oslc:CreationFactory>
<dcterms:title>Default creation factory for TestResult</dcterms:title>
<oslc:creation rdf:resource="https://timo-pcvirtual:9443/qm/oslc_qm/contexts/_yAh_8gCIEeS7hY-fywlluw/resources/com.ibm.rqm.execution.ExecutionResult" />
<oslc:resourceShape rdf:resource="https://timo-pcvirtual:9443/qm/oslc_qm/contexts/_yAh_8gCIEeS7hY-fywlluw/shape/creation/com.ibm.rqm.execution.ExecutionResult" />
<oslc:resourceType rdf:resource="http://open-services.net/ns/qm#TestResult" />
</oslc:CreationFactory>
</oslc:creationFactory>
<oslc:creationFactory>
<oslc:CreationFactory>
<dcterms:title>Default creation factory for TestCase</dcterms:title>
<oslc:creation rdf:resource="https://timo-pcvirtual:9443/qm/oslc_qm/contexts/_yAh_8gCIEeS7hY-fywlluw/resources/com.ibm.rqm.planning.VersionedTestCase" />
<oslc:resourceShape rdf:resource="https://timo-pcvirtual:9443/qm/oslc_qm/contexts/_yAh_8gCIEeS7hY-fywlluw/shape/creation/com.ibm.rqm.planning.VersionedTestCase" />
<oslc:resourceType rdf:resource="http://open-services.net/ns/qm#TestCase" />
</oslc:CreationFactory>
</oslc:creationFactory>
<oslc:creationFactory>
<oslc:CreationFactory>
<dcterms:title>Default creation factory for TestExecutionRecord</dcterms:title>
<oslc:creation rdf:resource="https://timo-pcvirtual:9443/qm/oslc_qm/contexts/_yAh_8gCIEeS7hY-fywlluw/resources/com.ibm.rqm.execution.TestcaseExecutionRecord" />
<oslc:resourceShape rdf:resource="https://timo-pcvirtual:9443/qm/oslc_qm/contexts/_yAh_8gCIEeS7hY-fywlluw/shape/creation/com.ibm.rqm.execution.TestcaseExecutionRecord" />
<oslc:resourceType rdf:resource="http://open-services.net/ns/qm#TestExecutionRecord" />
</oslc:CreationFactory>
</oslc:creationFactory>
<oslc:creationFactory>
<oslc:CreationFactory>
<dcterms:title>Default creation factory for
</rdf:RDF>
,我想獲得
<oslc:queryCapability>\<oslc:QueryCapability>\ attribute value of oslc:queryBase (which is :"https://timo-pcvirtual:9443/qm/oslc_qm/contexts/_yAh_8gCIEeS7hY-fywlluw/resources/com.ibm.rqm.planning.VersionedTestCase")
我使用C#,而此格式,但犯規返回屬性值...請幫助...
XPathNavigator nav = projectAreaContent.CreateNavigator();
XmlNamespaceManager manager = new XmlNamespaceManager(nav.NameTable);
manager.AddNamespace("oslc", "http://open-services.net/ns/core#");
manager.AddNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
XPathNodeIterator iterator = nav.Select("//oslc:queryBase[contains(@rdf:resource,'VersionedTestCase')]", manager);
我把完整的XML放在:[link](http://pastebin.com/Ux6mytyU) – TraceKira