Assuming you're working with a DOM, you can use 
DOMElement::getElementsByTagName().  It will return a list that includes any 
descendant elements with the specified name.


-----Original Message-----
From: Nicolas Tsokas [mailto:[EMAIL PROTECTED]
Sent: Fri 1/25/2008 6:06 AM
To: [email protected]
Subject: Element's descendant with name...?
 
Hello all,

 

I'm trying to figure if a certain element <myelement> has any (at least one)
descendant with name <mydescendant>. 

 

For example:

 

<myelement>

            <mychildelement/>

            <myotherchildelement/>

            <mydescparent>

                        <mydescendant/>

            </mydescparent>

</myelement>

 

. would yield TRUE for <myelement>.

                        

If there is no such method, I could take the XML text (the portion of the
XML document) corresponding to <myelement> and then look for a regular
expression like "<mydescendant[ >]" (where brackets include a SPACE and a
GREATER_THAN sign).

 

.but I can't figure out how I can get the XML text either.

 

Somebody can help?

 

Thank you

 

Nicolas Tsokas, National Hellenic Research Foundation

 


<<winmail.dat>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to