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

    >> Oracle, SQL Server与XML,XML在数据挖掘中的应用, PMML.
    [返回] 计算机科学论坛XML.ORG.CN讨论区 - 高级XML应用『 XML 与 数据库 』 → [求助]如何方断数据空时怎么写进xml 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 4651 个阅读者  浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: [求助]如何方断数据空时怎么写进xml 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     yuhuan 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:3
      积分:71
      门派:XML.ORG.CN
      注册:2006/5/30

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给yuhuan发送一个短消息 把yuhuan加入好友 查看yuhuan的个人资料 搜索yuhuan在『 XML 与 数据库 』的所有贴子 引用回复这个贴子 回复这个贴子 查看yuhuan的博客楼主
    发贴心情 [求助]如何方断数据空时怎么写进xml

    这个是生成xml的代码

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>xml</title>
    </head>
    <body>
    <%
    Sql = "select top 20 * from sample order by id desc"
    set rs=server.createobject("adodb.recordset")
    rs.open sql,conn,1,3
    Set facXmlDocument = Server.CreateObject("Msxml2.DOMDocument")
    facXmlDocument.Load Server.MapPath("data.xml")
    facXmlDocument.LoadXML("<data />")
    do While Not Rs.EOF
    Set Node = facXmlDocument.createElement("products")
     Node.setAttribute "id", int(Rs("id"))
     Node.setAttribute "time", Rs("time")
     Node.setAttribute "RootID", Rs("RootID")
     Node.setAttribute "SortID", Rs("SortID")
     Node.setAttribute "upload", Rs("upload")
     Node.setAttribute "download", Rs("download")
     Node.setAttribute "datetime", Rs("datetime")
     Node.setAttribute "csnumber", Rs("csnumber")
     Node.setAttribute "ypnumber", Rs("ypnumber")
     if Rs("barmark")="" then
     Node.setAttribute "barmark", ""
     else
     Node.setAttribute "barmark", Rs("barmark")
     end if
     Node.setAttribute "chname", Rs("chname")
     if Rs("engname")="" then
     Node.setAttribute "engname", ""
     else
     Node.setAttribute "engname", Rs("engname")
     end if
     Node.setAttribute "classnum", Rs("classnum")
     if Rs("bigclass")="" then
     Node.setAttribute "bigclass", ""
     else
     Node.setAttribute "bigclass", Rs("bigclass")
     end if
     if Rs("classname")="" then
     Node.setAttribute "classname", ""
     else
     Node.setAttribute "classname", Rs("classname")
     end if
     Node.setAttribute "casingmode", Rs("casingmode")
     if Rs("package")="" then
     Node.setAttribute "package", ""
     else
     Node.setAttribute "package", Rs("package")
     end if
     if Rs("engunit")="" then
     Node.setAttribute "engunit", ""
     else
     Node.setAttribute "engunit", Rs("engunit")
     end if
     if Rs("unitname")="" then
     Node.setAttribute "unitname", ""
     else
     Node.setAttribute "unitname", Rs("unitname")
     end if
     Node.setAttribute "yplong", Rs("yplong")
     Node.setAttribute "ypwidth", Rs("ypwidth")
     Node.setAttribute "yphigh", Rs("yphigh")
     if Rs("remarks")="" then
     Node.setAttribute "remarks", ""
     else
     Node.setAttribute "remarks", Rs("remarks")
     end if
     Node.setAttribute "casinglong", Rs("casinglong")
     Node.setAttribute "casingwidth", Rs("casingwidth")
     Node.setAttribute "casinghigh", Rs("casinghigh")
     if Rs("cubage")="" then
     Node.setAttribute "cubage", ""
     else
     Node.setAttribute "cubage", Rs("cubage")
     end if
     Node.setAttribute "datum", Rs("datum")
     Node.setAttribute "wxidate", Rs("wxidate")
     Node.setAttribute "wxamount", Rs("wxamount")
     Node.setAttribute "wxlh", Rs("wxlh")
     Node.setAttribute "wxds", Rs("wxds")
     Node.setAttribute "wxmz", Rs("wxmz")
     Node.setAttribute "wxjz", Rs("wxjz")
     Node.setAttribute "wxndate", Rs("wxndate")
     Node.setAttribute "wxdj", Rs("wxdj")
     Node.setAttribute "wxsj", Rs("wxsj")
     Node.setAttribute "wxlow", Rs("wxlow")
     Node.setAttribute "wxconvert", Rs("wxconvert")
     if Rs("nxamount")="" then
     Node.setAttribute "nxamount", ""
     else
     Node.setAttribute "nxamount", Rs("nxamount")
     end if
     if Rs("nxmxsl")="" then
     Node.setAttribute "nxmxsl", ""
     else
     Node.setAttribute "nxmxsl", Rs("nxmxsl")
     end if
     if Rs("nxlhsl")="" then
     Node.setAttribute "nxlhsl", ""
     else
     Node.setAttribute "nxlhsl", Rs("nxlhsl")
     end if
     if Rs("flash")="" then
     Node.setAttribute "flash", ""
     else
     Node.setAttribute "flash", Rs("flash")
     end if
     Node.setAttribute "smallimg", Rs("smallimg")
     Node.setAttribute "bigimage", Rs("bigimage")
     if Rs("nxcj")="" then
     Node.setAttribute "nxcj", ""
        else
     Node.setAttribute "nxcj", Rs("nxcj")
     end if
     if Rs("nxdj")="" then
     Node.setAttribute "nxdj", ""
     else
     Node.setAttribute "nxdj", Rs("nxdj")
     end if
     if Rs("nxsj")="" then
     Node.setAttribute "nxsj", ""
     else
     Node.setAttribute "nxsj", Rs("nxsj")
     end if
     if Rs("nxlow")="" then
     Node.setAttribute "nxlow", ""
     else
     Node.setAttribute "nxlow", Rs("nxlow")
     end if
     if Rs("nxidate")="" then
     Node.setAttribute "nxidate", ""
     else
     Node.setAttribute "nxidate", Rs("nxidate")
     end if
     if Rs("nxndate")="" then
     Node.setAttribute "nxndate", ""
     else
     Node.setAttribute "nxndate", Rs("nxndate")
     end if
     if Rs("discount")="" then
     Node.setAttribute "discount", ""
     else
     Node.setAttribute "discount", Rs("discount")
     end if
     if Rs("frequency")="" then
     Node.setAttribute "frequency", ""
     else
     Node.setAttribute "frequency", Rs("frequency")
     end if
     facXmlDocument.documentElement.appendChild(Node)
    Rs.MoveNext
    loop
    Rs.Close
    set Rs = nothing
    conn.close
    set conn=nothing
    facXmlDocument.Save server.MapPath("data.xml")
    set facXmlDocument=nothing
    %>
    </body>

    </html>

    生成的xml是这样

    - <data>
      <products id="83445" time="59078" RootID="00001" SortID="00002" upload="0" download="0" csnumber="01286" ypnumber="BT89642" barmark="" chname="电动童车" engname="" classnum="0101" casingmode="彩盒" package="PRINTED BOX" engunit="PC" unitname="只" yplong="0" ypwidth="0" yphigh="0" remarks="" casinglong="90" casingwidth="50" casinghigh="57" cubage="0.257" datum="9.077" wxidate="2006-07-31" wxamount="1" wxlh="0" wxds="0" wxmz="14.7" wxjz="12" wxndate="2006-07-31" wxdj="0" wxsj="0" wxlow="0" wxconvert="0" smallimg="Loadimg/BT89000/BT89642.jpg" bigimage="Loadimg/BT89000/BT89642.jpg" />
    <products id="5363" time="63670" RootID="00071" SortID="00077" upload="0" download="0" datetime="2004-07-13 14:12:22" csnumber="01309" ypnumber="BT00001" barmark="" chname="玩具枪(银)" engname="" classnum="1199" classname="其它枪类" casingmode="OPP袋" package="OPP Bag" engunit="PC" unitname="只" yplong="16" ypwidth="11.5" yphigh="3" remarks="" casinglong="62.5" casingwidth="30.5" casinghigh="45" cubage="0.08578125" datum="3.02979375" wxidate="2004-07-13" wxamount="180" wxlh="0" wxds="15" wxmz="23" wxjz="21" wxndate="2004-07-13" wxdj="0" wxsj="0" wxlow="0" wxconvert="0" nxamount="0" nxmxsl="0" nxlhsl="0" smallimg="Loadimg/BT00000/BT00001.jpg" bigimage="Loadimg/BT00000/BT00001.jpg" nxcj="0" nxdj="0" nxsj="0" nxlow="0" nxidate="2004-07-13" nxndate="2004-07-13" discount="0" />
    </data>


    生成的xml中  怎么
    nxcj="0" nxdj="0" nxsj="0" nxlow="0" nxidate="2004-07-13" nxndate="2004-07-13" discount="0"

    这段数据有的有显示有的不可以显示

    是不是没判断是不是为null数据的结果~~


       收藏   分享  
    顶(0)
      




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

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

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