【发布时间】:2015-10-17 02:10:10
【问题描述】:
虽然做过XML Schema,但还是有些疑惑:
以下是示例 XML Schema(来自 w3schools):
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com"
elementFormDefault="qualified">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
“名称”和“类型”属性从何而来?在这个 XSD 中,我们定义了可以出现在 XML 文档中的元素。
我们为 XSD 中的大多数元素/构造添加前缀。例如:xs:element、xs:complexType 等。 “名称”和“类型”从何而来?
任何澄清表示赞赏。
【问题讨论】:
-
架构就是这样定义的。看看this
-
我要问的是,“name”、“type”是某个命名空间的一部分吗?