getElementById() is a member of DOMDocument. If you're using a DOM parser (such as DOMBuilder, as demonstrated in the DOMCount sample app), the parse call will return a pointer to the DOMDocument. An excerpt from DOMCount.cpp follows:
// Instantiate the DOM parser. static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull }; DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(gLS); DOMBuilder *parser = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYN CHRONOUS, 0); : : DOMDocument *doc = 0; try { // reset document pool parser->resetDocumentPool(); doc = parser->parseURI(xmlFile); } : : Once you've got the doc, you can look up the element and manipulate it. Something like the following should work (I've cheated a bit on the string constants in the interest of readability): XMLCh * elementId = L"my_id"; DOMElement * element = doc->getElementById(elementId); if (element) { XMLCh * attributeName = L"my_att_name"; XMLCh * attributeValue = element->getAttribute(attributeName); } If I understand the problem, you'll set elementId to something based on an error number, and attributeName will be a constant of your choosing. You may want to consider storing the error text in the element content rather than an attribute. I think that's an aesthetic choice in this case. It's somewhat easier to get attribute text, though. -----Original Message----- From: Leitner, Sarah M. [Contractor] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 10, 2002 10:37 AM To: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Subject: question On the response from Erik and subsequent emails, I was told to use the GetElementByID() methodcall. I am having trouble figuring how to use this call. What do I instantiate to get to it? Can someone give me some sample code? How do I use GetAttribute (below)? This was the problem (sorry, the original email is downloaded in my windows partition): I need to assign a number or letter code to each error message that can occur, then store the text of the messages in an XML doc. What is the best way to do this? It was suggested to Parse the error description doc with DOM and save the document for error lookups (I know how to parse, do I have to do anything special to save it?). Then do a GetElementByID() methodcall supplying the error number. Then I do a GetAttribute to get the error message in english. Thanks much for all of your help. Sarah --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]