[心缘地方]同学录
首页 | 功能说明 | 站长通知 | 最近更新 | 编码查看转换 | 代码下载 | 常见问题及讨论 | 《深入解析ASP核心技术》 | 王小鸭自动发工资条VBA版
登录系统:用户名: 密码: 如果要讨论问题,请先注册。

[转]xml中如何引用W3C XML Schema

上一篇:[转]linux下安装mysql时候遇到mysql.sock文件问题
下一篇:[疑问]JavaMail的mail.smtp.sendpartial不起作用?

添加日期:2009/3/19 7:07:01 快速返回   返回列表 阅读5217次
下面是从http://www.w3schools.com/schema/schema_complex_any.asp 拷下来的。
这个例子想说明,可以用children元素代替person中声明的any元素:

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

<persons xmlns="http://www.microsoft.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:SchemaLocation="http://www.microsoft.com family.xsd
http://www.w3schools.com children.xsd"
>
<person>
<firstname>Hege</firstname>
<lastname>Refsnes</lastname>
<children>
  <childname>Cecilie</childname>
</children>
</person>
<person>
<firstname>Stale</firstname>
<lastname>Refsnes</lastname>
</person>
</persons>

对这个例子,family.xsd应该声明targetNamespace为 http://www.microsoft.com,而children.xsd应该声明targetNamespace为 http://www.w3schools.com 。

只有这样,实例xml文件中引用两个xsd的下面这一句才有用:
xsi:SchemaLocation="http://www.microsoft.com family.xsd
http://www.w3schools.com children.xsd"
==========================
没有命名空间的,可以这样:
<音乐 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="musicSchemaXSD.xsd">
 

评论 COMMENTS
没有评论 No Comments.

添加评论 Add new comment.
昵称 Name:
评论内容 Comment:
验证码(不区分大小写)
Validation Code:
(not case sensitive)
看不清?点这里换一张!(Change it here!)
 
评论由管理员查看后才能显示。the comment will be showed after it is checked by admin.
CopyRight © 心缘地方 2005-2999. All Rights Reserved