little refactorings in document xml hierarchy and base_builder