遍历XSD [英] Traversing XSD

查看:74
本文介绍了遍历XSD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

有没有办法使用XPath遍历XSD。我的研究表明没有

传统方式,但我想知道是否有解决方法。

感谢您的帮助和时间。

Hi there,
Is there a way to traverse an XSD using XPath. My research indicates no
conventional way of doing it, but I was wondering if there was a work around.
Thanks for your help and time.

推荐答案




MMA写道:


MMA wrote:
有没有办法遍历XSD使用XPath。我的研究表明没有传统的方法,但我想知道是否有解决方法。
Is there a way to traverse an XSD using XPath. My research indicates no
conventional way of doing it, but I was wondering if there was a work around.




XSD是带命名空间的XML,因此使用XPath XSD文件可能是
。如果您需要有关特定XPath的帮助,请告诉我们

架构的详细信息。


..NET还提供XML架构对象模型(SOM)它允许你以结构化的

的方式提取模式的类型/元素/属性定义,参见

< http:// msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxsdschemaobjectmodelsom.asp>

-


Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


我不完全确定你的意思是遍历。


但是,XML Schema是用xml(故意)所以你可以

肯定会对它评估XPath表达式:


例如。

<?xml version = " 1.0" encoding =" ISO-8859-1"?>

< xsd:schema xmlns =" http://Dickster.com"

xmlns:xsd = " HTTP://www.w3.org/2001/XMLSchema" =" http://Dickster.com">


< xsd:element name =" person">

< xsd: complexType>

< xsd:sequence>

< xsd:element name =" firstname" type =" xsd:string" />

< xsd:element name =" surname" type =" xsd:string" />

< / xsd:sequence>

< / xsd:complexType>

< ; / xsd:element>

< / xsd:schema>


eg

XPath表达式// xsd:element [@name =''surname'']返回

xsd:element节点,该节点有一个名为''name'的属性设置为

''surname''

I''m not fully sure what you mean by traverse.

However, XML Schema is written in xml (intentionally) so you can
certainly evaluate XPath expressions against it:

eg.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns="http://Dickster.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" ="http://Dickster.com">

<xsd:element name="person">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="firstname" type="xsd:string"/>
<xsd:element name="surname" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

e.g.
The XPath expression //xsd:element[@name=''surname''] returns the
xsd:element node which has an attribute called ''name'' set to
''surname''


XML Schema是用xml编写的(有意)

因此你当然可以根据它来评估XPath表达式:


例如。


< xsd:schema xmlns =" http://Dickster.com"

xmlns:xsd = http://www.w3.org/2001/XMLSchema"

targetNamespace =" http://Dickster.com">


< xsd:element name =" person">

< xsd:complexType>

< xsd:sequence>

< ; xsd:element name =" firstname" type =" xsd:string" />

< xsd:element name =" surname" type =" xsd:string" />

< / xsd:sequence>

< / xsd:complexType>

< ; / xsd:element>

< / xsd:schema>


eg

XPath表达式// xsd:element [@name =''surname'']返回

xsd:element节点,该节点有一个名为''name'的属性设置为

''surname''

XML Schema is written in xml (intentionally)
Therefore you can certainly evaluate XPath expressions against it:

eg.

<xsd:schema xmlns="http://Dickster.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://Dickster.com">

<xsd:element name="person">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="firstname" type="xsd:string"/>
<xsd:element name="surname" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

e.g.
The XPath expression //xsd:element[@name=''surname''] returns the
xsd:element node which has an attribute called ''name'' set to
''surname''


这篇关于遍历XSD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