Ask something about using XML in asp.net

  • Thread starter Allan via DotNetMonster.com
  • Start date
A

Allan via DotNetMonster.com

I am trying to save the xml doc by using asp.net, and i also know how to add
the record.

Dim myDS As New DataSet("Job Information")
If System.IO.File.Exists(Server.MapPath("Hello.xml")) Then
myDS.ReadXml(Server.MapPath("Hello.xml"))

' add record to exist xml document
Dim myDR As DataRow = myDS.Tables("Data").NewRow()
myDR("ID") = txtJobID.Text
myDR("sentences") = txtPosition.Text
myDS.Tables("Data").Rows.Add(myDR)

myDS.WriteXml(Server.MapPath("Hello.xml"))

Else
' add new xml document
Dim myDT As DataTable = myDS.Tables.Add("Data")
myDT.Columns.Add("ID", System.Type.GetType("System.String"))
myDT.Columns.Add("sentences", System.Type.GetType("System.String")
)

Dim myDR As DataRow = myDS.Tables("Data").NewRow()
myDR("ID") = txtJobID.Text
myDR("sentences") = txtPosition.Text
myDS.Tables("Data").Rows.Add(myDR)

myDS.WriteXml(Server.MapPath("Hello.xml"))
End If

But i have a question. If i wanna enter groups of words, like

textbox1.text:(have used multiLine)
Hello world
Hello my friend

that mean i want to break the sentance in 2 line, but in the xml doc, it save
as
<..>Hello worldHello my friend<..>

what can i do in programs so that xml doc can enter in two sentence...
Or using other enter methods can slove this problem?

thanks
Allan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top