bernard tran wrote:
const _di_IXMLDocument document =
interface_cast<Xmlintf::IXMLDocument> (new TXMLDocument(NULL));
You should be using the NewXMLDocument() function instead of
constructing the TXMLDocument object manually:
http://docwiki.embarcadero.com/Libraries/en/Xml.XMLDoc.NewXMLDocument
const _di_IXMLDocument document = NewXMLDocument();
document->LoadFromFile("c:\test.xml");
You need to escape backslashes in string literals:
"c:\\test.xml"
Also, LoadFromFile() expects a System::String, which is an alias for
System::UnicodeString in CB2009 and later. And while a UnicodeString
can be constructed from a char* string, doing so requires a runtime
conversion of the character data instead of merely assigning the data
as-is.
I suggest you use the _D() macro to ensure that your string literal
uses the same character type that System::String uses:
document->LoadFromFile(_D("c:\\test.xml"));
const _di_IXMLNode node =
document->DocumentElement->ChildNodes->FindNode("Settings");
Same for the FindNode() parameter:
FindNode(_D("Settings"));
--
Remy Lebeau (TeamB)
Connect with Us