simple xml reading

Results 1 to 2 of 2

Thread: simple xml reading

  1. #1
    Join Date
    Dec 1969

    Default simple xml reading

    Hi When do the xml reading i am getting below error<BR>pl help me<BR> The XML declaration is unexpected. Line 2, position 3.<BR>My code is<BR><BR>Public Function ParseSettings(ByVal path As String)<BR> Dim XmlFile As String = path & "config.xml"<BR> Dim txtReader As New XmlTextReader(New StreamReader(XmlFile))<BR> Dim sKeyval , sKeyname As String<BR><BR> txtReader.MoveToElement()<BR> While txtReader.Read()<BR> If txtReader.Name.Equals("add") Then<BR> If txtReader.MoveToFirstAttribute() Then<BR> sKeyname = txtReader.Value.Trim()<BR> If txtReader.MoveToNextAttribute() Then<BR> sKeyval = txtReader.Value.Trim()<BR> Else<BR><BR> End If<BR> End If<BR> End If<BR> End While &#039; ParseSettings()<BR> End Function &#039;ParseSettings<BR><BR>Here is my config.xml<BR><BR><BR>&#060;?xml version="1.0" encoding="utf-8" ?&#062;<BR>&#060;appSettings&#062;<BR> &#060;add key="ServerName" value="xx" /&#062;<BR> &#060;add key="UID" value="yy" /&#062;<BR>&#060;add key="PWD" value="xx" /&#062;<BR> <BR>&#060;/appSettings&#062;<BR><BR> <BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Umm... .NET has built-in..

    .. classes to read the application configuration files.<BR><BR>Why not use that instead?

Posting Permissions

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