Java论坛网»Java技术»高分求助!写了个Schema 书上改过来 但老是出错 validate通不过
高分求助!写了个Schema 书上改过来 但老是出错 validate通不过
问?:
内容如下
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="itemlist" type="itemlist"> </xsd:element>
<!-- 定义type元素的复杂类型 -->
<xsd:complexType name="type">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="原创"> </xsd:enumeration>
<xsd:enumeration value="转载"> </xsd:enumeration>
</xsd:restriction>
</xsd:complexType>
<!-- 这里定义item元素的复杂类型-->
<xsd:complexType name="item">
<xsd:sequence>
<xsd:element name="title" type="xsd:string"> </xsd:element>
<xsd:element name="keyword" type="xsd:string" maxOccurs="unbounded"> </xsd:element>
<xsd:element name="uploader" type="xsd:string"> </xsd:element>
<xsd:element name="type" type="type"> </xsd:element>
<xsd:element name="filename" type="xsd:string"> </xsd:element>
<xsd:element name="date" type="xsd:date"> </xsd:element>
<xsd:element name="size" type="xsd:int"> </xsd:element>
</xsd:sequence>
<xsd:attribute name="category" type="xsd:string" use="required"> </xsd:attribute>
</xsd:complexType>
<!-- 这里定义根元素itemlist-->
<xsd:complexType name="itemlist">
<xsd:sequence>
<xsd:element name="item" type="item" maxOccurs="nobouded"> </xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
验证错误如下:
Document is invalid: no grammar found.
Document root element "xsd:schema", must match DOCTYPE root "null".
另外 我要用这个schema的语法是 <x:itemlist xmlns:x="urn:itemlist"/> 这样的吗?
还有 在xsl里定义个参数,然后用户作出不同的选择就向xsl文件中传递不同的参数 然后就可以动态的有选择的显示xml的内容 这能实现吗?--就是怎样向xsl文件传递参数(dom4j中有这样的功能吗?)
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="itemlist" type="itemlist"> </xsd:element>
<!-- 定义type元素的复杂类型 -->
<xsd:complexType name="type">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="原创"> </xsd:enumeration>
<xsd:enumeration value="转载"> </xsd:enumeration>
</xsd:restriction>
</xsd:complexType>
<!-- 这里定义item元素的复杂类型-->
<xsd:complexType name="item">
<xsd:sequence>
<xsd:element name="title" type="xsd:string"> </xsd:element>
<xsd:element name="keyword" type="xsd:string" maxOccurs="unbounded"> </xsd:element>
<xsd:element name="uploader" type="xsd:string"> </xsd:element>
<xsd:element name="type" type="type"> </xsd:element>
<xsd:element name="filename" type="xsd:string"> </xsd:element>
<xsd:element name="date" type="xsd:date"> </xsd:element>
<xsd:element name="size" type="xsd:int"> </xsd:element>
</xsd:sequence>
<xsd:attribute name="category" type="xsd:string" use="required"> </xsd:attribute>
</xsd:complexType>
<!-- 这里定义根元素itemlist-->
<xsd:complexType name="itemlist">
<xsd:sequence>
<xsd:element name="item" type="item" maxOccurs="nobouded"> </xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
验证错误如下:
Document is invalid: no grammar found.
Document root element "xsd:schema", must match DOCTYPE root "null".
另外 我要用这个schema的语法是 <x:itemlist xmlns:x="urn:itemlist"/> 这样的吗?
还有 在xsl里定义个参数,然后用户作出不同的选择就向xsl文件中传递不同的参数 然后就可以动态的有选择的显示xml的内容 这能实现吗?--就是怎样向xsl文件传递参数(dom4j中有这样的功能吗?)
答!: 1:
顶一下先
答!: 2:
?????????????????????????????????????????
答!: 3:
错误Document is invalid: no grammar found
是说你的命名空间错误,你看看
xmlns:xsd="http://www.w3.org/2001/XMLSchema"有没有写错
标点符号都不能错的
是说你的命名空间错误,你看看
xmlns:xsd="http://www.w3.org/2001/XMLSchema"有没有写错
标点符号都不能错的
答!: 4:
第一个问题就不说 改用dtd了
还有 在xsl里定义个参数,然后用户作出不同的选择就向xsl文件中传递不同的参数 然后就可以动态的有选择的显示xml的内容 这能实现吗?--就是怎样向xsl文件传递参数(dom4j中有这样的功能吗?)
这两个问题呢 ?
还有 在xsl里定义个参数,然后用户作出不同的选择就向xsl文件中传递不同的参数 然后就可以动态的有选择的显示xml的内容 这能实现吗?--就是怎样向xsl文件传递参数(dom4j中有这样的功能吗?)
这两个问题呢 ?
答!: 5:
脚本中使用 msdom组件 能实现向xslt样式表文件 传递参数的功能吗????????????
答!: 6:
天啊 100分就来了俩人 !!!
答!: 7:
两处错误
1,<xsd:complexType name="type">
<xsd:restriction base="xsd:string">
应该是simpleType, complexType下不能包含restriction
2,<xsd:element name="item" type="item" maxOccurs="nobouded">
拼写错误 nobouded -> unbounded
第一个问题,你把你的XML解析器设置好支持XSD了吗?
1,<xsd:complexType name="type">
<xsd:restriction base="xsd:string">
应该是simpleType, complexType下不能包含restriction
2,<xsd:element name="item" type="item" maxOccurs="nobouded">
拼写错误 nobouded -> unbounded
第一个问题,你把你的XML解析器设置好支持XSD了吗?
答!: 8:
xmlns:xsd="http://www.w3.org/2001/XMLSchema"有没有写错
标点符号都不能错的
标点符号都不能错的
答!: 9:
对于xsl来说输入就是xml文件, 根据xml文件的内容的不同,在xsl内进行区分,不行吗?
答!: 10:
你的xml也贴出来看一下
答!: 11:
那些都不说了 脚本中使用 msdom组件 能实现向xslt样式表文件 传递参数的功能吗????????????
答!: 12:
用XmlSpy重新写~
答!: 13:
complexType下不能包含restriction ???
3.2.1.2 Restriction
Restriction is very easy to understand. You simply redefine or omit those elements and attributes that change, and list all the other elements and attributes exactly as they were in the base type. For example, we can create a USAddress type that omits the city and state elements, as shown in Listing 3-23. (If you have a zip code you don't need a city and state, because any zip code can be cross-referenced to a specific city and state.)
Listing 3-23 An Extension of the USAddress Type Defined in Listing 3-21
<complexType name="BriefUSAddress">
<complexContent>
<restriction base="mh:USAddress">
<sequence>
<element name="name" type="string"/>
<element name="street" type="string"/>
<element name="zip" type="string"/>
</sequence>
<attribute name="category" type="string" default="business"/>
</restriction>
</complexContent>
</complexType>
-----------------
J2EE™ Web Services
By Richard Monson-Haefel
Publisher : Addison Wesley
Pub Date : October 24, 2003
ISBN : 0-321-14618-2
Pages : 928
3.2.1.2 Restriction
Restriction is very easy to understand. You simply redefine or omit those elements and attributes that change, and list all the other elements and attributes exactly as they were in the base type. For example, we can create a USAddress type that omits the city and state elements, as shown in Listing 3-23. (If you have a zip code you don't need a city and state, because any zip code can be cross-referenced to a specific city and state.)
Listing 3-23 An Extension of the USAddress Type Defined in Listing 3-21
<complexType name="BriefUSAddress">
<complexContent>
<restriction base="mh:USAddress">
<sequence>
<element name="name" type="string"/>
<element name="street" type="string"/>
<element name="zip" type="string"/>
</sequence>
<attribute name="category" type="string" default="business"/>
</restriction>
</complexContent>
</complexType>
-----------------
J2EE™ Web Services
By Richard Monson-Haefel
Publisher : Addison Wesley
Pub Date : October 24, 2003
ISBN : 0-321-14618-2
Pages : 928
答!: 14:
楼主没有搞清楚complexType 和simpleType的区别,建议看看
XML Schema
Eric van der Vlist
Publisher: O'Reilly
First Edition June 2002 ISBN: 0-596-00252-1, 400 pages
XML Schema
Eric van der Vlist
Publisher: O'Reilly
First Edition June 2002 ISBN: 0-596-00252-1, 400 pages
相关JAVA教程:
Spring中怎么配置Velocity
请问大家我需要买一本或者下载一本什么样的书(有这方面开发经验的朋友给我意见啊)
对象转化成xml
对象转化成xml
初次接触hibernate有些问题不解,急!
学习Java设计模式,大家看了哪些书?怎么学习最快?
再次求求大家了,hibernate问题
问个SWT的问题,希望大家帮忙解决!
各位大大,如何判断客户离开了我的网站...比较棘手
GUI设计中的类型检查
bot.jar包在什么地方可以下载到
javamail:请问怎样获取页面提交的邮件内容的类型即contentType???20分