示例#1
0
文件: io.py 项目: sebnaran/amanzi
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()
示例#2
0
文件: io.py 项目: smolins/amanzi
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()
示例#3
0
文件: io.py 项目: sebnaran/amanzi
def fromString(string):
    """Reads a amanzi-xml hierarchy from a string"""
    elem = etree.fromstring(string)
    return parser.fromElement(elem)