[英]XMLSchema and XMLSchema-instance namespaces without schemaLocation
I have few questions about xml namespace, I will explain with these three pieces of code: 我对xml命名空间的问题很少,我将用这三段代码解释:
1 - Very simple XML Schema: 1 - 非常简单的XML Schema:
<?xml version="1.0" encoding="US-ASCII"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.library.com"
targetNamespace="http://www.library.com"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<element name="Book" type="tns:BookType" />
<complexType name="BookType">
<sequence>
<element name="Title" type="string" />
<element name="Author" type="string" />
</sequence>
</complexType>
</schema>
2 - XML that use the newly created xml schema: 2 - 使用新创建的xml架构的XML:
<?xml version="1.0" encoding="US-ASCII"?>
<Book xmlns:xsi="http://www.wc3.org/2001XMLSchema-instance"
xsi:schemaLocation="http://www.library.com ex9.xsd"
xmlns="http://www.library.com">
<Title>Scherlock Holmes</Title>
Author>Arthur Conan Doyle</Author>
</Book>
3 - Another fragment code without relationship from the two above: 3 - 与上述两个没有关系的另一个片段代码:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd">
....
</beans>
<attribute>
, <complexType>
, <sequence>
, etc? <attribute>
, <complexType>
, <sequence>
等元素? schemaLocation
is necessary because their definition is implied by the XML Schema Recommendation. schemaLocation
,因为XML Schema Recommendation暗示了它们的定义。 xs:attribute
, etc. xs:attribute
等的含义。 http://www.w3.org/2001/XMLSchema-instance
is a built-in namespace consisting of components whose definitions are already implied by the XML Schema Recommendation. http://www.w3.org/2001/XMLSchema-instance
是一个内置命名空间,由XML Schema Recommendation暗示的组件组成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.