473,394 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

writexml with root tag

Dear sir,

I am trying to create to writeXml to create a xml file every day.

The WriteXml method of dataset is very nice and easy to use, however, how
can I add the following to my xml file?

<?xml version="1.0" encoding="UTF-8"?>
<productFeed version="0" timestamp="20040105:22:00:05">

Thanks in advanced!!!!

Nov 18 '05 #1
2 1438
This adds a root node to an XML object

Dim N As XmlNode
Dim oXML As New System.Xml.XmlDocument
N = oXML.CreateElement(NodeName)
N.InnerText = Content

This adds an attrbite to the Node represented by N
Dim i As XmlAttribute
i = lXML.CreateAttribute(AttributeName)
i.Value = AttributeText
N.Attributes.SetNamedItem(i)

"Guoqi Zheng" <no@sorry.com> wrote in message
news:eE**************@TK2MSFTNGP11.phx.gbl...
Dear sir,

I am trying to create to writeXml to create a xml file every day.

The WriteXml method of dataset is very nice and easy to use, however, how
can I add the following to my xml file?

<?xml version="1.0" encoding="UTF-8"?>
<productFeed version="0" timestamp="20040105:22:00:05">

Thanks in advanced!!!!

Nov 18 '05 #2
Thanks a lot for your quick reply. Here is my code. where can I put your
code? Sorry, I am very new to .net.
Dim strConnection as String = "Data source=xxx.xxx.xx.xx; Initial
Catalog=vitamincart; User ID=em; Password=pass"
Dim objconnection as New SqlConnection(strConnection)
Dim strSql as String = "SELECT * FROM tblKelkoo"

'Dataadapter setup
Dim objAdapter as New SqlDataAdapter(strSql, objConnection)

'dataset, adapter and table.
Dim objDataSet as New Dataset("Catalog")
objAdapter.fill(objDataset, "Product")
Dim filename As String =
"E:\virtual_hosts\vitaminstore\vitaminstore.nl\hom e\html\td\product.xml"
' Create the FileStream to write with.
Dim myFileStream As New System.IO.FileStream _
(filename, System.IO.FileMode.Create)
' Write to the file with the WriteXml method.
objDataSet.WriteXml(myFileStream, DiffGram)
myFileStream.Close()

"netnews.comcast.net" <Ma**@InterDataSoft.com> wrote in message
news:ulzMb.33868$8H.75288@attbi_s03...
This adds a root node to an XML object

Dim N As XmlNode
Dim oXML As New System.Xml.XmlDocument
N = oXML.CreateElement(NodeName)
N.InnerText = Content

This adds an attrbite to the Node represented by N
Dim i As XmlAttribute
i = lXML.CreateAttribute(AttributeName)
i.Value = AttributeText
N.Attributes.SetNamedItem(i)

"Guoqi Zheng" <no@sorry.com> wrote in message
news:eE**************@TK2MSFTNGP11.phx.gbl...
Dear sir,

I am trying to create to writeXml to create a xml file every day.

The WriteXml method of dataset is very nice and easy to use, however, how can I add the following to my xml file?

<?xml version="1.0" encoding="UTF-8"?>
<productFeed version="0" timestamp="20040105:22:00:05">

Thanks in advanced!!!!


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: DraguVaso | last post by:
Hi, I should use XML to synchronize the data from different (VB.NET) applications, and I was just wondering which Overloads of these functions ( ReadXmlSchema, ReadXml and WriteXml) goes the...
1
by: Dave | last post by:
Hi all, I've seen that many people have had this exact same problem in the past, but no-one seems to post the answer when (if) they solve it... so here we go again. If I create a strongly...
3
by: Gordon Moore | last post by:
Hi, I'm new to using xml/xslt and although I can create an xml document using the dataset.WriteXml statement, and I have created an xslt to transform the xml into the output I want, I have to...
1
by: judy | last post by:
Hi! I want to write 3 datasets from different tables into a xml file. i thought that would work using a dtd file. But i can't find a solution for my problem. At the moment i can only write...
4
by: Wes | last post by:
Hello, I have an application using an xml dataset to store app and user settings. The problem I am having is related to writexml. I have a save button on my application that updates the dataset...
3
by: ad | last post by:
I test the XmlWrite/XmlRead from MemoryStrem, my codes is: DataSet ds = Will.DM.ExecuteDataset("Select * from Customer); MemoryStream msOri = new MemoryStream(); ds.WriteXml(msOri); DataSet...
2
by: UJ | last post by:
It appears when you do a DataSet.WriteXml ( <filename>, <writemode> ) it doesn't close the file immediately. Is that true ? The reason I think that is I have two programs that are going to be...
0
by: hazz | last post by:
I want to load Service.exe.config into a DataGrid, change the timer interval value from 10000 to 555555, then update the original exe.config. The code below shows the code at step 1 and 2 before...
1
by: bav | last post by:
Hi; I would like to produce this kind of XML output using VB.NET 2003 DataSet.ReadXMLSchema, and add some row contents, and finally DataSet.WriteXML <test> <header> <name>...</name>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.