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

generate xml at runtime

hello,
I am generating an XML document at run time.
I have been able to create the root element and the elements below it
but I am not able to add attributes to elements. Can anyone please
send a snippet on how to do this?

Thanks.

The sample code I am using is:

----------------------------------------------------
HRESULT hr;
IXMLDOMDocument2Ptr pXMLDoc;
IXMLDOMNodePtr pNode;
IXMLDOMProcessingInstructionPtr pi;

hr = pXMLDoc.CreateInstance("Msxml2.DOMDocument.4.0");
pi = pXMLDoc->createProcessingInstruction("xml", "version=\"1.0\"");
pXMLDoc->appendChild(pi);

pNode = pXMLDoc->createNode("1", "root", "");
pXMLDoc->appendChild(pNode);

pNode = pXMLDoc->createNode("1", "element1", "");
pXMLDoc->documentElement->appendChild(pNode);

------------------------------------------------------
Jul 20 '05 #1
1 2004
On 18 Oct 2004 03:24:53 -0700, na***********@yahoo.com (Zombie) wrote:
I have been able to create the root element and the elements below it
but I am not able to add attributes to elements.


Try the .setAttribute() method
Jul 20 '05 #2

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

Similar topics

4
by: Derek Fountain | last post by:
I have a situation where I have, in a string, the name of a class I want an instance of. I've written a factory function to generate the class for me: def controllerFactory( controllerRequired,...
1
by: SibAndela | last post by:
How do I generate an email in the serverside code (aspx.cs file) in which I can imbed data submitted from the client icluding attachment of client side files that the client has specified. up to now...
1
by: Encapsulin | last post by:
Hello everybody, I am newbie in Borland c++ builder, and a little confused, is it possible to add some vcl components to the Form at runtime? For example, i need to generate and show some (X)...
1
by: Jason Shohet | last post by:
What we've done so far in our web applications: 1. We have no datasets dragged-and-dropped in Visual Studio. They are all defined in the code, generated at runtime. 2. when a user updates or...
3
by: Jebrew | last post by:
Okay, so the deal is, I'm using the enum structure to populate some list, the problem is that I don't have the enums at compile time, they must be generated at runtime (i.e. read from some file or...
6
by: Marcus Kwok | last post by:
I am designing a GUI (my question is not about GUIs) and I have named my variables using a regular naming scheme. However, in order to simplify the code using these variables, I have created an...
5
by: mortb | last post by:
Hello! I make use of anonymous delegates in my code. For debugging purposes I'd like to generate the code that the delegates describe. Do anyone have an easy way to do this? cheers, mortb
111
by: Nate | last post by:
Hello, I am looking for a method to automatically declare variables in C. I'm not sure if there is a good way to do this, but I had something like this in mind... int i; for(i = 1; i < 4;...
0
by: StanB | last post by:
If I define Order class in WCF data contract http://OrderEntry)] public class Order { // ... } and use svcutil to generate a proxy class specifying namespace
0
by: Steven Samuel Cole | last post by:
Hello, I am writing an application that controls robots. Different robots can do different kinds of movements, such as e.g. open gripper, rotate gripper, etc. My RobotControl class should...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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.