以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 DTD/XML Schema 』 (http://bbs.xml.org.cn/list.asp?boardid=23) ---- [求助]问一个跟命名空间有关的问题 (http://bbs.xml.org.cn/dispbbs.asp?boardid=23&rootid=&id=38308) |
-- 作者:musclepei -- 发布时间:9/26/2006 3:18:00 PM -- [求助]问一个跟命名空间有关的问题 请问各位高手我的XML Schema文件是这样描述的: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <xsd:complexType name="tvguide"> <xsd:sequence> <xsd:element name="program" type="Show" minOccurs="0" maxOccurs="unbounded"/> <xsd:element name="slot" type="TVSlot" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="Show"> <xsd:sequence> <xsd:element name="name" type="xsd:string"/> <xsd:element name="description" type="xsd:string"/> </xsd:sequence> <xsd:attribute name="show-id" type="xsd:ID"/> <xsd:attribute name="first-aired" type="xsd:date"/> </xsd:complexType> <xsd:complexType name="TVSlot"> <xsd:sequence> <xsd:element name="day" type="xsd:date"/> <xsd:element name="begin" type="xsd:time"/> <xsd:element name="end" type="xsd:time"/> </xsd:sequence> <xsd:attribute name="show" type="xsd:IDREF"/> </xsd:complexType> <xsd:element name="guide" type="tvguide"/> </xsd:schema> 在我写对应的XML文件的时候写成这种形式时 把program改成了dd照样能运行,但这样肯定是错的 这样就正确,请问这是怎么回事? |
-- 作者:gemingke -- 发布时间:9/26/2006 7:21:00 PM -- 你的前两个都没有指定Schema的位置。看起来好像加了namespace,其实没用。最后一个文档才真正指出了Schema的位置。 而且,你的schema文档并没有声明任何namespace,所以,最后一个文档在指定schema位置时,只能使用 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="......" 这样的语句(最后一个文档是对的)。 |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
5,953.125ms |