以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 DTD/XML Schema 』  (http://bbs.xml.org.cn/list.asp?boardid=23)
----  关于XML和XSD文件的匹配问题..简单的说...  (http://bbs.xml.org.cn/dispbbs.asp?boardid=23&rootid=&id=11348)


--  作者:Viali
--  发布时间:10/27/2004 10:09:00 PM

--  关于XML和XSD文件的匹配问题..简单的说...
为何说不能匹配???
XML文件内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<po id="50383" submitted="2001-12-06" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="H:\用Java构件Web服务\用Java构件Web服务\webapps\bws\resources\samplePO_ByViali.xsd">
 <!-- This XML File is modified by Viali-->
 <billTo>
  <company>The Skateboard Warehouse</company>
  <street>One Warehouse Park</street>
  <street>Building 17</street>
  <city>Boston</city>
  <state>MA</state>
  <postalCode>01775</postalCode>
 </billTo>
</po>
--------------------------------------------------------------------------------------------------------------------
XSD文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
 <xs:element name="po" type="poType"/>
 <xs:complexType name="poType">
  <xs:sequence>
   <xs:element name="billTo" type="addressType"/>
  </xs:sequence>
  <xs:attribute name="id" type="xs:positiveInteger" use="required"/>
  <xs:attribute name="submitted" type="xs:date" use="required"/>
 </xs:complexType>
 <xs:complexType name="addressType">
  <xs:sequence>
   <xs:element name="company" type="xs:string" minOccurs="0"/>
   <xs:element name="street" type="xs:string" maxOccurs="unbounded"/>
   <xs:element name="city" type="xs:string"/>
   <xs:element name="state" type="xs:string" minOccurs="0"/>
   <xs:element name="postalCode" type="cs:string" minOccurs="0"/>
  </xs:sequence>
 </xs:complexType>
</xs:schema>


--  作者:doubleG
--  发布时间:10/28/2004 1:28:00 PM

--  
>>>>><xs:element name="postalCode" type="cs:string" minOccurs="0"/>
老大,细心些啊,是xs:string不是cs:string啊。一定是CS高手,呵呵。
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
140.991ms