Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello, how can i load multiple xml files with XmlDocument. Other than loading whole code again.

i tried this but it does only load the first xml

VB
doc.Load("http://mysite.com/?rss=1&from=opensearch" & "http://mysite.com/?rss=1&from=opensearch")


this is my code so far, it works.

VB
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click

        Dim doc As New System.Xml.XmlDocument


        doc.Load("http://mysite.com/?rss=1&from=opensearch")


        Dim List = doc.GetElementsByTagName("item")

        For Each items As System.Xml.XmlElement In List

            Dim i As Integer = 0


            With ListView1.Items.Add(items.GetElementsByTagName("title").Item(i).InnerText, 0)
                .SubItems.Add(items.GetElementsByTagName("something1").Item(i).InnerText)
                .SubItems.Add(items.GetElementsByTagName("something2").Item(i).InnerText)

            End With

            i = i + 1



        Next

    End Sub
Posted
Updated 19-Mar-14 11:08am
v2
Comments
Sergey Alexandrovich Kryukov 19-Mar-14 18:51pm    
Why? what would be the sense of it?
—SA
TheGoffy 20-Mar-14 0:11am    
Maybe i explained it badly, im trying to display rss search results, but the results are in multiple pages, like http://mysite.com/?rss=1&from=opensearch and http://mysite.com/2/?rss=1&from=opensearch and so on.
Sergey Alexandrovich Kryukov 20-Mar-14 0:22am    
Are you saying that a single page is invalid XML?
You should understand one simple thing: given a well-formed XML, any part of it (excluding cutting out blank spaces, prolog, etc.) would have to be not well-formed XML, that is, not XML at all. Isn't it obvious? XML is something like that: optional prolog + one single element (root).
—SA

1 solution

XmlDocument does not represent a file, it represents some XML document which can be stored in any stream, not just file. One XML document can be represented by more then one file, but only for storing XML entities in separate files. This is usually used for DOCTYPE, in order to share it by different documents, and, these days, rarely, very rarely used. Normally, one XML document is presented in only one file; and one file does not store more than one document. I don't think your question makes sense. If I missed something, please explain properly.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900