KOD cpp: UKRYJ
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
XMLDocument1->Active = true;
_di_IXMLNode Chapter = XMLDocument1->DocumentElement;
Chapter->AddChild("Section"); // Tutaj wyjątek
_di_IXMLNode NewSection = Chapter->ChildNodes->GetNode(Chapter->ChildNodes->Count-1);
NewSection->SetAttribute("Title", (AnsiString)"New Section Title");
NewSection->AddChild("Components");
NewSection->AddChild("Wizards");
AnsiString XML;
XMLDocument1->SaveToXML(XML);
ShowMessage(XML);
}
{
XMLDocument1->Active = true;
_di_IXMLNode Chapter = XMLDocument1->DocumentElement;
Chapter->AddChild("Section"); // Tutaj wyjątek
_di_IXMLNode NewSection = Chapter->ChildNodes->GetNode(Chapter->ChildNodes->Count-1);
NewSection->SetAttribute("Title", (AnsiString)"New Section Title");
NewSection->AddChild("Components");
NewSection->AddChild("Wizards");
AnsiString XML;
XMLDocument1->SaveToXML(XML);
ShowMessage(XML);
}
Uruchomienie tego kodu zgłasza wyjątek:
|
"First chance exception at $7C812AFB. Exception class EAccessViolation with message 'Access violation at address 00402A1B in module 'Project1.exe'. Read of address 00000000'. Process Project1.exe (3956)". |
Pytanie brzmi jak prawidłowo utworzyć przykładowo taki prosty dokument XML
KOD mysql: UKRYJ
<?xml version="1.0" ?>
<document>
<title>Tytuł..</title>
<description>Opis..</description>
<description>Opis..</description>
<keywords>Słowa kluczowe.. Test ąęśćn</keywords>
</document>
<document>
<title>Tytuł..</title>
<description>Opis..</description>
<description>Opis..</description>
<keywords>Słowa kluczowe.. Test ąęśćn</keywords>
</document>




