Schema中的elementFormDefault
elementFormDefault取值:qualified 或者 unqualified
在http://www.velocityreviews.com/forums/t292290-xsd-what-is-elementformdefault-qualified-for.html这个网站,发现Boris的回答:
All"qualified" elements and attributes are in the targetNamespace of the
schema and all "unqualified" elementsand attributes are in no namespace.
All global elements and attributes are qualified.
意思是这样的:
1、在xml中,所有引用xsd的全局的元素都必须加上命名空间的前缀
(例如xmlns:aa=http://www.example.org/classroom,全局元素都得加上aa)。
2、非全局的元素当设置为qualified时,必须添加命名空间的前缀。
3、非全局的元素当设置为unqualified时,不必也不能添加前缀。
下面是一个简单的例子:
a. 当设置为unqualified时,user为全局元素(可作为根元素)必须添加前缀,非全局元素
(id,name)不必添加前缀。
b. 当设置为qualified时,所有的元素都必须添加前缀。
其实elementFormDefault的qualified/unqualified还与schema的设计模式有关系,目前常用的有Russian Roll , Salami Slice , Venetian Blind
详细及最佳实践可以参照:http://www.xfront.com/GlobalVersusLocal.html#BestPractice
Salami Slice这种schema的设计模式,将所有的元素设置为全局元素,设置不设置elementFormDefault是没有任何意义的,文章的开通说过,所有的全局元素必须添加前缀。
http://www.xfront.com/GlobalVersusLocal.html#BestPractice
上网站中提到的Venetian Blind的优势之一:
UseelementFormDefault to act as aswitchfor controlling namespaceexposure - if you want element namespaces exposed in instance documents, simplyturn the elementFormDefault switch to "on" (i.e, setelementFormDefault= "qualified"); if you don't want elementnamespaces
exposed in instance documents, simply turn the elementFormDefaultswitch to "off" (i.e., setelementFormDefault="unqualified").
分享到:
相关推荐
XML Schema xsdXML Schema xsdXML Schema xsdXML Schema xsd
XSD根据xml生成schema文件
xsd.exe xml schema文件生成程序,将xml文件转换成xsd文件,然后可以通过xjc生成java类
命名空间 dtd文件、Schema文件 (xsd)文件的引入1
XSD(Schema)教程
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:tool="http://www.springframework.org/schema/tool" targetNamespace=...
生成xml schema文件
摘录自IEC 61850-6,包括: SCL.xsd SCL_BaseSimpleTypes.xsd SCL_BaseTypes.xsd SCL_Communication.xsd SCL_DataTypeTemplates.xsd SCL_Enums.xsd SCL_IED.xsd SCL_Substation.xsd sample.xml
jbpm4.4 schema.xsd jbpm4.4 schema.xsd jbpm4.4 schema.xsd jbpm4.4 schema.xsd jbpm4.4 schema.xsd
spring3.0 xsd文件 spring3.0 xsd文件 spring3.0 xsd文件 spring3.0 xsd文件 spring3.0 xsd文件 spring3.0 xsd文件
xsd文件 xsd1.4,xsd2.0,xsd3.0
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:tool="http://www.springframework.org/schema/tool" targetNamespace=...
1、下载xmlbeans-2.3.0.jar。 2、创建配置文件my.xsdconfig。 3、java方法如下: ... "D:\\2\\dcc.xsd",//xsd文件存放位置 "D:\\2\\my.xsdconfig"};//xsd配置描述文件 SchemaCompiler.main(a); } }
dubbo配置xml文件报错“Multiple annotations found at this line: - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:...dubbo.xsd文件下载
Eclipse dubbo Multiple annotations found at this line: Multiple annotations found ...修改key值和配置文件的http://code.alibabatech.com/schema/dubbo/dubbo.xsd 相同 回到项目,左击配置文件xml 选择validate
definitive+XML+Schema中文版本 XML课程资料 XML+Schema官方教程(9loong中文版)修正版2009 实战XML第二版 XML+指南 XML笔记 轻松搞定XML XML手册+第4版
但是有时候xsd生成的java类中含有汉字,结果总是有些问题。 可是xjc命令参数又没有encoding参数之类的。在网上搜了一通,忽然发现了一个好东东:xjc是由com.sun.tools.internal.xjc.Driver实现的,因此 批处理命令...
解压后dubbo.xsd 即可用,解压后dubbo.xsd 即可用,解压后dubbo.xsd 即可用,解压后dubbo.xsd 即可用
CXF和Spring整合时,配置文件中所需要的CXF标签的 schema 文件,将所需的xsd文件配置到本地,可以解决部分IDE在编写配置文件时,无法自动提示的问题。