Has_and_belongs_to_many into XML transformation

I have two models: articles and categories with
has_and_belongs_to_many(habtm) relation between them. Now I need to
return answer on the GET request to the url like /article/1.xml. I
need to return the information about article + information about all
categories linked with this article. I have used to_xml method before
but it seems like there no habtm support in it. Does anybody knows how
to make this correctly?