Wow, thanks for the quick response. I have one more question brewing about adding values across elements. I will post it soon..:)
anyways thanks again for the help. Will try this! --- In flexcoders@yahoogroups.com, "Geoffrey Williams" <[EMAIL PROTECTED]> wrote: > > Here you go: > > var employees:XML = > <employees> > <employee name="joe mark"> > <department id="id1"/> > <address city="miami" state="florida"/> > </employee> > <employee name="joe mark"> > <address city="san francisco" state="california"/> > </employee> > <employee name="mary dooley"> > <department id="id1"/> > <address city="los angeles" state="california"/> > </employee> > </employees>; > trace (employees.employee.(child ("department")[EMAIL PROTECTED] == "id1")); > > --- In flexcoders@yahoogroups.com, "coder_flex" <coder_flex@> > wrote: > > > > I have an xml document of the form > > <employees> > > <employee name="joe mark"> > > <department id="id1"/> > > <address city="miami" state="florida"/> > > </employee> > > <employee name="joe mark"> > > <address city="san francisco" state="california"/> > > </employee> > > <employee name="mary dooley"> > > <department id="id1"/> > > <address city="los angeles" state="california"/> > > </employee> > > > > </employees> > > > > Note here that the second employee record doesnt have department > > element at all. This is just a sample and my original xml is a web > > service response with some of the child elements missing for some > > elements. I want to filter the parent element on the child elements > > which may or may not be present using an e4x expression. The e4x > > expression of the form: > > > > employeesByDept:XMLList = employees.employee.([EMAIL PROTECTED] > == "id1"); > > > > fails saying department element not found. If the department > element > > is found for all the employees the above statement goes through. > > > > Whats the work-around for this? I thought its fairly common to have > > child elements/attributes missing within elements and e4x should > just > > ignore those. > > > > Thanks in advance for the response. > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Something is new at Yahoo! Groups. Check out the enhanced email design. http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/