Added depth corectness to xml parsing