Hello,
I'm trying to use tinyxml to parse an xml file and load data into my project (and eventually save it). I want to use the value of the id of the attribute in a treenode. So far I have this:
TiXmlDocument *xmlDoc = new TiXmlDocument("baseline.xml");
xmlDoc->LoadFile();
//add to treenode, under baselines node
Node1 = TreeView->Items->Item[1]; //second node in tree view
TreeView->Items->AddChild(Node1,xClient->Attribute("id"));
but when I compile the app (using borland c++ builder 6 enterprise), I get an error that says:
Method called on invalid object
- attempt to access 104 byte(s) at 0x0000000
- 0x0000110C
- TiXmlElement::Attribute()
- TbaseLiner::TbaseLiner(class:: TComponent *)
- 0400F59A4
- WinMain(void*,void *,char*,int)
- 0x3267E52F
As far as I can see, what I'm doing should work? Anyone have any suggestions?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'm trying to use tinyxml to parse an xml file and load data into my project (and eventually save it). I want to use the value of the id of the attribute in a treenode. So far I have this:
TiXmlDocument *xmlDoc = new TiXmlDocument("baseline.xml");
xmlDoc->LoadFile();
TiXmlElement *xClient = 0;
xClient = xmlDoc->FirstChildElement("client");
//add to treenode, under baselines node
Node1 = TreeView->Items->Item[1]; //second node in tree view
TreeView->Items->AddChild(Node1,xClient->Attribute("id"));
but when I compile the app (using borland c++ builder 6 enterprise), I get an error that says:
Method called on invalid object
- attempt to access 104 byte(s) at 0x0000000
- 0x0000110C
- TiXmlElement::Attribute()
- TbaseLiner::TbaseLiner(class:: TComponent *)
- 0400F59A4
- WinMain(void*,void *,char*,int)
- 0x3267E52F
As far as I can see, what I'm doing should work? Anyone have any suggestions?
Ok, after some reading I've managed to do what I wanted another way, but still, I'm sure what I did earlier should have worked?
I think the error is pretty clear in this case. Take a look at the return value of xmlDoc->FirstChildElement("client");
What does your XML data look like?