Made the parser more robust by allowing to declare contents in any order inside an XML node.
Reordered function parameters to make the code easier to read.