How to create an XML file

22 01 2012

In one of the previous posts we have seen how to read an XML file, similar way sometimes we may need to create an XML file from our applications.

To read and write and XML file Microsoft provides an XML parser know as MSXML. This is a COM component that comes with different MS Products like MS Windows, MS IEs, MS Office etc.

XMLDomWriter.h

XMLDomWriter.cpp

 

 

#include "XMLDomWriter.h"

void CreateXMLFile()
{
	CXMLNode		rootNode;
	CXMLDomDocument doc;

	rootNode = doc.CreateRootNode( _T("RootNode"));
	rootNode.AddNewLine();
	CXMLNode firstNode(doc.CreateNode(_T("Node1")));
	rootNode.AppendNode( firstNode );
	firstNode.AddNewLine();
	firstNode.SetAttributes( _T("AttributeName"), _T("AttributeValue"));
	CXMLNode childNode(doc.CreateNode(_T("ChildNode")));
	childNode.SetValue(_T("NodeValue"));
	firstNode.AddChildNode( childNode );
	firstNode.AddNewLine();
	rootNode.AddNewLine();

	doc.Save("c:\\test.xml");
}

Please download the attached XMLDomWriter.h and XMLDOMWriter.cpp files and include it into your project. You may need to change the msxml dll import section of header file as per the compiler version.

Advertisements

Actions

Information

49 responses

15 03 2014
Aparts Aristea

My partner and I stumbled over here from a different web address and thought I should check things out.
I like what I see so i am just following you. Look forward to exploring your web page for a second
time.

15 03 2014
Sanoop S P

Thank you.

16 03 2014
Lefkada Holidays Aparts

Why users still use to read news papers when in this technological world the whole thing is existing
on net?

16 03 2014
Apartss Aristea Lefkada

I just like the helpful information you supply for your articles.

I will bookmark your blog and take a look at again here regularly.
I’m quite sure I will be told many new stuff right here!
Good luck for the following!

16 03 2014
Kai

This is a topic that is close to myy heart…
Thank you! Exactly where are your contact details
though?

22 03 2014
Sanoop S P
21 04 2014
symantec

Your own data in addition to word of advice precise neat to my opinion.
Thank you exceedingly to a large extent beforehand. The acquaintance for
this focus is excellent, I’m happy of which here’s observed.
Many thanks another time!

20 05 2014
family

Whoa! This blog looks exactly like my old one!
It’s on a completely different subject but it has pretty much the same layout and design. Great
choice of colors!

21 05 2014
pokemon ruby omega rom download

Thanks a bunch for sharing this with all folks
you actually recognize what you are speaking approximately!
Bookmarked. Kindly additionally consult with my website =).
We may have a link exchange agreement among us

3 06 2014
Christian Louboutin Outlet

It’s amazing to pay a quick visit this site
and reading the views of all friends on the topic of this piece of
writing, while I am also keen of getting knowledge.

21 07 2014
Sanoop S P

Thank you.

With Best Regards,
Sanoop

10 06 2014
highline residences

Great article. I will be going through some of these issues as well..

12 06 2014
auto insurance nj cure

Thankks for sharing your thoughts aboout trichotomous.
Regards

15 06 2014
phen 375

It’s remarkable to pay a quick visit this web site and
reading the views of all mates concerning this piece of writing, while I am also eager of getting experience.

18 06 2014
simpoints code generator

This post is worth everyone’s attention. Where can I find out more?

21 07 2014
Sanoop S P

Thank you.
You can find more posts on https://vcpptips.wordpress.com/

1 07 2014
Scott marketing services

Link exchange is nothing else except it is simply placing the other person’s
webpage link on your page at appropriate place and other person will
also do same for you.

3 07 2014
Freunde Finden

Very great post. I simply stumbled upon your blog and wished to mention that I’ve
really enjoyed surfing around your weblog posts. In any case I
will be subscribing in your feed and I am hoping you write
once more very soon!

21 07 2014
Sanoop S P

Thank you.

11 07 2014
place zabaw

It’s impressive that you are getting ideas from this paragraph as well as from our
argument made at this time.

17 07 2014
pickel am hals

Greetings! Very useful advice in this particular post!
It is the little changes that will make the greatest
changes. Many thanks for sharing!

21 07 2014
Sanoop S P

Thank you.

18 07 2014
work step nine

Hi there everyone, it’s my first go to see at this site,
and post is really fruitful for me, keep up posting
these types of articles.

21 07 2014
Sanoop S P

Thank you.

25 07 2014
crack cod black ops 2

You really make it seem so easy with your presentation but I find this matter to be actually
something that I think I would never understand.
It seems too complex and extremely broad for me.
I am looking forward for your next post, I’ll try to get the hang of it!

16 08 2014
emergency cash

emergency cash

How to create an XML file | C++ and VC++ Tips

20 08 2014
2nd edition pdf

