473,413 Members | 1,713 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,413 software developers and data experts.

Howto: Add XML Attributes to a dataset?

Hi,

I fill myDataset from a Excel file.
Then I do a myDataset.WriteXML("C:\MyXML.xml")
So far everything goes as I want to.

But I need a attribute when a node has a value
e.g.:

I get:
<Node1 />
<Node2>SomeValue</Node2>
<Node1 />

What I need is:
<Node1 />
<Node2 Changed="True">SomeValue</Node2>
<Node1 />

But how can I get this?
I tried filling a dataset by reading in a XML file the way I want but I cant
find any difference.
I spend the whole day searching and trying but no luck.
Someone knows how to do this?

Many thanks!
Nov 12 '05 #1
4 4255
Hi Pipo,

First of all, I would like to confirm my understanding of your issue. From
your description, I'm not quite sure what you need to do. Do you mean that
you need to write the DataSet to an Xml file with your own Changed
attribute set to true?

If so, I think we cannot do this directly with DataSet.WriteXml method,
since this is the default behavior of DataSet. If you need to add your own
attribute, I think you have to make a subclass of DataSet and implement
your own WriteXml method.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #2
Thanks for your reply Kevin,

Yes you're right that's was what I meant.
To bad to hear I cant provide my own attribute to the dataset.

Do you mean by I cant provide my own attribute that there are other
(standerd)
attribute(s) I can generate by the default Dataset.WriteXML method?

Thanks again
"Kevin Yu [MSFT]" <v-****@online.microsoft.com> schreef in bericht
news:jQ**************@cpmsftngxa06.phx.gbl...
Hi Pipo,

First of all, I would like to confirm my understanding of your issue. From
your description, I'm not quite sure what you need to do. Do you mean that
you need to write the DataSet to an Xml file with your own Changed
attribute set to true?

If so, I think we cannot do this directly with DataSet.WriteXml method,
since this is the default behavior of DataSet. If you need to add your own
attribute, I think you have to make a subclass of DataSet and implement
your own WriteXml method.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #3
Hi Pipo,

Yes, we cannot do that with current DataSet. If we need to achieve this, we
have to implement the WriteXml method by our own.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #4
Hello,

Did Kevin's suggstion make sense to the issue? If you need further
assistance on this issue, please feel free to let us know.

Luke

Nov 12 '05 #5

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

Similar topics

1
by: Sam Vanhoutte | last post by:
Hello, I am generating an XML schema for the use in Biztalk 2004. Everything works, except for one simple thing. I cannot add XmlSchemaElements to a XmlSchemaComplexType. This is necessary...
0
by: Daniel Frohberg | last post by:
Hi, I designed a DataSet with multiple tables using the VS DataSet-Designer. Attributes should be added to some of the fields. In XML it should look somewhat like this: .......
3
by: Plumer | last post by:
Good morning everyone Using C# I create a bog-standard System.Data.DataTable which I then Add to a System.Data.Dataset (At the moment I'm in the guess-and-test phase so the table has only one...
1
by: STeve | last post by:
Hi guys, I was wondering how I would go about creating a string array from a single column from a dataset. What I was thinking was iterate through each row in the dataset, finding out the size...
2
by: Allan Ebdrup | last post by:
Hi I have two strings in memory, a XML document and a Schema, I would like a function that takes these two as parameters and returns an errordescription if the XML does not validate and an empty...
4
by: DEWright_CA | last post by:
Hi Everyone! I am working on a project in C# and have a table the contains state info, plus a variety of other info that I will reference from another dropdown list. How can I do this...
7
by: Dan Sikorsky | last post by:
How do you iterate thru a dataset to change money fields to a different value? Here's what I have. My dataset is filled directly from a stored procedure. ' Create Instance of Connection and...
4
by: davearkley | last post by:
I've recently 'discover' the wonders of custom attributes and reflection. There's one aspect that has stumping me and I've been unable to find samples in the docs or on the web. I have fields in...
0
by: David Lozzi | last post by:
Howdy, I just had a small explosion in my brain, and now i'm a little more confused than I was before. I'm fairly new to XML, but understand it for the most part in regards to formatting. I have...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.