新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   >>中国XML论坛<<     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> DTD, XML Schema(XMLS), RELAX NG
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 DTD/XML Schema 』 → [求助] 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 8932 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: [求助] 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     jianghaha 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:0
      积分:52
      门派:XML.ORG.CN
      注册:2005/8/31

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jianghaha发送一个短消息 把jianghaha加入好友 查看jianghaha的个人资料 搜索jianghaha在『 DTD/XML Schema 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jianghaha的博客楼主
    发贴心情 [求助]

    以下是我的程序代码:
    *******************************************************
    procedure TForm1.Button5Click(Sender: TObject);
    var
      xmlobj:TDOMDocument40;
      xmlsch:TXMLSchemaCache40;
      namespace,xsdname,xmlname:string;
    begin
        namespace:='urn:records';
        xsdname:='XLQ.xsd';
        xmlname:='XLQ.xml';
        xmlobj := TDOMDocument40.Create(nil);
        xmlsch := TXMLSchemaCache40.Create(nil);
        xmlsch.DefaultInterface.add(namespace,xsdname);
        xmlobj.DefaultInterface.schemas := xmlsch.DefaultInterface;
        xmlobj.DefaultInterface.async := False;
        xmlobj.DefaultInterface.validateOnParse := True;
        xmlobj.DefaultInterface.resolveExternals:=True;
        xmlobj.DefaultInterface.load(xmlname);
        if xmlobj.DefaultInterface.parseError.errorCode = 0 then
          showmessage('格式正确')
        else begin
          showmessage('格式错误');
          showmessage(xmlobj.DefaultInterface.parseError.reason
          +xmlobj.DefaultInterface.parseError.srcText
          +'  line:'+IntToStr(xmlobj.DefaultInterface.parseError.line)
          +'  char:'+IntToStr(xmlobj.DefaultInterface.parseError.linepos));
        end;
    end;

    *******************************************************
    我在程序运行后出现以下错误:
    “sstzclass”/union/ undeclared XSD type:'noneclass'
    *******************************************************
    我分析是我定义的xsd文件中的联合类型出现问题,但是我仔细检查我的xsd文件,对照
    MSXML4.0的文档,我始终无法找到问题所在.请各位高手多多指点。如果可能的话,给我一个使用了union类型定义的xsd文件的示例。谢谢。
    我的xsd的内容是:
    ******************************************************
    <?xml version="1.0" encoding="GB2312"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <xsd:element name="records" type="recordlist"/>

    <!-- Defines the complex type for the "recording" element.-->
    <xsd:complexType name="onerecord">
      <xsd:attribute name="zymc" type="string1to20" use="required"/>
      <xsd:attribute name="flbsm" type="long10" use="required"/>
      <xsd:attribute name="ssbddw" type="long15" use="required"/>
      <xsd:attribute name="sstz" type="sstzclass" use="required"/>
      <xsd:attribute name="sswx" type="sswxclass" use="required"/>
      <xsd:attribute name="zybh" type="long1to15" use="required"/>
      <xsd:attribute name="xlqlx" type="xlqclass" use="required"/>
      <xsd:attribute name="xlqbh" type="long1to15" use="required"/>
    </xsd:complexType>

    <!-- Defines the root element for the XML file.-->
    <xsd:complexType name="recordlist">
      <xsd:sequence>
        <xsd:element name="record" type="onerecord" minOccurs="1" maxOccurs="unbounded"/>
      </xsd:sequence>
    </xsd:complexType>

    <!--定义所属台站类型-->
    <xsd:simpleType name="sstzclass">
      <xsd:union memberTypes="noneclass long15"/>
    </xsd:simpleType>

    <!--定义所属网系类型-->
    <xsd:simpleType name="sswxclass">
      <xsd:union memberTypes="noneclass long1to10"/>
    </xsd:simpleType>

    <!--定义信令区类型-->
    <xsd:simpleType name="xlqclass">
      <xsd:restriction base="xsd:string">
        <xsd:enumeration value="主信令区"/>
        <xsd:enumeration value="分信令区"/>
      </xsd:restriction>
    </xsd:simpleType>

    <!--定义长度小于20的字符串类型-->
    <xsd:simpleType name="string1to20">
      <xsd:restriction base="xsd:string">
        <xsd:minLength value="1"/>
        <xsd:maxLength value="20"/>
      </xsd:restriction>
    </xsd:simpleType>

    <!--定义长度为10的整数类型-->
    <xsd:simpleType name="long10">
      <xsd:restriction base="xsd:unsigneLong">
        <xsd:minInclusive value="1000000000"/>
        <xsd:maxInclusive value="9999999999"/>
      </xsd:restriction>
    </xsd:simpleType>

    <!--定义长度为15的整数类型-->
    <xsd:simpleType name="long15">
      <xsd:restriction base="xsd:unsigneLong">
        <xsd:minInclusive value="100000000000000"/>
        <xsd:maxInclusive value="999999999999999"/>
      </xsd:restriction>
    </xsd:simpleType>

    <!--定义长度小于10的整数类型-->
    <xsd:simpleType name="long1to10">
      <xsd:restriction base="xsd:unsigneLong">
        <xsd:minInclusive value="1"/>
        <xsd:maxInclusive value="9999999999"/>
      </xsd:restriction>
    </xsd:simpleType>

    <!--定义长度小于15的整数类型-->
    <xsd:simpleType name="long1to15">
      <xsd:restriction base="xsd:unsigneLong">
        <xsd:minInclusive value="1"/>
        <xsd:maxInclusive value="999999999999999"/>
      </xsd:restriction>
    </xsd:simpleType>

    <!--定义none类型-->
    <xsd:simpleType name="noneclass">
      <xsd:restriction base="xsd:string">
        <xsd:enumeration value="none"/>
      </xsd:restriction>
    </xsd:simpleType>

    </xsd:schema>
    ************************************************************


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/8/31 21:29:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 DTD/XML Schema 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/5/3 19:11:44

    本主题贴数1,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    1,968.750ms