def fromFile(file_or_filename, ensure_is_plistable=False): """Reads a amanzi-xml hierarchy from a file or file handle""" elem = etree.parse(file_or_filename) if ensure_is_plistable: return parser.fromElement(elem.getroot()) else: try: return parser.fromElement(elem.getroot()) except: if ensure_is_plistable: raise errors.NotNativeSpecError() else: return elem.getroot()
def fromFile(file_or_filename): """Reads a amanzi-xml hierarchy from a file or file handle""" elem = etree.parse(file_or_filename) try: return parser.fromElement(elem.getroot()) except: return elem.getroot()
def fromString(string): """Reads a amanzi-xml hierarchy from a string""" elem = etree.fromstring(string) return parser.fromElement(elem)