You can cast the DOM_Node to a DOM_Element. Simply perform the cast, like this:
... DOM_Node node = nodeList.item(i); DOM_Element elem = (const DOM_Element&)node; ... You may cast-off 'const-ness' if necessary... Kind of ugly, but it works. -----Original Message----- From: Gilles FILIPPINI [mailto:[EMAIL PROTECTED] Sent: Friday, February 18, 2000 7:55 AM To: xerces-dev Subject: Réf. : Re: [Xerces C++] Usage I had the idea about casting l1 to DOM_Element. Unfortunately, such an operation seems not to be allowed by the Xerces DOM C++ implementation. For example, with l1 being a DOM_Node, the statement : DOM_Element elt = l1; leads to the compilation error : Cannot use DOM_Node to initialize DOM_Element. I also tried : DOM_Element elt = DOM_Element(l1); to obtain : Cannot cast from DOM_Node to DOM_Element Any idea ? [EMAIL PROTECTED] sur 18/02/2000 12:35:00 Pour : Gilles FILIPPINI/SEPTEN/DE/EDFGDF/[EMAIL PROTECTED], [EMAIL PROTECTED]@hub cc : Objet : Re: [Xerces C++] Usage Hi Gilles, Casting l1 to DOM_Element would the best solution, as far as I know. What kind of error message to you get while doing it? Did you remember to call getChildNodes() on every Level2 item to access the element values? Regards, Markus ---- snip ---- I know how to process each "Level1" element : void MyClass::ProcessDocument(DOM_Document doc) { DOM_NodeList dnl = doc.getElementsByTagName("Level1"); for (unsigned int i = 0; i < dnl.getLength(); i++) { ProcessLevel1Element(dnl.item(i)); } } But then, I don't know how to do to process "Level2" elements : void MyClass::ProcessLevel1Element(DOM_Node l1) { // I'd like to cast l1 into a DOM_Element to be able // to use getElementsByTagName("Level2") but it seems // impossible... } Did I miss a point ? Thanks in advance. - Gilles.