Loading ...
Sorry, an error occurred while loading the content.

Regarding Addin

Expand Messages
  • parasuraman.ramakrishnan
    Hi, I want to make an addin which reads an XML code in the center Screen. When the addin is clicked it should call an Validator Engine which checks the XML
    Message 1 of 1 , Oct 16, 2008
    • 0 Attachment
      Hi,

      I want to make an addin which reads an XML code in the center Screen.
      When the addin is clicked it should call an Validator Engine which
      checks the XML code for errors.

      This is my Execute statment:
      Public Sub Exec(ByVal commandName As String, ByVal executeOption
      As vsCommandExecOption, ByRef varIn As Object, ByRef varOut As Object,
      ByRef handled As Boolean) Implements IDTCommandTarget.Exec
      handled = False
      If executeOption =
      vsCommandExecOption.vsCommandExecOptionDoDefault Then
      If commandName = "MyAddin1.Connect.MyAddin1" Then

      Dim a As New Class1
      a.tests()


      handled = True
      Exit Sub
      End If
      End If
      End Sub


      And the Class1 has a function called tests(). The class code is:

      Imports EnvDTE
      Imports EnvDTE80
      Imports System.IO
      Imports Extensibility
      Imports System.Xml


      Public Class Class1
      Dim applicationObject As DTE2
      Dim mydoc As XmlDocument





      Public Sub tests()

      'cmmd = applicationObject.Commands.Item("File.Open")

      'i = cmmd.ID
      'guid = cmmd.Guid
      'name = cmmd.Name

      Dim e As Int16 = 2

      Dim fs As New FileStream("C:\Validation.xml", FileMode.Open,
      FileAccess.Read)
      Dim d As New StreamReader(fs)
      d.BaseStream.Seek(0, SeekOrigin.Begin)
      While d.Peek() > -1
      MsgBox(d.ReadLine)
      End While

      End Sub


      End Class


      When I try to do the following

      mydoc.Load("/abc.xml")
      dim node as XMLNode

      node= myDoc.DocumentElement

      MsgBox(node.ToString)

      It doesnt work... But when I use the StreamReader it works perfctly.
      Can I Load an XML file using the Load method?

      Please Advice..

      Thanks
    Your message has been successfully submitted and would be delivered to recipients shortly.