This is what I use to recursively remove all Attributes specific to a
Child name or whole XML.
If anyone got a faster way I'd be glad to learn.

--Keith H--

private function
findAndRemoveAttributeNames(xml:XML,find:String,in_tags_named:String=""):XML
{
        var ok:Boolean=true;
        if(in_tags_named != "" && xml.localName() != in_tags_named){
                ok=false;
        }
        if([EMAIL PROTECTED] != null && ok){            
                delete [EMAIL PROTECTED];
        }       
        var n:int=0;
        var c:XML;
        while(n < xml.children().length()){
                c=xml.children()[n];
                findAndRemoveAttributeNames(c,find);    
                n++;
        }
        return xml;
}




----- Original Message -----

> 
> I'm trying to find the most correct and efficient syntax to find nodes
> with a particular attribute value and remove them from an xml 
> document..
> 
> suppose my xml is :
> 
> <code>
> <response>
> <status-code>0</status-code>
> <status-message><![CDATA[ The call was successful ]]></status-message>
> <recipients>
> <recipient id="5" firstName="John"
> lastName="Smith">[EMAIL PROTECTED] <mailto:john%40blah.com> </recipient>
> <recipient id="6" firstName="firstName"
> lastName="lastName">[EMAIL PROTECTED] <mailto:chuck%40blah.com>
> </recipient>
> <recipient id="23" firstName="grant"
> lastName="davies">[EMAIL PROTECTED] <mailto:grant%40blue.com> 
> </recipient><recipient id="24" firstName="fool"
> lastName="me">[EMAIL PROTECTED] <mailto:grant%40fool.com> </recipient>
> <recipient id="25" firstName="frick"
> lastName="frack">[EMAIL PROTECTED] <mailto:frick%40fool.com> </recipient>
> <recipient id="26" firstName="grant"
> lastName="davees">[EMAIL PROTECTED] <mailto:firday%40nowhere.com>
> </recipient>
> </recipients>
> </response>
> </code>
> 
> And I want to find recipients with an id of 6 and 23 and remove them
> from the xml... What is the syntax for this?
> 
> I can find those nodes into an XMLList fine... Its removing them I'm
> having fun with..
> 
> Cheers,
> Grant
> 
> 
> 
> 
> 
> 
begin:vcard
n:HAIR;KEITH
fn:KEITH HAIR
version:2.1
email;internet:[EMAIL PROTECTED]
end:vcard

Reply via email to