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

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
The GitHub Blog
The GitHub Blog
C
Check Point Blog
博客园_首页
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
F
Full Disclosure
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
G
GRAHAM CLULEY
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
博客园 - 司徒正美
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
云风的 BLOG
云风的 BLOG
Cisco Talos Blog
Cisco Talos Blog
Know Your Adversary
Know Your Adversary
雷峰网
雷峰网
V
V2EX - 技术
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Spread Privacy
Spread Privacy
罗磊的独立博客
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
SecWiki News
SecWiki News
Schneier on Security
Schneier on Security
O
OpenAI News
Jina AI
Jina AI
PCI Perspectives
PCI Perspectives
Cyberwarzone
Cyberwarzone
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog RSS Feed
I
InfoQ
D
Docker
P
Palo Alto Networks Blog
Recorded Future
Recorded Future
M
MIT News - Artificial intelligence
博客园 - Franky
B
Blog
Scott Helme
Scott Helme
博客园 - 叶小钗
D
DataBreaches.Net

博客园 - Freeman Shen

.NET面试题 (转)C#中的Abstract和Virtual函数区分,因我老弄不明白这个问题,所以转到这儿 Check Constraints限制本表的行数 数据库中主键和外键的设计原则 讲解SQL Injection一篇不错的文章,地址贴一下 Queue<(Of <(T>)>) 类,msdn上的一篇文章,便于查看 初次接触.Net下的信号量(semaphore) 某“高人”谈论股市,对现在行情的分析 编辑电影字幕,编辑srt格式 左联,右联和内联的区别(图示) 用JavaScript如何获取客户端的操作系统是window2000还是window xp? 在IBatisNet框架,MasterPage,基类中配置Ajaxpro 自从离开哈尔滨后就没再管理这个blog了,以后还得继续努力啊 70-528试题2:仍然是有关xml的 70-582试题1 由清明节想到的 今天心情不太好,没什么可写的 由DataBind()而发现的 生命之价
题1的答案是(B),这是一个xml和schema的问题!
Freeman Shen · 2007-04-12 · via 博客园 - Freeman Shen

 在这儿我找了一个例子来说明一下吧!希望大家有什么好的代码一起分享,一起学习!共同进步!

 1<%@ Page Language="C#" %>
 2
 3<%@ Import Namespace="System.Xml" %>
 4<%@ Import Namespace="System.Xml.Schema" %>
 5
 6<script runat="server">    
 7    private StringBuilder _builder = new StringBuilder();
 8    void Page_Load(object sender, EventArgs e)
 9    {
10        string xmlPath = Request.PhysicalApplicationPath + @"\App_Data\Authors.xml";
11        string xsdPath = Request.PhysicalApplicationPath + @"\App_Data\Authors.xsd";
12        XmlSchemaSet schemaSet = new XmlSchemaSet();
13        schemaSet.Add(null, xsdPath);
14        XmlReader reader = null;
15        XmlReaderSettings settings = new XmlReaderSettings();
16        settings.ValidationEventHandler += new ValidationEventHandler(this.ValidationEventHandler);
17        settings.ValidationType = ValidationType.Schema;
18        settings.Schemas = schemaSet;
19        reader = XmlReader.Create(xmlPath, settings);
20        while (reader.Read())
21        {
22        }

23        if (_builder.ToString() == String.Empty)
24            Response.Write("Validation completed successfully.");
25        else
26            Response.Write("Validation Failed. <br>" + _builder.ToString());
27    }

28
29    void ValidationEventHandler(object sender, ValidationEventArgs args)
30    {
31        _builder.Append("Validation error: " + args.Message + "<br>");
32    }
    
33
</script>
34
35<html xmlns="http://www.w3.org/1999/xhtml">
36<head runat="server">
37    <title>XSD Validation using XmlSchemaSet</title>
38</head>
39<body>
40    <form id="form1" runat="server">
41        <div>
42        </div>
43    </form>
44</body>
45</html>

因为以前没看过xml,现在是刚开始学习,所以耽搁了几天。这是从同事那儿来的代码,也没做修改就贴出来了!

Authors.xml

下边是Schema:

Authors.xsd