以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 DTD/XML Schema 』 (http://bbs.xml.org.cn/list.asp?boardid=23) ---- [求助]这个xml的schema怎么写? (http://bbs.xml.org.cn/dispbbs.asp?boardid=23&rootid=&id=57996) |
-- 作者:Bingler -- 发布时间:1/12/2008 7:09:00 PM -- [求助]这个xml的schema怎么写? 本人是初学者,下面这段xml的schema要怎么写啊?我写了好久就是写不出,大家帮帮我吧,谢谢了. <auxiliary_accounting> <item name="a">a</item> </auxiliary_accounting>
|
-- 作者:enyaxp -- 发布时间:1/12/2008 8:34:00 PM -- <!xml version="1.0" encoding="UTF-8"> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="auxiliary_accounting"> <xs:complexType> <xs:element name="item" type="xs:string"> <xs:restriction base="xs:string"> <xs:maxLength value="20"> //看你前面的发帖这里的值好像有最长限制,我这里给你加上了 </xs:restriction> <xs:attribute name="name" type="xs:string" use="required"> //不知道有没有特殊要求,这里就一般化处理了 </xs:element> </xs:complexType> </xs:element> </xs:schema> 剩下的参考规范一点一点写吧,体力活,常写就好了。 |
-- 作者:Bingler -- 发布时间:1/12/2008 9:51:00 PM -- 我按你的代码试了一下,好象还是不行 |
-- 作者:Bingler -- 发布时间:1/13/2008 11:21:00 AM -- 经过网上搜索,终于写出来了,代码如下: <xsd:element name="auxiliary_accounting"> <xsd:complexType> <xsd:sequence> <xsd:element name="item" maxOccurs="unbounded"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="itemType"> <xsd:attribute name="name" type="xsd:string" use="required"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:simpleType name="itemType"> <xsd:restriction base="xsd:string"> <xsd:maxLength value="20"/> </xsd:restriction> </xsd:simpleType> |
-- 作者:waoywssy -- 发布时间:1/22/2008 12:31:00 PM -- <xs:element name="auxiliary_accounting"> <xs:complexType> <xs:sequence> <xs:element name="item"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="name" type="xs:string"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
46.875ms |