Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 2nd, 2004, 10:50 PM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default VB.NET: Convert String and append to Xml files

Hi

Say i receive one string full of Xml tags ...

Example: "<Person>John</Person><Item>Pen</Item><Amount>4</Amount>"


How to save and append these tags to my xml files..

They told me to use appendChild method.. maybe i am not quite sure with string....... i save the string two times instead..
I am using VB.NET....

Dim myDoc As New Xml.XmlDocument
Dim myXml As String
myXml = "<Person>John</Person><Item>Pen</Item> _
<Amount>4</Amount>

myDoc.LoadXml(myXml)

Dim root As XmlNode = myDoc.DocumentElement

Dim person As XmlElement = myDoc.CreateElement("Person")
person.InnerText = John

Dim itemy As XmlElement = myDoc.CreateElement("Item")
item.InnerText = pen

Dim amount As XmlElement = myDoc.CreateElement("Amount")
amount.InnerText = 4

root.AppendChild(person)
root.AppendChild(item)
root.AppendChild(amount)
myDoc.Save("1.xml")

How to solve this so that it will append to the xml whenever i receive a string...

Thanks.



Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert string to xml prafullaborade XML 3 May 21st, 2008 06:56 AM
convert string to datetime in VB.net lisabb ASP.NET 2.0 Basics 3 June 19th, 2007 06:52 AM
convert otb files to hex string ela Classic ASP Professional 1 October 14th, 2004 01:20 PM
XML to String in VB.NET dimondwoof XML 1 June 24th, 2003 10:40 PM



All times are GMT -4. The time now is 04:02 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.