开发者

Xpath in XSD C#

开发者 https://www.devze.com 2023-03-28 21:36 出处:网络
I have an XSD file such as: <xs:schema targetNamespace=\"...\"> <xs: import namespace=\"...\">

I have an XSD file such as:

<xs:schema targetNamespace="...">
 <xs: import namespace="...">
<xs: import namespace="...">
<xs: import namespace="...">
<xs:element name="FSM">
<开发者_Python百科;xs:annotation>
<xs:appinfo>
<Info>
<ID> 44</ID>
<Priority>3</Priority>
</Info>
</xs:appinfo>
</xs:annotation>
</xs:element>
</schema>

I hvae more them one "xs:element" in the schema,but it's just an example... I can't get the FSM node. I tried

`xDoc.SelectSingleNode(@"//FSM");` 

(xDoc is XMLDocument) but I got null. I tried the xpath @"//*[name()=FSM" and i got null. What the xPath to get the FSM element. I want something generic so i could find it wherever it is in all the elements in the XSD. P.S I can only use .Net 2...


If you want to apply XPath to the schema itself then you need a path like //xs:element[@name = 'FSM'].


I think you'll have to add the xs namespace to the xpath statement.

0

精彩评论

暂无评论...
验证码 换一张
取 消