A port of php-xmldocument