Hi Rodolfo,
I'd suggest you to create a resulting XML structured with the proper hierarchy of the involved tables. This way your component acts consistently returning the XML string in one of the ways XML is intended to be used: demonstrating hierarchy.
The client side would be responsable for interpreting the resulting XML (probably through a parser). This approach makes your component "useful" for any client which is implemented in an XML-aware language/platform (nowadays virtually any).
HTH!