<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.stagevu"
       name="StageVU"
       version="1.3.6"
       provider-name="AJ">
  <requires>
    <import addon="xbmc.python" version="1.0"/>
  </requires>
  <extension point="xbmc.python.pluginsource"
            library="default.py">
        <provides>video</provides>
  </extension>
  <extension point="xbmc.addon.metadata">
    <summary>stagevu: Watch video</summary>
    <description>Watch what you have been searching on internet.</description>
    <disclaimer>The video add-ons hosted by my XBMC add-ons repository(aj add-ons) makes no warranties, expressed or implied, and hereby disclaims and negates all other warranties, including without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights. Further, video add-ons don't warrant or make any representations concerning the accuracy, likely results, or reliability of the use of the materials on the Internet web site where from data is retrieved or otherwise relating to such materials or on any sites linked to this addon. Videos are streamed directly from video-hosting websites that are having full rights to remove such access to video if required.</disclaimer>
	<platform>all</platform>
  </extension>
</addon>

using streamreader or whatever, don't really care, but I need to be able to load

<addon id="plugin.video.stagevu"
name="StageVU"
version="1.3.6"
provider-name="AJ">

and later down
<summary>stagevu: Watch video</summary>
<description>Watch what you have been searching on internet.</description>

into say a label.text to use elsewhere.
So I end with something like
Dim xID as String = id
Dim xName as String = name
Dim xVersion as String = version
Dim xPName as String = provider-name
Dim xSum as String = summary
Dim xDesc as String = description

Label26.Text = xid & "," & xName & "," & xVersion & "," & xPName & "," & xSum & "," & xDesc

don't need any extra just those. Please help and use little words and code examples :)

Recommended Answers

All 2 Replies

I've made a little progress
as I noticed, all the available references assume a <tag> underneath the <?XML> tab and of course the closing </tag> at the bottom, and the xml file I am reading do not have that, they go right ito the <addon id=

so I wrote a little more to read the xml, add those missing elements and then write to a temp.xml. and the read that xml, but I can only get it to read the descrption field. Skips everything, and whilst I do have need of THAT data, I also have need of the other fields :(

Public Sub ReadAddonXML(ByVal AddonName)
        Try

            If My.Computer.FileSystem.FileExists("Test.xml") Then '<-9
                My.Computer.FileSystem.DeleteFile("Test.xml")
            End If

            Dim file As System.IO.StreamWriter
            file = My.Computer.FileSystem.OpenTextFileWriter("Test.xml", True)
            Const forReading = 1

            Dim objFSO, objFile, sData
            objFSO = CreateObject("Scripting.FileSystemObject")
            objFile = objFSO.openTextFile("addon.xml", forReading)
            sData = ""
            Do Until objFile.atEndOfStream
                Dim Data As String = sData & objFile.readLine
                Dim NewData As String = Replace(Data, "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>", "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>" & NL & "<addons>")
                file.WriteLine(NewData)
            Loop
            file.WriteLine("</addons>")
            objFile.close()
            objFile = Nothing
            objFSO = Nothing
            file.Close()

            Dim output As StringBuilder = New StringBuilder()

            Dim XmlReader As New XmlTextReader("Test.xml")
            Dim intID As String
            Dim intProductCountTotal As Integer
            Dim strPrice, strWeight, strDescription, strId As String
            While XmlReader.Read()
                If XmlReader.Name.ToString() = "addon" Then
                    If XmlReader.HasAttributes Then
                        While XmlReader.MoveToNextAttribute()
                            If XmlReader.Name = "addons" Then
                                intID = XmlReader.Value.ToString()
                            End If
                        End While
                    End If
                End If
                If XmlReader.Name.ToString() = "id" Then strId = Trim(XmlReader.ReadString())
                If XmlReader.Name.ToString() = "name" Then strPrice = Trim(XmlReader.ReadString())
                If XmlReader.Name.ToString() = "version" Then strWeight = Trim(XmlReader.ReadString())
                If XmlReader.Name.ToString() = "description" Then strDescription = Trim(XmlReader.ReadString())

                'When the end of each <Product> element is reached by the XmlReader, you can extract all the values you need and import them into a database or whatever
                'These readers provide forward-only access to XML data, so I choose to extract the data from each of the elements, and then use the values
                If XmlReader.Name.ToString() = "addons" And XmlReader.NodeType.ToString() = "EndElement" Then

                    output.AppendLine("Values at product ID " & strId & " is:")
                    output.AppendLine("- price: " & strPrice & "<br>")
                    output.AppendLine("- weight: " & strWeight & "<br>")
                    output.AppendLine("- description: " & strDescription & "")
                    intProductCountTotal += 1
                    RichTextBox6.Text = output.ToString()
                End If



            End While




            XmlReader.Close()


            'MsgBox(output.ToString())

        Catch ex As Exception

        End Try
    End Sub

Based on your xml you want to store only the information of ONE plugin in this xml file. If so then you can use this code:

Dim xdoc As XDocument = XDocument.Load("C:\Users\GeekByChoiCe\Desktop\plugin.xml")
		Dim sb As New StringBuilder

		'asuming you have more than 1 plugin in the xml file
		Dim el As XElement = xdoc.Element("addon")
		sb.AppendFormat("id: {0}{4} name: {1}{4} version: {2}{4} description: {3}{4}{4}", el.@id, el.@name, el.@version, el...<description>.Value, Environment.NewLine)

		Label1.Text = sb.ToString

else you have to modify your xml slightly like:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addons>
<addon id="plugin.video.stagevu"
       name="StageVU"
       version="1.3.6"
       provider-name="AJ">
  <requires>
    <import addon="xbmc.python" version="1.0"/>
  </requires>
  <extension point="xbmc.python.pluginsource"
            library="default.py">
        <provides>video</provides>
  </extension>
  <extension point="xbmc.addon.metadata">
    <summary>stagevu: Watch video</summary>
    <description>Watch what you have been searching on internet.</description>
    <disclaimer>The video add-ons hosted by my XBMC add-ons repository(aj add-ons) makes no warranties, expressed or implied, and hereby disclaims and negates all other warranties, including without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights. Further, video add-ons don't warrant or make any representations concerning the accuracy, likely results, or reliability of the use of the materials on the Internet web site where from data is retrieved or otherwise relating to such materials or on any sites linked to this addon. Videos are streamed directly from video-hosting websites that are having full rights to remove such access to video if required.</disclaimer>
	<platform>all</platform>
  </extension>
</addon>
<addon id="plugin.video.dummy"
       name="Dummy"
       version="1.0.0"
       provider-name="GbC">
  <requires>
    <import addon="xbmc.python" version="1.0"/>
  </requires>
  <extension point="xbmc.python.pluginsource"
            library="default.py">
        <provides>video</provides>
  </extension>
  <extension point="xbmc.addon.metadata">
    <summary>dummy plugin</summary>
    <description>I am a dummy plugin.</description>
    <disclaimer>blabla</disclaimer>
	<platform>all</platform>
  </extension>
</addon>
</addons>

and using the following code:

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
		Dim xdoc As XDocument = XDocument.Load("C:\Users\GeekByChoiCe\Desktop\plugin.xml")
		Dim sb As New StringBuilder

		'asuming you have more than 1 plugin in the xml file
		For Each el As XElement In xdoc.Root.Elements
			sb.AppendFormat("id: {0}{4} name: {1}{4} version: {2}{4} description: {3}{4}{4}", el.@id, el.@name, el.@version, el...<description>.Value, Environment.NewLine)
		Next

		Label1.Text = sb.ToString
	End Sub

Note: Make sure you have added a reference to System.Xml.Linq

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.