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

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

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

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

    帮我看看我的DTD错误在哪里并修改它
    外部DTD代码是:
    <!ELEMENT account         (deposit,payment)+>
         <!ELEMENT deposit         (from,amount,date,description?)>
         <!ELEMENT payment         (to,amount,data,description?)>
         <!ELEMENT from            (#PCDATA)>
         <!ELEMENT to              (#PCDATA)>
         <!ELEMENT amount            (#PCDATA)>
         <!ELEMENT date            (#PCDATA)>
         <!ELEMENT description      (#PCDATA)>
          <!ATTLIST account
                        name CDATA #FIXED "Harold Roy"
                        number ID #FIXED "899-24390"
                        bank CDATA #FIXED "Central City Bank"  >
          <!ATTLIST deposit type (direct,cash,transfer,cheque) #REQUIRED>
          <!ATTLIST payment
                      payment (atm,cheque,transfer,withdrawal) #REQUIRED
                      chequeNum ID #IMPLIED
                       >
          <!ATTLIST from category income #REQUIRED>
          <!ATTLIST to category (utilities|entertainment|food|clothing|cash|other) #REQUIRED>
          <!ENTITY employer "Net World">

    XML代码是:

    <?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
    <!DOCTYPE account
    SYSTEM "account.dtd">
        
              
    <account>
       <deposit type="direct">
          <from  category="Income">Net World</from>
          <amount>1240.50</amount>
          <date>24/8/2004</date>
          <description>Paycheque</description>
       </deposit>

       <payment type="cheque" chequeNum="C1210">
          <to category="other">Hank's Hardware</to>
          <amount>29.15</amount>
          <date>24/8/2004</date>
          <description>Drill kit</description>
       </payment>

       <payment type="cheque" chequeNum="C1210">
          <to category="food">Food Mart</to>
          <amount>149.51</amount>
          <date>25/8/2004</date>
          <description>Groceries</description>
       </payment>

       <payment type="cheque" chequeNum="C1212">
          <to category="other">Citgo</to>
          <amount>22.50</amount>
          <date>25/8/2004</date>
          <description>Petrol</description>
       </payment>

       <payment type="cheques" chequeNum="C1213">
          <to category="food">Pizza Now</to>
          <amount>33.24</amount>
          <date>28/8/2004</date>
          <description>Dinner</description>
       </payment>

       <payment type="cheque" chequeNum="C1214">
          <to category="utilities">Central Electric</to>
          <amount>94.85</amount>
          <date>29/8/2004</date>
          <description>Electric Bill</description>
       </payment>

       <payment type="withdrawal">
          <to category="cash">cash</to>
          <amount>200</amount>
          <date>29/8/2004</date>
          <description>ATM withdrawal</description>
       </payment>

       <payment type="cheque" chequeNum="C1215">
          <to category="clothing">Styling</to>
          <amount>172.50</amount>
          <date>30/8/2004</date>
          <description>New pants, shirt</description>
       </payment>

       <payment type="cheque" chequeNum="C1216">
          <to category="FOOD">Food Mart</to>
          <amount>89.11</amount>
          <date>30/8/2004</date>
          <description>Groceries</description>
       </payment>

       <deposit type="transfer">
          <from category="savings">Saving Account</from>
          <amount>300</amount>
          <date>1/9/2004</date>
       </deposit>

       <payment type="cheque" chequeNum="C1217">
          <to category="entertainment">Ticket Source</to>
          <amount>115.95</amount>
          <date>3/9/2004</date>
          <description>Tickets for the Jazz Concert</description>
       </payment>
    </account>


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2006/3/8 23:12:00
     
     平常道 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:4
      积分:76
      门派:XML.ORG.CN
      注册:2005/4/28

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给平常道发送一个短消息 把平常道加入好友 查看平常道的个人资料 搜索平常道在『 DTD/XML Schema 』的所有贴子 引用回复这个贴子 回复这个贴子 查看平常道的博客2
    发贴心情 
    我看了,修改了一下,验证通过
    //DTD
    <?xml version="1.0" encoding="GB2312"?>

    <!ELEMENT account   (deposit,payment+)+>
    <!ELEMENT deposit         (from,amount,date,description?)>
    <!ELEMENT payment         (to,amount,date,description?)>
    <!ELEMENT from            (#PCDATA)>
    <!ELEMENT to              (#PCDATA)>
    <!ELEMENT amount            (#PCDATA)>
    <!ELEMENT date            (#PCDATA)>
    <!ELEMENT description      (#PCDATA)>

    <!--#FIXED "899-24390" -->

    <!ATTLIST account
                        name CDATA #FIXED "Harold Roy"
                        number CDATA #FIXED "899-24390"      
                        bank CDATA #FIXED "Central City Bank"  >

    <!ATTLIST deposit type (direct | cash | transfer | cheque) #REQUIRED>

    <!ATTLIST payment
                      type (atm | cheque | transfer | withdrawal) #REQUIRED
                      chequeNum ID #IMPLIED
                       >
    <!ATTLIST from category (income | savings) #REQUIRED>
    <!ATTLIST to category (utilities|entertainment|food|clothing|cash|other) #REQUIRED>
    <!ENTITY employer "Net World">

    //XML
    <?xml version="1.0" encoding="GB2312" ?>
    <!DOCTYPE account SYSTEM "account.dtd">
              
    <account>
       <deposit type="direct">
          <from  category="income">Net World</from>  
          <amount>1240.50</amount>
          <date>24/8/2004</date>
          <description>Paycheque</description>
       </deposit>

       <payment type="cheque" chequeNum="C1210">
          <to category="other">Hank's Hardware</to>
          <amount>29.15</amount>
          <date>24/8/2004</date>
          <description>Drill kit</description>
       </payment>

       <payment type="cheque" chequeNum="C1211">
          <to category="food">Food Mart</to>
          <amount>149.51</amount>
          <date>25/8/2004</date>
          <description>Groceries</description>
       </payment>

       <payment type="cheque" chequeNum="C1212">
          <to category="other">Citgo</to>
          <amount>22.50</amount>
          <date>25/8/2004</date>
          <description>Petrol</description>
       </payment>

       <payment type="cheque" chequeNum="C1213">
          <to category="food">Pizza Now</to>
          <amount>33.24</amount>
          <date>28/8/2004</date>
          <description>Dinner</description>
       </payment>

       <payment type="cheque" chequeNum="C1214">
          <to category="utilities">Central Electric</to>
          <amount>94.85</amount>
          <date>29/8/2004</date>
          <description>Electric Bill</description>
       </payment>

       <payment type="withdrawal">
          <to category="cash">cash</to>
          <amount>200</amount>
          <date>29/8/2004</date>
          <description>ATM withdrawal</description>
       </payment>

       <payment type="cheque" chequeNum="C1215">
          <to category="clothing">Styling</to>
          <amount>172.50</amount>
          <date>30/8/2004</date>
          <description>New pants, shirt</description>
       </payment>

       <payment type="cheque" chequeNum="C1216">
          <to category="food">Food Mart</to>
          <amount>89.11</amount>
          <date>30/8/2004</date>
          <description>Groceries</description>
       </payment>

       <deposit type="transfer">
          <from category="savings">Saving Account</from>
          <amount>300</amount>
          <date>1/9/2004</date>
       </deposit>

       <payment type="cheque" chequeNum="C1217">
          <to category="entertainment">Ticket Source</to>
          <amount>115.95</amount>
          <date>3/9/2004</date>
          <description>Tickets for the Jazz Concert</description>
       </payment>
    </account>

    你对比的看看,应该和你原来的业务关系一样吧
    我是用xmlspy编辑验证的。
    另外,注意校验文档,里面有好些大小写字符了,或是两处写的不一样而造成的错误。

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

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

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