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

    >> 关于 XML 的一般性技术讨论,提供 XML入门资料 和 XML教程
    [返回] 计算机科学论坛XML.ORG.CN讨论区 - XML技术『 XML基础 』 → 如何使用一个XSD文件生成一个空XML文件? 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 1781 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: 如何使用一个XSD文件生成一个空XML文件? 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     nmgyao 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:2
      积分:82
      门派:XML.ORG.CN
      注册:2004/3/26

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给nmgyao发送一个短消息 把nmgyao加入好友 查看nmgyao的个人资料 搜索nmgyao在『 XML基础 』的所有贴子 引用回复这个贴子 回复这个贴子 查看nmgyao的博客楼主
    发贴心情 如何使用一个XSD文件生成一个空XML文件?

    如何使用一个XSD文件生成一个空XML文件?

    在XMLSPY中可以将一个XSD文件存为一个空的XML文件,要想实现这个功能该如何?


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2004/3/30 21:34:00
     
     xhaopuj 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:11
      积分:89
      门派:XML.ORG.CN
      注册:2004/4/6

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给xhaopuj发送一个短消息 把xhaopuj加入好友 查看xhaopuj的个人资料 搜索xhaopuj在『 XML基础 』的所有贴子 引用回复这个贴子 回复这个贴子 查看xhaopuj的博客2
    发贴心情 
    我是在别处看到的转过是:

    Q. Can I createe xml document by using DTD or XML Schema?
    A: See here.
    The answer is yes or no. XML spy or anyone else can make an example from xml schema or dtd easily. I also made 4 examples from my trivial DTD on my FAQ here.
    This does not mean you can generate XML deterministically from xml schema or dtd. If you make your algorithm a lot more complicated by using (direct) graph theory, you even can decide the root element. However, it is still non-deterministic.

    That is the nature of the problem, nobody can make it deterministic, unless you define your schema in a strict deterministic way, and you restrict your root element, and ... In that case, your xml schema becomes useless and nothing, but a more complicated way to describe your xml. Then why we need the XML schema?


      Q. Can I used a arbitrary defined DTD to generate all possible XML templates?
    A: See original discussion here.
    The answer is NO unless it is an extreme trivial case. See the really trivial DTD bellow. We already have 4 possible "templates". Here we assume templates is the right word here.  I use one line for each XML file for easy listing. For a little less trivial DTD, it is easy to imagine that all the combination and permutation will cause an exponential explosion. I do not think you want the result, let alone having the space to store the result or writing an application to use that result.
    Trivial DTD file
    <!ELEMENT person (name,age,sex)>    
    <!ELEMENT name (#PCDATA)>    
    <!ELEMENT age (#PCDATA)>    
    <!ELEMENT sex (#PCDATA)>
    Four possible XML "templates"
    <name>some_name</name>
    <age>some_number</age>
    <sex>one_of_the_two</sex>
    <person><name>some_name</name><age>some_number</age><sex>one_of_the_two</sex></person>

    If you do not believe all four are valid against the DTD, try to validate them by yourself . Here is a related discussion on XML Schema, take a look!

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2004/4/27 8:16:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 XML基础 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2025/6/23 13:18:41

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

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