Results 1 to 10 of 10

Thread: Saving XML from Visual Basic

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2003
    Location
    The Future - Skynet
    Posts
    1,157

    Saving XML from Visual Basic

    Is there a way to format a XML file and make it go into block mode.

    When I save a XML file, the content is in one line. It works but just hard to read.
    I'll Be Back!

    T-1000

    Microsoft .Net 2005
    Microsoft Visual Basic 6
    Prefer using API

  2. #2

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2003
    Location
    The Future - Skynet
    Posts
    1,157

    Re: Saving XML from Visual Basic

    Thanks but I know that already. I actually need to make it look read able when it is saved in XML.
    I'll Be Back!

    T-1000

    Microsoft .Net 2005
    Microsoft Visual Basic 6
    Prefer using API

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Saving XML from Visual Basic

    open it in internet explorer.

  5. #5

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2003
    Location
    The Future - Skynet
    Posts
    1,157

    Re: Saving XML from Visual Basic

    Code:
        Dim objDom As DOMDocument
        Dim objRootElem As IXMLDOMElement
        Set objRootElem = objDom.createElement("Root")
        objDom.appendChild objRootElem
        Set objMemberElem = objDom.createElement("Member")
        objRootElem.appendChild objMemberElem
        Call objDom.save(App.Path & "\Output.xml")
    dglienna, that is what I want but need the actual content of the file like that.
    I'll Be Back!

    T-1000

    Microsoft .Net 2005
    Microsoft Visual Basic 6
    Prefer using API

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Saving XML from Visual Basic

    I have this to read the file...

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4. GetHTML
    5. MsgBox GetHTML
    6. End Sub
    7.  
    8. Private Function GetHTML() As String
    9.     Dim html As IXMLHTTPRequest
    10.     Set html = CreateObject("Microsoft.XMLHTTP")
    11.     With html
    12.         .Open "GET", "http://www.vbforums.com/", False
    13.         .send
    14.         GetHTML = .responseText
    15.     End With
    16.     Set html = Nothing
    17. End Function

  8. #8
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Saving XML from Visual Basic

    I don't get it. Here is an xml file that I have that is the output of a component checker. It is readable in Notepad, as I have here, as well as showing up color coded in IE.

    <cc>
    <releases>
    <release name="MDAC 2.1 SP2"/>
    <release name="MDAC 2.5"/>
    <release name="MDAC 2.5 SP1"/>
    <release name="MDAC 2.5 SP2"/>
    <release name="MDAC 2.5 SP3" />
    <release name="MDAC 2.6 RTM" />
    <release name="MDAC 2.6 SP1" />
    <release name="MDAC 2.6 SP2" />
    <release name="MDAC 2.6 SP2 Refresh" />
    <release name="MDAC 2.7 RTM" />
    <release name="MDAC 2.7 Refresh" />
    <release name="MDAC 2.7 SP1" />
    <release name="MDAC 2.7 SP1 Refresh" />
    <release name="MDAC 2.8 RTM" />
    <release name="MDAC 2.7 SP1 on Windows XP SP1" />
    </releases>
    </cc>

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2003
    Location
    The Future - Skynet
    Posts
    1,157

    Re: Saving XML from Visual Basic

    Quote Originally Posted by dglienna
    I have this to read the file...

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4. GetHTML
    5. MsgBox GetHTML
    6. End Sub
    7.  
    8. Private Function GetHTML() As String
    9.     Dim html As IXMLHTTPRequest
    10.     Set html = CreateObject("Microsoft.XMLHTTP")
    11.     With html
    12.         .Open "GET", "http://www.vbforums.com/", False
    13.         .send
    14.         GetHTML = .responseText
    15.     End With
    16.     Set html = Nothing
    17. End Function
    This is exactly what I want but can it goes against a XML file? It pretty the XML or put it in well-formed. I tried it against a file but it failed at the send command.
    I'll Be Back!

    T-1000

    Microsoft .Net 2005
    Microsoft Visual Basic 6
    Prefer using API

  10. #10

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2003
    Location
    The Future - Skynet
    Posts
    1,157

    Re: Saving XML from Visual Basic

    You know, I found a way to do this but it has to be done in .Net. Still want to know if it is possible to do it in VB6?
    I'll Be Back!

    T-1000

    Microsoft .Net 2005
    Microsoft Visual Basic 6
    Prefer using API

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width