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

Add Attribute In XmlReader

hi
Is there any way by which i can add an Attribute to each node in
XmlReader, without looping through the XmlReader.

Even if i have to loop than also how it can be done.

my xml is:

<employee>
<firstname />
<lastname />
</employee>
<employee>
<firstname />
<lastname />
</employee>
<employee>
<firstname />
<lastname />
</employee>

and i want

<employee id="0">
<firstname />
<lastname />
</employee>
<employee id="0">
<firstname />
<lastname />
</employee>
<employee id="0">
<firstname />
<lastname />
</employee>
how it can be done

thanx
Vidit

Nov 12 '05 #1
1 1158


vi*********@gmail.com wrote:
Is there any way by which i can add an Attribute to each node in
XmlReader, without looping through the XmlReader.
An XmlReader is a pull based read only access to XML so I am not sure
why you think you can add attributes or anything with an XmlReader.
If you wanted to add attributes to XML you can read it in with a reader
but you need than some other code to do any changes, perhaps by having
an XmlWriter that copies all stuff from the reader but adds attributes
where you want them.

<employee id="0">
<firstname />
<lastname />
</employee>
<employee id="0">
<firstname />
<lastname />
</employee>
<employee id="0">
<firstname />
<lastname />
</employee>


Why would you want to give all <employee> elements the same id?

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 12 '05 #2

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

Similar topics

5
by: xmlguy | last post by:
I believe this should be pretty elementary, but for some reason I cannot seem to think of how to write the an XML file from an incoming XML file. Basically this is what I do: Input: ...
2
by: Bill Cohagan | last post by:
In my app I'm validating an XML file against an XSD which contains several attribute default value specifications. I'm performing the validation via an xml document load() using a...
12
by: ~~~ .NET Ed ~~~ | last post by:
Hi, I have a standalone XML file (with the appropriate xml document header) that works fine when I load it using XmlDocument. I can have child elements like this without problems: ...
1
by: soupaman | last post by:
Im trying to output some filtered xml using the xmlTextReader I know the code and commenting needs cleaned up and eventually plan to add the values to a dataset. currently what this is doing is...
2
by: beachnut | last post by:
Hi, all. I am passed an XML chunk via a string parameter, which I must parse to get some attribute values, run some computation on those, poke the result into another attribute, and return that...
1
by: Angus Lepper | last post by:
I'm writing a stock ticker for a stock market simulation, and can load the data into the xmlreader in the first place, but can't figure out how to refresh/update the data in it. Any ideas? Code:...
3
by: jhowey | last post by:
Hi, I would like my default ValidationType to be Auto. Now let's say I have both a DTD and an XSD file for this XML file being validated. While it's ValidationType.Auto, it will validate the...
3
by: ThunderMusic | last post by:
Hi, I have an XML like document I want to parse... The document looks like this : <Form id="frmMain" width="345" height="75" HeaderHeight="9" image="frmMain.jpg" ColorKey="000000"> <Control...
4
by: Stefan Hoffmann | last post by:
hi @all, I'm trying to validate a XML against a schema using the example from the MSDN: http://msdn.microsoft.com/en-us/library/system.xml.xmlreadersettings.validationtype.aspx In my case...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.