#includeusing namespace xercesc; DOMElement* myElement = ... ; // assume 'myElement' is a valid DOM element pointer const XMLCh* attrValue = myElement->getAttribute(XMLString::transcode("id"));
#includeIn this example, we used the getAttribute method to retrieve two attributes "id" and "name" associated with a DOM element "myElement". We passed the attribute names as string parameters to the method and retrieved their values using the returned const XMLCh* values. The package/library used in this example is also Xerces-C++.using namespace xercesc; DOMElement* myElement = ... ; // assume 'myElement' is a valid DOM element pointer const char* attributeName1 = "id"; const char* attributeName2 = "name"; const XMLCh* attrValue1 = myElement->getAttribute(XMLString::transcode(attributeName1)); const XMLCh* attrValue2 = myElement->getAttribute(XMLString::transcode(attributeName2));