Yes this is the function you would use to retreive attribute values and it
should look something like this.

cElement* poElementLength = poParent->getFirstChild(); // or something that
retrives the correct element
const char* pzMin =
XMLString::transcode(poElementLength->getAttribute("min"));
const char* pzMax =
XMLString::transcode(poElementLength->getAttribute("max"));
// use the values
delete pzMin;
delete pzMax;

Regards

Erik Rydgren
Mandarinen systems AB
Sweden

-----Original Message-----
From: Andreas B. Thun [mailto:[EMAIL PROTECTED]
Sent: den 24 mars 2003 10:56
To: [EMAIL PROTECTED]
Subject: parsing DOM tree: How to get attribute values


Hi,

I want to get attribute values of "min" and "max" (see below)
and found this code: Is this the proper sulution for me?

const XMLCh * DOMElementImpl::getAttribute(const XMLCh *nam) const
{
     static const XMLCh emptyString[]  = {0};
     DOMNode * attr=0;

     attr=fAttributes->getNamedItem(nam);

     if (!attr && fAttributes->hasDefaults())
       attr=fDefaultAttributes->getNamedItem(nam);

     const XMLCh *retString = emptyString;
     if (attr != 0)
         retString = attr->getNodeValue();

     return retString;
};


XML:
----
<ElementLength min="2" max="2"/>


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