以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 DTD/XML Schema 』  (http://bbs.xml.org.cn/list.asp?boardid=23)
----  schema错误。--新手提问。  (http://bbs.xml.org.cn/dispbbs.asp?boardid=23&rootid=&id=50961)


--  作者:chengdihan
--  发布时间:8/4/2007 1:57:00 PM

--  schema错误。--新手提问。
用xmlspy编译以下schema的时候出错:personinfo must refer to an existing simple or complex type. 什么原因呢?请指教。

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.tedcheng.com"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
 
 <xs:element name="person" type="personinfo"/>
 
 <xs:complexType  name="personinfo">
   <xs:sequence>
   <xs:element name="lastname" type="xs:string"/>
   <xs:element name="age" type="xs:string"/>
   <xs:element name="dateborn" type="xs:string"/>      
   </xs:sequence>
 </xs:complexType>
 
 </xs:schema>


--  作者:thinktodo
--  发布时间:8/6/2007 2:46:00 PM

--  
可能是与targetNamespace有关吧,不太清楚,关注ing
--  作者:gogy
--  发布时间:8/6/2007 4:36:00 PM

--  
<xs:schema>加一句:
xmlns="http://www.tedcheng.com"


--  作者:thinktodo
--  发布时间:8/7/2007 9:43:00 AM

--  
为什么加
xmlns="http://www.tedcheng.com"
这句话呢?



--  作者:gogy
--  发布时间:8/7/2007 10:52:00 AM

--  
因为有引用。默认名称空间可以解决该问题。
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms