我用DELPHI的TXMLDocument组件   把组件的FILENAME指定为HELLO.XML文件然后把ACTIVE:=TRUE  这个时候它可以检验XML的语法, 我通过看SCHEMAREF也看到了 GSSM.XSD但我把PARSEOPTION都指定为TRUE的时候它好象没有检验 HELLO.XML是否符合SCHEMA文件  GSSM.XSD约束当把SCHEMA文件 GSSM.XSD 进行修改的时候.它依然不报错误.我是把HELLO.XML和GSSM.XSD放在一个路径下的请高手指点

解决方案 »

  1.   

    上面忘记了把两个文件写出来 不好意思HELLO.XML<?xml version="1.0" encoding="UTF-8"?>
    <会计核算软件数据 xmlns:gssm="http://schemas.accounting.org.cn/2004/datainterface/gssm" xmlns:user="http://schemas.accounting.org.cn/2004/datainterface/user" xmlns="http://schemas.accounting.org.cn/2004/datainterface/gssm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="gssm.xsd" gssm:locID="t000">
    <电子账簿 gssm:locID="t001">
    <电子账簿编号 gssm:locID="001">1</电子账簿编号>
    <电子帐簿名称 gssm:locID="002">演示账簿</电子帐簿名称>
    <会计核算单位 gssm:locID="003">某公司</会计核算单位>
    <组织机构代码 gssm:locID="004">12353687521</组织机构代码>
    <单位性质 gssm:locID="005">企业单位</单位性质>
    <行业 gssm:locID="006">纺织业</行业>
    <开发单位 gssm:locID="007">某软件公司</开发单位>
    <版本号 gssm:locID="008">V2.0</版本号>
    <会计年度 gssm:locID="009">2004</会计年度>
    <本位币 gssm:locID="010">人民币</本位币>
    <科目结构 gssm:locID="011">4,2,2</科目结构>
    </电子账簿>
    <会计核算软件数据>
    GSSM.XSD文件<?xml version="1.0" encoding="UTF-8"?>
    <!-- edited with XMLSPY v5 rel. 3 U (http://www.xmlspy.com) by et8 (et8) -->
    <xs:schema targetNamespace="http://schemas.accounting.org.cn/2004/datainterface/gssm" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.accounting.org.cn/2004/datainterface/gssm" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:annotation>
    <xs:documentation>表编号截至“t018”</xs:documentation>
    </xs:annotation>
    <xs:attribute name="locID" type="xs:string">
    <xs:annotation>
    <xs:documentation>数据标识符</xs:documentation>
    </xs:annotation>
    </xs:attribute>
    <xs:simpleType name="电子账簿编号类型">
    <xs:restriction base="xs:string">
    <xs:maxLength value="5"/>
    </xs:restriction>
    </xs:simpleType>