Lib: parse xml into internal structures