我想写一个xml如下:
<config>
<propety id="usercount">10</propety>
<propety id="filecount">10</propety>
</config>
为了给这些xml写一个xsd文件,来约束这个xml,但是文凭只会歌复合元素定义属性, 不会给简单元素定义属性。我的xsd文件如下,
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- 简易属性定义 -->
<xs:attribute name="id" type="xs:string" /> <!-- 简易元素定义 -->
<xs:element name="propety" type="xs:int"/>
<!-- 符合元素定义 -->
<xs:element name="config" >
<xs:complexType>
<xs:sequence>
<xs:element ref="propety" maxOccurs="2">
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
但是我的xml的中提示我没有给propety定义这个id属性,如何给简单元素定义一些属性。
<config>
<propety id="usercount">10</propety>
<propety id="filecount">10</propety>
</config>
为了给这些xml写一个xsd文件,来约束这个xml,但是文凭只会歌复合元素定义属性, 不会给简单元素定义属性。我的xsd文件如下,
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- 简易属性定义 -->
<xs:attribute name="id" type="xs:string" /> <!-- 简易元素定义 -->
<xs:element name="propety" type="xs:int"/>
<!-- 符合元素定义 -->
<xs:element name="config" >
<xs:complexType>
<xs:sequence>
<xs:element ref="propety" maxOccurs="2">
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
但是我的xml的中提示我没有给propety定义这个id属性,如何给简单元素定义一些属性。
解决方案 »
- 关于JFrame界面的按钮事件监听
- struts2.0 action里怎么传一些值去jsp呀
- spring+struts1.3+jpa出错
- weblogic使用调查
- 一个b/s架构的培训系统都包含那些模块
- Tomcat5启动时提示java.sql.SQLException:……Error establishing socket
- jsf错误求助(急,在线等!!!解决后马上结贴)
- Castor不能设置CDATA,郁闷。大家都使用什么XML-JAVA的数据绑定工具?
- !急啊 立刻给分!weblogic.ant.taskdefs.ejb.DDInit生成xml时出错信息!什么原因?
- 请问ejb怎么配置?
- ftp上传文件550异常
- Spring mvc 的restful拦截路径问题,,谢谢啦 急。。。。。。。。。。
<!-- 简易元素定义 -->
<xs:element name="propety">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:int">
<!-- 简易属性定义 -->
<xs:attribute name="id" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>