Oh THAT! :) Just cast your DOMNode* to a DOMElement*. If you are paranoid then you can do a check that the node really is an element.
DOMElement poElement = NULL; if (poNode->getType() == ELEMENT_NODE) poElement = static_cast<DOMElement*>(poNode); Regards Erik Rydgren Mandarinen systems AB Sweden -----Original Message----- From: Andreas B. Thun [mailto:[EMAIL PROTECTED] Sent: den 24 mars 2003 12:10 To: [EMAIL PROTECTED] Subject: Re: parsing DOM tree: How to get attribute values Thx, Erik and Paul but ... how can I get the element? I selected the right node (ElementLength) but I cannot compile this because getAttribute is not a member of the DOMElement class. I tried getAttributeNode, but it doesn�t work, either... // ------------------------------------------------------------------------- -- // printAttributeValue // ------------------------------------------------------------------------- -- static void printAttributeValue(DOMNode *node, char *attributeName) { // doesn�t compile const char* pzMin = XMLString::transcode(node->getAttribute(attributeName)); return; } // printAttributeValue() main(): ... // scan children of <Type> for (typeChild = node->getFirstChild(); typeChild != 0; typeChild = typeChild->getNextSibling()) { if (typeChild->getNodeType() == DOMNode::ELEMENT_NODE) { // ElementLength if (XMLString::compareString(typeChild->getNodeName(), typeElementLengthStr) == 0) { printNodeName(typeChild); // prints "ElementLength" -> ok printAttributeValue(typeChild->getFirstChild(), "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]
