Results 1 to 11 of 11

Thread: display contents of an xml file

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    277

    display contents of an xml file

    anyone know how I can display an xml doc after updating. within a vb app

    cheers
    R

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

    Re: display contents of an xml file

    IE will open ab XML document.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    277

    Re: display contents of an xml file

    could I use something like for example the webbrowser so its within my main app. e.g when the user clicks a cmd button it loads the xml into it?

    cheers
    R

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

    Re: display contents of an xml file

    I've never tried it. Let me know if it works.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    277

    Re: display contents of an xml file

    I managed to do it the easy way lol and just load it in a text box using this code

    VB Code:
    1. Private Sub cmdLoadXML_Click()
    2.     Dim xmlDoc As New DOMDocument
    3.     Dim xmlRootElement As IXMLDOMElement
    4.     Dim xmlError As IXMLDOMParseError
    5.     Dim success As Boolean
    6.  
    7.     xmlDoc.async = False
    8.    
    9.     xmlDoc.validateOnParse = True
    10.     success = xmlDoc.Load("c:/mgamerz/audiolist.xml")
    11.     If success = True Then
    12.         Set xmlRootElement = xmlDoc.documentElement
    13.         txtXML.Text = xmlRootElement.xml
    14.         Set xmlRootElement = Nothing
    15.     Else
    16.         Set xmlError = xmlDoc.parseError
    17.         txtXML.Text = "Error code: " & xmlError.errorCode & vbCrLf _
    18.                    & "Reason: " & xmlError.reason & vbCrLf _
    19.                    & "Source: " & vbCrLf & xmlError.srcText & vbCrLf _
    20.                    & "URL: " & xmlError.url
    21.         Set xmlError = Nothing
    22.     End If
    23. End Sub

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

    Re: display contents of an xml file

    IE formats it nicely. That's why I wondered if the web browser control did.
    Glad you got it working.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    277

    Re: display contents of an xml file

    yeah it isnt to well formatted as it is is it done in a similar way using IE? I wanted it to be in a box within the app can this be done with IE and how hard is it?

    Thanks
    R

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

    Re: display contents of an xml file

    You just put the control on a form, and that's it. I don't have any code handy. I use the web browser, or Inet control.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    277

    Re: display contents of an xml file

    is that a reference or component?

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    277

    Re: display contents of an xml file

    Also would I be able to use the same code but replace the textbox with the webbrowser1?

    thanks
    Rob

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

    Re: display contents of an xml file

    I can't find any code to open it in a form. not sure that it wasn't a web browser

    that's why you should try it to see if it IS the same as IE. open the file with
    file:\\myxml.xml instead of http:\\

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