I'm not sure about this but following code will help u out
// temp is the pointer to ElementLength element in your xml. So if it not a
very first elemnt //trace down till the lement whose attribute u want to get
/*here with this code if u will print the value of temp by usin
DOMNode *temp = element->getFirstChild()->getNextSibling();
temp->getNodeValue()
it will give u "ElementLength "
*/
DOMElement *element = doc->getDocumentElement();
DOMElement *temp = (DOMElement *)element->getFirstChild()->getNextSibling();
const XMLCh * attribValMin =
temp->getAttribute(XMLString::transcode("min"));
const XMLCh * attribValMax =
temp->getAttribute(XMLString::transcode("max"));
char * szAttribValueMin = XMLString::transcode(attribValMin);
char * szAttribValueMax = XMLString::transcode(attribValMax);
Thanx
//Parul
-----Original Message-----
From: Andreas B. Thun [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2003 3:26 PM
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]