|
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.
|
|
|
|
|
Dear friends,
Could you please advice me what actually is the VM Size or Private bytes ? Does it exactly includes the code part of the executable ? for eg: If the binary size increase by 1 MB does it means that corresponding increase of 1 MB will be there in Private bytes of that process ? Or Private bytes is only the allocated data area of the process(allocated either by the process itself or through the loaded DLLs)?
Thanks
|
|
|
|
|
I think alot of people are going to find this question EXTREMELY confusing. You should elaborate a little.
Tell us what you are referring to with the term "private bytes". Is this object an uncompiled text file? Is this a loaded executable? What version compiler and language and operating system are you using? What dependencies do you have? Most important, why do you need this information? (This will supply us with a context.)
And, of course, what the heck are "public bytes"? (Is this a scope problem?)
...Details,...specifics...be verbose...
...or, maybe, just google it...
|
|
|
|
|
Hi,
I have problem:
In class I have as member another class. For example:
class MyOwner
{
public:
MyClient m_client;
.
.
};
class MyClient
{
};
I need access form member class ( m_client ) to members of owner class, preferably also to private mebers. Can you adwise me?
Regards
Radek
|
|
|
|
|
Declare a member of MyClient as MyOwner*.
class MyOwner
{
public:
MyClient m_client;
.
.
};
class MyClient
{
public:
MyOwner* m_owner;
MyClient( MyOwner* Owner )
{
m_owner = Owner;
}
};
“Cannot find REALITY.SYS...Universe Halted.”
~ God on phone with Microsoft Customer Support
|
|
|
|
|
Hi,
thank you for your answer.
I try same solution as you send me, but I have another problem:
MyOwner and MyClient classes are in their separate header files ( MyOwner.h and MyClient.h). If I try use this solutin, I got many errors from compiler.
I think that problem may be in incorrect includes of header files.
Can somebody give me some advice?
Regards
Radek
|
|
|
|
|
You must use a forward declaration:
Inside MyOwner.h
class MyClient;
class MyOwner
{
.
.
.
}
Inside MyClient.h
class MyOwner;
class MyClient
{
.
.
.}
“Cannot find REALITY.SYS...Universe Halted.”
~ God on phone with Microsoft Customer Support
|
|
|
|
|
Discalimer:
The cluttered design of the following code is a mere conseguence of you requirements and
you retain full responsibility of
(I need the above to escape from led mike's advices about Scott Meyers' books )
class MyOwner;
class MyClient
{
MyOwner * m_pOwner;
public:
MyClient(MyOwner * pOwner):m_pOwner(pOwner){}
void doStuff();
};
class MyOwner
{
friend class MyClient;
private:
int m_iHiddenSecret;
public:
MyOwner (int iTheSecret)
{
m_iHiddenSecret = iTheSecret;
m_pClient = new MyClient(this);
}
~MyOwner()
{
delete m_pClient;
}
MyClient * m_pClient;
};
void MyClient::doStuff()
{
cout << "Now we all know the secret is: " << m_pOwner->m_iHiddenSecret << endl;
}
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]
modified on Friday, October 24, 2008 3:28 AM
|
|
|
|