惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
T
The Exploit Database - CXSecurity.com
C
CERT Recently Published Vulnerability Notes
P
Palo Alto Networks Blog
T
Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Tenable Blog
F
Full Disclosure
TaoSecurity Blog
TaoSecurity Blog
I
InfoQ
AI
AI
云风的 BLOG
云风的 BLOG
K
Kaspersky official blog
Microsoft Azure Blog
Microsoft Azure Blog
S
SegmentFault 最新的问题
Y
Y Combinator Blog
GbyAI
GbyAI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Privacy International News Feed
aimingoo的专栏
aimingoo的专栏
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
I
Intezer
L
Lohrmann on Cybersecurity
博客园_首页
量子位
Blog — PlanetScale
Blog — PlanetScale
The Last Watchdog
The Last Watchdog
Cisco Talos Blog
Cisco Talos Blog
博客园 - 叶小钗
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Help Net Security
Help Net Security
Security Archives - TechRepublic
Security Archives - TechRepublic
Apple Machine Learning Research
Apple Machine Learning Research
W
WeLiveSecurity
N
News and Events Feed by Topic
S
Schneier on Security
T
Tor Project blog
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
T
Threat Research - Cisco Blogs
H
Help Net Security
V
V2EX
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Security @ Cisco Blogs
博客园 - Franky
有赞技术团队
有赞技术团队
Martin Fowler
Martin Fowler

博客园 - 水冰月

不要认为停留在心灵的舒适区域 成功不需要时间 只要你坚持 淘宝 世界名校的课件[转校内] 标题 javascript操作Select标记中options集合 七个受用一生的心理寓言 一辈子都有用的的75句话 完美的自己 一生中无能为力的10件事 浅谈asp.net2.0验证控件的安全使用 Javascript脚本和asp.net验证控件同时验证的代码 远程桌面“中断”巧解决 当DataSet为空时也显示GridView的表头(vs05) - 水冰月 - 博客园 收集一些.NET开发资源站点和部分优秀.NET开源项目 XP实用技巧:恢复"显示桌面"按钮 在IE7.0中如何设置代理 Win 2003 Server重新安装Oracle9i 在windows xp环境下如何完全卸载 oracle9i
xsd验证xml
水冰月 · 2008-09-28 · via 博客园 - 水冰月

 XML结构定义 ( XML Schemas Definition )
    XML Schema
DTD的替代品。XML Schema语言也就是XSD

    XML Schema
描述了XML文档的结构。可以用一个指定的XML Schema来验证某个XML文档,以检查该XML文档是否符合其要求。
  文档设计者可以通过
XML Schema指定一个XML文档所允许的 结构和内容,并可据此检查一个XML文档是否是有效的。XML Schema本身是一个XML文档,它符合XML
语法结构。
  可以用通用的
XML解析器解析它。

   
一个XML Schema会定义:文档中出现的元素、文档中出现的属性、子元素、子元素的数量、子元素的顺序、元素是否为空、元素和属性的数据类型、元素或属性的默认和固定值。

    XSD文件的后缀名为.xsd
  
  
在下面的代码示例中,上面的架构添加到 XmlReaderSettings 对象的 XmlSchemaSetSchemas 属性中。 XmlReaderSettings 对象作为参数传递给验证上述 XML 文档的 XmlReader 对象的 Create 方法。XmlReaderSettings 对象的 ValidationType 属性设置为 Schema,强制通过 XmlReader 对象的 Create 方法验证 XML 文档。 ValidationEventHandler 添加到 XmlReaderSettings 对象以处理 XML 文档和架构验证过程中发现的错误所引发的任何 Warning Error 事件。
  
下面是一个例子:

Code

contosoBooks.xsd

Code

contosoBooks.xml

Code


备注:关于Xsd的其他的一些类或者实例

Code