Xml finding if certain element has children

has anybody got some code maybe which searches through xml file and finds out if some xml element has children and pushes the content of those children in a array?
or something like that :smiley: