最近开始需要用的XML,希望得到一些信息,谢谢大家!www.3EXWare.com

解决方案 »

  1.   

    引用Microsoft XML.vX.0对象库
      

  2.   

    虾米意思,用API去写???xml你可以当做一个文本,同时也是一棵树Private oElement As IXMLDOMElement
    Private oNode As IXMLDOMNode定义一个数据集合
     Set oElement = oDoc.selectSingleNode("root/Items")
        Dim cc As Integer
        cc = 0
        For Each oNode In oElement.childNodes
            rsSourse.AddNew
            For i = 1 To 13
                rsSourse("col" & i) = oNode.Attributes.getNamedItem("value" & i).Text
            Next
            rsSourse.Update
            cc = cc + 1
        Next直接去读进oDoc.selectSingleNode
    Set oDoc = New DOMDocument
        oDoc.async = False
        oDoc.Load sXML  '暂时注释    Set oElement = oDoc.documentElement
        oElement.selectNodes ("root")    prtBill.Caption = oDoc.selectSingleNode("root/Title/@value").Text
        With prtBill.Sections(2).Controls
            .Item("lblTitle").Caption = oDoc.selectSingleNode("root/Title/@value").Text去MSDN上找些参考资料,一时间是说不清楚的
      

  3.   

    http://search.csdn.net/Expert/topic/1976/1976931.xml?temp=.2910578
    http://search.csdn.net/Expert/topic/2191/2191642.xml?temp=.2992975
      

  4.   

    XML其实就是自定义标记格式的纯文本文件,标记放在<>里面
    自己做读写的函数也很方便的,无非是分析字符串~
      

  5.   

    引用DOM解析器,那是专门的操作XML专门的解析器。工程--------》引用------------MSXML3.0或是4.0或5.0,看你装的什么样的VB
      

  6.   

    这么好的例子,应该给点分吧,我初次到这里混!帮帮忙了  
    Public Sub LoadDocument()
       
      Dim xDoc As MSXML.DOMDocument
       
      Set xDoc = New MSXML.DOMDocument
       
      xDoc.validateOnParse = False
       
      If xDoc.Load(App.Path & "\" & Employee.xml) Then
       
      ' The document loaded successfully.
       
      ' Now do something intersting.
       
      DisplayNode xDoc.childNodes, 0
       
      Else
       
      ' The document failed to load.
       
      ' See the previous listing for error information.
       
      End If
       
      End Sub
       
      Public Sub DisplayNode(ByRef Nodes As MSXML.IXMLDOMNodeList, ByVal Indent As Integer)
       
      Dim xNode As MSXML.IXMLDOMNode
       
      Indent = Indent + 2
        
      For Each xNode In Nodes
       
      If xNode.nodeType = NODE_TEXT Then
            Debug.Print Space$(Indent) & xNode.parentNode.nodeName & ":" & xNode.nodeValue
      End If
       
      If xNode.hasChildNodes Then
            DisplayNode xNode.childNodes, Indent
      End If
       
      Next xNode
       
      End Sub
      

  7.   

    MSXML解析器怎么用?
    用VB一行行分析速度很慢呀而且容易疏漏
      

  8.   

    谢谢,谈谈大家的经验和看法吧。如果能够的话给几个案例[email protected]
    我会尽快结帖的。
      

  9.   

    生成的时候用生成文本的方法,分析的时候用dom,我写的跟你要的有一点点出入,我把一部分html带进来了,*^_^*class xmldom
    dim thexmldom
    Private Sub Class_Initialize
    set thexmldom=createobject("Microsoft.XMLDOM")
    end subpublic function openxml(thefile)
       thexmldom.async=false
       thexmldom.load thefile
    end functionpublic function itemlen(tag)
      set itemthing=thexmldom.getElementsByTagName(tag)
      itemlen=itemthing.length
    end functionpublic function additemblogm(blogtitle,blogcontent,thelink,thefile)
       set addroot=thexmldom.createElement("blog")
       set root=thexmldom.documentElement
       set currnode = root.insertBefore(addroot, root.childNodes(0))
       currnode.setAttribute "date",date
       currnode.setAttribute "time",time
       set blogtitleadd=thexmldom.createElement("blogtitle")
       set blogtitled=currnode.appendchild(blogtitleadd)
       blogtitled.text=blogtitle
       set blogcontentadd=thexmldom.createElement("blogcontent")
       set blogcontentd=currnode.appendchild(blogcontentadd)
       blogcontentd.text=blogcontent
       set bloglinkadd=thexmldom.createElement("link")
       set bloglinkd=currnode.appendchild(bloglinkadd)
       bloglinkd.text=thelink
       set blogcommentadd=thexmldom.createElement("comment")
       currnode.appendchild blogcommentadd
       thexmldom.save thefile
    end functionpublic function addrecentxml(blogtitle,blogcontent,thelink,thefile,blogshownum)
    set root=thexmldom.documentElement
    set addroot=thexmldom.createElement("blog")
    if root.childNodes.length=0 then
        set currnode=root.appendchild(addroot)
    else
        set currnode = root.insertBefore(addroot, root.childNodes(0))
    end if
    if root.childNodes.length=blogshownum then
        root.removeChild root.lastchild
    end if
     currnode.setAttribute "date",date
       currnode.setAttribute "time",time
       set blogtitleadd=thexmldom.createElement("blogtitle")
       set blogtitled=currnode.appendchild(blogtitleadd)
       blogtitled.text=blogtitle
       set blogcontentadd=thexmldom.createElement("blogcontent")
       set blogcontentd=currnode.appendchild(blogcontentadd)
       blogcontentd.text=blogcontent
       set bloglinkadd=thexmldom.createElement("link")
       set bloglinkd=currnode.appendchild(bloglinkadd)
       bloglinkd.text=thelink
       set blogcommentadd=thexmldom.createElement("comment")
       currnode.appendchild blogcommentadd
       thexmldom.save thefile
    end functionfunction showblogxml()
    set blogroot=thexmldom.getElementsByTagName("blog")
    bloglen=blogroot.length
    for i=0 to bloglen-1       
       if i=0 then
           str="<table><tr><td>" 
               thedate= blogroot.item(i).getAttribute("date")
       str=str & thedate & "</td></tr>"
          else
          thedate1=blogroot.item(i).getAttribute("date")
      if thedate<>thedate1 then
          thedate=thedate1
      str=str & thedate & "</td></tr>"
      end if
      end if
      str=str & "<tr><td>" & blogroot.item(i).childNodes(0).text & "<br />" & blogroot.item(i).childNodes(1).text & "</td></tr>"
      str=str & "<tr><td><a href='" & blogroot.item(i).childNodes(2).text & "'>链接地址</a></td></tr>"
    next
    if bloglen<>0 then
       str=str & "</table>"
    end if
    showblogxml=str
    end functionfunction ebloginfo(blogtitle,thelink)
    set blogroot=thexmldom.getElementsByTagName("blogall")
    set currnode=thexmldom.createElement("blog")
    bloglen=blogroot.childNodes.length
    if bloglen=0 then
         set blogcur=blogroot.appendchild(currnode)
    else
         set blogcur=blogroot.insertBefore(currnode, blogroot.firstchild)
    end if
     blogcur.setAttribute "link",thelink
     blogcur.setAttribute "title",blogtitle
     blogcur.setAttribute "date",date
     blogcur.setAttribute "time",time
     end functionPrivate Sub Class_Terminate
      set thexmldom=nothing
     End Subend class
      

  10.   

    liuxiaoyi666(兔子)好像挺可爱的 *^_^*我是下载后转成 char[]
    有兴趣单聊:QQ 419451334
    ////////////////////////////////////////
    我是一只菜菜菜菜鸟,想要飞啊飞啊飞,却时常都会往下掉。到现在 毫无所成,却碰了好多的包包,我的技术算不算 太糟?0.1985年出生于医院。1.无不良嗜好。
    2.面向金钱编程。
    3.欺负你,就是欺负你!
      

  11.   

    谢谢,谈谈大家的经验和看法吧。如果能够的话给几个案例[email protected]
    我会尽快结帖的。
      

  12.   

    就是dom啦你希望得到什么??关于xml和数据库的比较么??在我的blog上有写http://blog.csdn.net/liuxiaoyi666 靠,csdn的blog又不能访问了,NND,难道.text模板的效率这么差么??
      

  13.   

    csdn的blog这一阵时好时坏,我会尽快结帖等我先试试看
      

  14.   

    http://www.yesky.com/20021016/1635180.shtml
      

  15.   

    无废话xml我已经有了正在学习中,有问题继续问所以还要几天才能结帖。期中考试前应该能结了
      

  16.   

    请问:viena(维也纳nn-实心木头人)
    你提供的以下地址里的例子特别好,但里面的XML文档(' flight.xml为描述航班信息的XML文档 )在哪儿找得到?谢谢 
       http://search.csdn.net/Expert/topic/1976/1976931.xml?temp=.2910578