Hello my loved one! I want to say that this post is amazing, nice written and include approximately all important infos.
I’d like to peer extra posts like this .

26 08 2014
Sanoop S P

Thank you.

21 08 2014
how to select a quality carpet cleaner

Dude,awesome blog you have here. Loads of useful posts as well as related information!!!

Do you provide any kind of articles in regard to tips for carpet cleaning?

21 08 2014
Dr Dre Beats Tour

Definitely consider that that you stated. Your favorite justification appeared to
be at the net the easiest thing to bear in mind of. I say to you, I definitely get irked
while folks consider issues that they just do not realize about.
You controlled to hit the nail upon the highest as well as defined out the entire thing without having side
effect , other folks could take a signal. Will likely be
again to get more. Thank you

23 08 2014
pdf books

I loved as much as you’ll receive carried out right here.

The sketch is tasteful, your authored material stylish.
nonetheless, you command get bought an shakiness over that you wish be delivering the following.
unwell unquestionably come further formerly again as exactly the same nearly a lot often inside case
you shield this increase.

28 08 2014
http://zmadelinemarques.soup.io

I got this website from my friend who informed me concerning
this web page and at the moment this time I am browsing this website and reading very informative articles
or reviews at this time.

2 09 2014
search engine

I do not even know how I ended up here, but I thought this post was good.
I don’t know who you are but certainly you’re going to a famous blogger if you are not
already 😉 Cheers!

12 10 2014
Sanoop S P

Thank you. 🙂

4 09 2014
audit system

Wonderful blog! I found it while browsing on Yahoo News.
Do you have any suggestions on how to get listed in Yahoo News?
I’ve been trying for a while but I never seem to get there!
Cheers

6 09 2014
gift card ซื้อได้ที่ไหน

After looking into a handful of the blog posts on your blog,
I honestly appreciate your technique of blogging. I book-marked it to my bookmark webpage list and will be checking back soon. Please visit my web
site as well and let me know your opinion.

16 09 2014
http://Scribd.Com/

The other day, while I was at work, my cousin stole
my apple ipad and tested to see if it can survive a forty foot drop,
just so she can be a youtube sensation. My iPad is now destroyed and
she has 83 views. I know this is completely off topic but I had to share it with someone!

21 09 2014
www.lillysdjservice.com

Wow that was odd. I just wrote an incredibly long comment but after I clicked submit my comment didn’t show up.
Grrrr… well I’m not writing all that over again. Anyway, just wanted to
say fantastic blog!

25 09 2014
cell phone spy monitoring software

Hello very cool blog!! Guy .. Beaautiful .. Amazing .. I’ll bookmark
your website and take the feeds also? I am satisfiewd to find numerous
helpful info here iin the submit, we’d like work out
more techniques in this regard, thanks for sharing.
. . . . .

12 10 2014
Sanoop S P

Thank you.

5 10 2014
Top Electric Shaver

Hi! I know this is kinda off topic nevertheless I’d figured I’d ask.
Would you bbe interested in trading links or maybe guest authoring a blog article or vice-versa?
My site goes over a lott of the same subjects as yours and I believe we could greatly benefit from each other.
If youu happen to be interested feel free to send me ann email.
I look forward to hearing from you! Fantastic blog by the
way!

8 10 2014
www.haaretz.com

A lot of thought and thinking has to go behind it and
we should opt for something that is well and truly safe and foolproof to say
the least. A camera or cameras that are mounted in an obscure place that has good vision of the surrounding area
record movements. A distinct feature of this package is the sync facility and online
backup feature.

9 10 2014
Annetta

I’ll right away take hold of your rss as I can’t in finding your e-mail subscription hyperlink or e-newsletter service.
Do you have any? Please allow me understand in order that I may subscribe.

Thanks.

18 11 2014
Fix Daqlab Error Creating Excel File Windows XP, Vista, 7, 8 [Solved]

[…] How to create an XML file | C++ and VC++ Tips – Jan 22, 2012 · In one of the previous posts we have seen how to read an XML file, similar way sometimes we may need to create an XML file from our applications…. […]

28 11 2014
How To Develop Antivirus - Remove Spyware, Malware and Viruses

[…] How to create an XML file | C++ and VC++ Tips – Jan 22, 2012 · In one of the previous posts we have seen how to read an XML file, similar way sometimes we may need to create an XML file from our applications…. […]

7 01 2015
How To Fix Filezilla Error Writing Xml File in Windows

[…] How to create an XML file | C++ and VC++ Tips – Jan 22, 2012 · In one of the previous posts we have seen how to read an XML file, similar way sometimes we may need to create an XML file from our applications…. […]

10 01 2015
hairdresser stoke-on-trent

bookmarked!!, I really like your wweb site!

29 07 2015
Sanoop S P

Thank you.

16 01 2015
perfect dedicated server

There’s definately a great deal to find out about this issue.

I love all of the points you have made.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: