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 a switch for 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").

对XSD schema文件中elementFormDefault属性的理解的更多相关文章

  1. Spring中使用@Value读取porperties文件中的属性值方法总结及注意事项

    本文为博主原创,转载请注明出处. 此前曾总结过使用工具类读取properties文件中的属性值,有兴趣的可以看一下. 如何快速获取properties中的配置属性值:https://www.cnblo ...

  2. Maven项目中在properties 中使用 ${} 来引用pom文件中的属性

    比如在pom文件中定义了属性如下: <jdbc.host.global>127.0.0.1</jdbc.host.global> <jdbc.databasename.g ...

  3. vue项目中使用bpmn-流程图xml文件中节点属性转json结构

    内容概述 本系列“vue项目中使用bpmn-xxxx”分为七篇,均为自己使用过程中用到的实例,手工原创,目前陆续更新中.主要包括vue项目中bpmn使用实例.应用技巧.基本知识点总结和需要注意事项,具 ...

  4. Bukkit编程之动态向yml文件中添加属性

    yaml = new Yaml(); String goods = args[0]; String goodsNum = args[1]; YamlConfiguration yc = new Yam ...

  5. Java:使用DOM4j来实现读写XML文件中的属性和元素

    DOM4可以读取和添加XML文件的属性或者元素 读取属性: public static void ReadAttributes() throws DocumentException { File fi ...

  6. Spring获取properties文件中的属性

    1.前言 本文主要是对这两篇blog的整理,感谢作者的分享 Spring使用程序方式读取properties文件 Spring通过@Value注解注入属性的几种方式 2.配置文件 applicatio ...

  7. Android学习笔记之mainfest文件中android属性

    android:allowTaskReparenting 是否允许activity更换从属的任务,比如从短信息任务 切换到浏览器任务. -------------------------------- ...

  8. schema文件中cube的事实表使用视图方法

    在cube中可以使用查询结果或者视图来当做事实表,其中view的alias相当于表名,这个要和同一个cube中的level的表名对应,代码如下: <Cube name="YHZXZLF ...

  9. 注解形式读取properties文件中的属性

    1.spring.xml中加入(多个properties 用逗号隔开)  <context:property-placeholder location="classpath:jdbc. ...

随机推荐

  1. [linux]ubuntu14.04通过apt-get安装软件失败

    1.首先查看 dns 配置 sudo vi /etc/resolv.conf nameserver 114.114.114.114 nameserver 8.8.8.8 2.修改 apt-get 源 ...

  2. python语言学习4——使用文本编辑器

    在Python的交互式命令行写程序,好处是一下就能得到结果,坏处是没法保存,下次还想运行的时候,还得再敲一遍. 所以,实际开发的时候,我们总是使用一个文本编辑器来写代码,写完了,保存为一个文件,这样, ...

  3. Amazon.com : The Odyssey of the Manual Toothbrusher

    Amazon.com : The Odyssey of the Manual Toothbrusher The Odyssey of the Manual Toothbrusher

  4. 什么是Spring?Spring是什么?

    Spring概述: Spring是一个开源框架,是为了解决企业应用程序开发复杂性而开发的. 从简单性.可測试性和松耦合的角度而言,不论什么java应用都能够从Spring中受益. 简而言之,Sprin ...

  5. Object.wait()的使用方法示例(转)

    本文节选自 Effective Java by Joshua Bloch 和 Concurrent Programming in Java by Doug Lea. 1.3 原子数据的同步 java语 ...

  6. 用JS实现发邮件的功能 完美解决

    怎样用JS实现发邮件的功能? 我想用JS实现把页面文本框中的内容直接通过邮件的方式发送到一个指定的邮箱.fengxq给出的答案是<script language=javascript>if ...

  7. I2C操作笔记——以 AT24C04为例

    1.前言     对于大多数project师而言,I2C永远是一个头疼的问题.相比UART和SPI而言,I2C的时序要复杂一些,I2C组合变化也丰富一些.在这里以AT24C04为例说明I2C使用过程中 ...

  8. Linux iptables简单配置

    #!/bin/sh#modprobe ipt_MASQUERADEmodprobe ip_conntrack_ftpmodprobe ip_nat_ftpiptables -Fiptables -t ...

  9. Python-方法重载的问题

    定义一个父类,在写一个子类继承他,重载他的foo方法: class Father: def foo(self): print"I am father" class Son(Fath ...

  10. Android利用Get、Post 获取网络数据

    首先是Get: 布局非常easy.就一个button,主要看一下MainActivity吧: package com.francis.httpget; import android.app.Activ ...