Click here to Skip to main content
15,886,012 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Happy New Year,

Strange one to start the year off, any help would be appreciated.

I have a Winform Project calling a web service.   passing in an XML string.

When I pass through my XML to the webservice, it works fine and gets inserted into the dataset without a problem, however as soon as I include an email address within the XML the dataset does not create correctly?


Dim strXML As String = "<parameters><parameterline><details><machineid>Pal0066</machineid><printer>Printer1</printer><username>TomUser</username>"
strXML &= "<reportname>CanteenBilling</reportname><receiptmethod>Email</receiptmethod><format>PDF</format>"
strXML &= "<emailto>email@problemishere.co.uk</emailto><emailcc></emailcc><emailbcc></emailbcc><emailsubject></emailsubject>"
strXML &= "<emailbody></emailbody></details><reportparameters><location>1</location></reportparameters></parameterline></parameters>"


ConvertXMLIntoDS(StrXML)


Private Function ConvertXMLIntoDS(ByVal strXML As String) As Data.DataSet
           
            Dim ds As New Data.DataSet
            Dim reader As System.IO.StringReader
            Try
                  reader = New System.IO.StringReader(strXML)
                  ds.ReadXml(reader)
                  ConvertXMLIntoDS = ds

            Catch ex As Exception
                  'RunReports.AddLog("ConvertXMLIntoDS - Error")
                  'RunReports.AddError(ex, methodBase.Name)
            Finally
                  If Not IsNothing(ds) Then
                        ds.Dispose()
                        ds = Nothing
                  End If
                  If Not IsNothing(reader) Then
                        reader.Dispose()
                        reader = Nothing
                  End If
            End Try

        
      End Function
Posted

1 solution

tomkettering wrote:
the XML the dataset does not create correctly?


"does not create correctly" means what?

The following C# produces the email address as expected.
string sxml = "<root><mail>hello@mymail.com</mail></root>";<br />DataSet ds = new DataSet();<br />ds.ReadXml(new System.IO.StringReader(sxml));<br />Console.WriteLine(ds.Tables[0].Rows[0].ItemArray[0].ToString());<br /><br />


 
Share this answer
 


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