Not quite.  This line:

       attrVal =
nodeElement->getAttribute(XMLString::transcode(attributeName));

has a memory leak.

       XMLCh* attrName = XMLString::transcode(attributeName);
       attrVal = nodeElement->getAttribute(attrName);
       delete [] attrName;

Dave




                                                                       
                      "Andreas B.                                      
                      Thun"                    To:      [EMAIL PROTECTED]
                      <[EMAIL PROTECTED]>            cc:      (bcc: David N 
Bertoni/Cambridge/IBM)
                                               Subject: Re: parsing DOM tree: How to 
get  attribute values ( I don�t
                      03/24/2003 08:26         like mondays)           
                      AM                                               
                      Please respond                                   
                      to xerces-c-dev                                  
                                                                       



it works!!
finally, here is the proper code for the archive:

//
---------------------------------------------------------------------------
//   printAttributeValue
//
---------------------------------------------------------------------------
static void printAttributeValue(DOMNode *node, char *attributeName)
{
    const XMLCh *attrVal;
    char *chAttrVal;


    DOMElement *nodeElement = NULL;
    if (node)
    {
       nodeElement = static_cast<DOMElement*>(node);
       attrVal =
nodeElement->getAttribute(XMLString::transcode(attributeName));
       chAttrVal = XMLString::transcode(attrVal);
       std::cout << " attribute: " << chAttrVal << std::endl;
       delete [] chAttrVal;
    }

    return;

}  // printAttributeValue()


I was right with that:
 > In my opinion the first child of ElementLength
 > was the attribute min.





---------------------------------------------------------------------
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]

Reply via email to