|
I need to Code a Program That Writes
The Employee information of a company
Into an XML file.... and to Read That file.....
Ive to do it in VC++ using APPWizard
|
|
|
|
|
life becomes simple if u use .net classes like:
XmlSerializer, XmlTextReader, TextWriter.
u have to include respective namespaces, System::Xml, System::Xml::Serialization.
|
|
|
|
|
This is a C++ forum, not a managed forum...
|
|
|
|
|
Hitting the right forum will make our lives easier too.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You can use tinyXML[^] library..
I hope it helps.
Regards,
Sandip.
|
|
|
|
|
|
Thanks for the link....
But Can You Tell me how to create an XML file
In the tutorial....an XML file is already created..
Thats been loaded
|
|
|
|
|
There is a save method for the IXMLDOMDocument . so can add nodes to the XML file using the appendChild function and when you are done adding all the nodes and sub nodes, you can call the save function, which will flush the content of the IXMLDOMDocument to the specified file in the XML format.
|
|
|
|
|
Now Ive Created an Xml file.....
By Adding new item(.xml) in project settings...
Ive started with a dialog box....
on pressing ok..the file is opened...
The CODE IS:
void CXMLDOMFromVCDlg::OnBnClickedEnter()
{
XmlDocument *docXML = new XmlDocument;
docXML->LoadXml(S"");
}
Ive Also added :
#import <msxml.dll> named_guids
using namespace MSXML;
.................. in stdafx.h
im doing this using MFC AppWizard.....
this is not working......
im getting so many ERROR:
: 'XmlDocument' : undeclared identifier
: 'docXML' : undeclared identifier
: syntax error : identifier 'XmlDocument'
: left of '->LoadXml' must point to class/struct/union
: managed targeted code requires '#using <mscorlib.dll>' and '/clr' option
|
|
|
|
|
anna mathew wrote: XmlDocument *docXML = new XmlDocument;
no no. There is nothing called XmlDocument, it is IXMLDOMDocument. Please read the article I suggested...
anna mathew wrote: By Adding new item(.xml) in project settings...
you add xml to project settings?? why?
|
|
|
|
|
Instead of creating an XML file by coding...
i tried to create it using AppWizard...thatz all
............ I made the changes u said....
void CXMLDOMFromVCDlg::OnBnClickedEnter()
{
IXMLDOMDocument *docXML = new IXMLDOMDocument;
docXML->loadXML(S"");
}
but i get the following ERRORS......
ERROR: 'IXMLDOMDocument' : cannot instantiate abstract class
ERROR: managed targeted code requires '#using <mscorlib.dll>' and '/clr' option
Y is it?????
****************************************************
I also tried:::::::::
void CXMLDOMFromVCDlg::OnBnClickedEnter()
{
IXMLDOMDocumentPtr docPtr;
docPtr.loadXML("XMLDOMFromVC.xml");
}
but i get similar errors.....
|
|
|
|
|
anna mathew wrote: Instead of creating an XML file by coding...
i tried to create it using AppWizard...thatz all
I dont know how you generate this codes, using App wizards.
Any way this is the code for creating the IXMLDOMDocument.
IXMLDOMDocument* pXMLDoc = 0;
HRESULT hr = CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER,
IID_IXMLDOMDocument, (void**)&pXMLDoc);
Please understand that this is COM. You cannot simply allocate a com pointer using the new .
|
|
|
|
|
Also can u send me some sample code...
to create XML File....
and Enter data to it
|
|
|
|
|
|
KarstenK wrote: this fine and outstanding article will be a great helper
In case you haven't noticed, that fine and outstanding article haven't got any vote yet... I couldn't believe..
|
|
|
|
|
I noticed myself yesterday and thought about a CodeProject bug since it is an unbelievable: the article had about 22000 views and no vote.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I even tried another browser to check whether it is a bug or not...
Any way it shows two votes now
|
|
|
|
|
I was just wondering who were the two 5 voters
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Now it shows 3 votes
BTW: Another member for THHB
Regards,
Sandip.
|
|
|
|
|
I think the same: welcome Naveen [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am honored
|
|
|
|
|
Hi,
Iam working buttons in dialog.
i have a problem.i have created a button with caption "&Total"
while executing, pressing T could not fire OnBnClicked() function instead it fires OnKeyUp() function.
however if i set "o" as shortcut, it fires OnBnClicked() function directly.
can anyone please explain why and how this is happening..
RNarayan
|
|
|
|
|
try adding an accelerator.
|
|
|
|
|
Check 'T' might be assigned to some other button or some menu item.
BTW: OnKeyUp() will be fired in all the cases.
Regards,
Sandip.
|
|
|
|
|
Pressing Alt-T may be more reliable than just pressing T for invoking the shortcut.
|
|
|
|