In what country XXX is located?
Rio de Janeiro
The city remained primarily a colonial capital until 1808, when the Portuguese royal family and most of the associated Lisbon nobles, fleeing from Napoleon's invasion of Portugal, moved to Rio de Janeiro.