Help.
I am trying to use getElementsByTag, but without success.
BTW, I am using ProjectBuilder on MacOS x.
None of the examples, use DOM_Document = parser->getDocument.
In DOMprint it uses DOM_Node = parser->getDocument.
The node version works find but I get a memory exception on the DOM_Document version, afterwards, nothing works.
I keep checking my code but looks great to me.
DOM_Document doc = parser->getDocument();
Hope the below means something to somebody.
most of the time I just get
e = Cannot access memory at address 0x0
then sometimes something like this
e = @0x39a790: {fCode = 303784, fSrcFile = 0x492fc "\200\201\250,\000"..., fSrcLine = 299772, fMsg = 0x3c34b0, _vptr$ = 0x492fc}
DOM_Element root_elem = doc.getDocumentElement();
NSString *nodeValueString;
char * charValue;
DOM_Node ndChild;
DOMString elementNameStr("LastName");
// get element by tag name
DOM_NodeList person_name_nl = doc.getElementsByTagName(elementNameStr);
int nodeLength = person_name_nl.getLength();
for (int iNode = 0; iNode < nodeLength; iNode++) {
ndChild = person_name_nl.item(iNode);
DOMString nodeName = ndChild.getNodeName();
DOMString nodeValue = ndChild.getNodeValue();
// I have not gotten this far yet, I assume "LastName" must be a DOMString?
if (ndChild.getNodeName()=="LastName") {
charValue = ndChild.getNodeValue().transcode();
nodeValueString = [[NSString alloc] initWithCString:charValue];
// is there a better way to get DOMString to NSString?
[[[[xResume myWorker] myContact] myPersonName] setMyLastName: nodeValueString];
}
else if (ndChild.getNodeName()=="FirstName") {
charValue = ndChild.getNodeValue().transcode();
nodeValueString = [[NSString alloc] initWithCString:charValue];
[[[[xResume myWorker] myContact] myPersonName] setMyFirstName:nodeValueString];
}
}
}
home.pacbell.net/vanderen
