Пример #1
0
func QueryParser(query string) (osm.Parser, error) {
	o := New()
	err := o.Query(query)
	if err != nil {
		return nil, err
	}

	if o.Type == osm.FmtXML {
		return xml.ByteParser(o.Data), nil
	}

	return nil, errors.New("Unknown Content-Type")
}
Пример #2
0
func QueryParser(query string) (osm.Parser, error) {
	o := New()
	err := o.Query(query)
	if err != nil {
		return nil, err
	}
	switch o.Type {
	case osm.FmtXML:
		return xml.ByteParser(o.Data), nil
	case osm.FmtOverpassJSON:
		return nil, errors.New("Cannot parse JSON yet")
	default:
		return nil, errors.New("Unknown Content-Type")
	}
}