473,793 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="2004 0105:22:00:05">

Thanks in advanced!!!!

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

Dim N As XmlNode
Dim oXML As New System.Xml.XmlD ocument
N = oXML.CreateElem ent(NodeName)
N.InnerText = Content

This adds an attrbite to the Node represented by N
Dim i As XmlAttribute
i = lXML.CreateAttr ibute(Attribute Name)
i.Value = AttributeText
N.Attributes.Se tNamedItem(i)

"Guoqi Zheng" <no@sorry.com > wrote in message
news:eE******** ******@TK2MSFTN GP11.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="2004 0105: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=vitamin cart; User ID=em; Password=pass"
Dim objconnection as New SqlConnection(s trConnection)
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("Catalo g")
objAdapter.fill (objDataset, "Product")
Dim filename As String =
"E:\virtual_hos ts\vitaminstore \vitaminstore.n l\home\html\td\ product.xml"
' Create the FileStream to write with.
Dim myFileStream As New System.IO.FileS tream _
(filename, System.IO.FileM ode.Create)
' Write to the file with the WriteXml method.
objDataSet.Writ eXml(myFileStre am, DiffGram)
myFileStream.Cl ose()

"netnews.comcas t.net" <Ma**@InterData Soft.com> wrote in message
news:ulzMb.3386 8$8H.75288@attb i_s03...
This adds a root node to an XML object

Dim N As XmlNode
Dim oXML As New System.Xml.XmlD ocument
N = oXML.CreateElem ent(NodeName)
N.InnerText = Content

This adds an attrbite to the Node represented by N
Dim i As XmlAttribute
i = lXML.CreateAttr ibute(Attribute Name)
i.Value = AttributeText
N.Attributes.Se tNamedItem(i)

"Guoqi Zheng" <no@sorry.com > wrote in message
news:eE******** ******@TK2MSFTN GP11.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="2004 0105: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
408
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 fastest? I don't think the ReadXMLSchema would give a lot of difference, but maybe the overlaods of ReadXml and WriteXml will. Especially with larges files/datatables... Should I use the IO.Stream? The XmlReader/XmlWriter?
1
3589
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 typed dataset from an xsd schema I've created in VS.NET 2002, instantiate and populate the dataset and write it as XML using WriteXML() the generated XML file is not valid based on the xsd file used to create the dataset.
3
4830
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 manually add the xsl reference statement to the xml file. i.e. <?xml version="1.0" standalone="yes"?> <?xml:stylesheet type="text/xsl" href="Questions.xsl"?> --> I have to
1
3924
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 one dataset into an xml file: i do that the following way: DataSet ds = ThemeManager.getThemes(themes);
4
2406
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 and then using the writexml(...) function saves the dataset to an xml file. I have noticed that the file does not change everytime I click the save button. I get no errors but the writexml function does not seem to be updating the xml file. ...
3
4306
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 ds2 = new DataSet(); ds2.ReadXml(msOri); It compiled ok, but when it run fail at the last line: ds.WriteXml(msOri);
2
2695
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 access the same XML file and when one writes to it the other can't seem to read it. I've also tried running in the debugger and stopping the program on the line after the file is written, go to the next line and then attempting to open the file....
0
1368
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 creating ServiceNew.exe.config below. The initial line, '<?xml version="1.0" encoding="utf-8" ?' is missing and the nodes are not hiearchical with indentation from the root to the innermost nodes as the original config file. How can I add this...
1
5644
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> <description>...</description> </header>
0
9671
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10433
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10212
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9035
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6777
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2919
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.