`
major361
  • 浏览: 31504 次
  • 性别: Icon_minigender_1
  • 来自: 福州->杭州
社区版块
存档分类
最新评论

xml schema写法

XML 
阅读更多
1.把xml文件和schema文件关联起来

1)和本地的shema关联
<rootElement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xsi:noNamespaceSchemaLocation="xxx.xsd">
或者xsi:noNamespaceSchemaLocation="file:///文件的路径">


2)第二种关联的方法
在xsd文件中定义如下:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://localhost">


在xml文件中定义如下
<rootElement
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://localhost"
	xsi:schemaLocation="http://localhost planes.xsd">
<!--schemaLocation以命名空间开始然后接一个空格 再跟xsd文件名,可以多个-->


2.当elementFormDefault="unqualified" 表示全局元素和类型归于目标命名空间,而局部元素归于无名的命名空间
当elementFormDefault="qualified" 表示全局元素和类型,以及局部元素都归于目标命名空间

3.attributeFormDefault="qualified" 表示属性值归于目标命名空间
当attributeFormDefault="unqualified"时表示属性值归于拥有属性的元素??对吗??
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics