func (ns *Namespace) MarshalText() ([]byte, error) {
	if ns == nil || len(ns.uriToPrefix) == 0 {
		return nil, nil
	}
	uris := make([]string, 0, len(ns.uriToPrefix))
	dataLen := 0
	for uri, prefix := range ns.uriToPrefix {
		uris = append(uris, uri)
		dataLen += len(uri) + 1 + len(prefix) + 1
	}
	sort.Strings(uris)
	data := make([]byte, 0, dataLen)
	for i, uri := range uris {
		if i > 0 {
			data = append(data, ' ')
		}
		data = append(data, uri...)
		data = append(data, ':')
		data = append(data, ns.uriToPrefix[uri]...)
	}
	return data, nil
}
// MarshalText implements encoding.TextMarshaler by
// returning all the elements in the namespace sorted by
// URI, joined to the associated prefix with a colon and
// separated with spaces.
MarshalText implements encoding.TextMarshaler by
returning all the elements in the namespace sorted by
URI, joined to the associated prefix with a colon and
separated with spaces.
// MarshalText implements encoding . TextMarshaler by // returning all the elements in the namespace sorted by // URI joined to the associated prefix with a colon and // separated with spaces .
func (ns *Namespace) MarshalText() ([]byte, error) {
	if ns == nil || len(ns.uriToPrefix) == 0 {
		return nil, nil
	}
	uris := make([]string, 0, len(ns.uriToPrefix))
	dataLen := 0
	for uri, prefix := range ns.uriToPrefix {
		uris = append(uris, uri)
		dataLen += len(uri) + 1 + len(prefix) + 1
	}
	sort.Strings(uris)
	data := make([]byte, 0, dataLen)
	for i, uri := range uris {
		if i > 0 {
			data = append(data, ' ')
		}
		data = append(data, uri...)
		data = append(data, ':')
		data = append(data, ns.uriToPrefix[uri]...)
	}
	return data, nil
}
func ( ns * Namespace ) MarshalText ( ) ( [ ] byte , error ) { if ns == nil || len ( ns . uriToPrefix ) == 0 { return nil , nil } uris := make ( [ ] string , 0 , len ( ns . uriToPrefix ) ) dataLen := 0 for uri , prefix := range ns . uriToPrefix { uris = append ( uris , uri ) dataLen += len ( uri ) + 1 + len ( prefix ) + 1 } sort . Strings ( uris ) data := make ( [ ] byte , 0 , dataLen ) for i , uri := range uris { if i > 0 { data = append ( data , ' ' ) } data = append ( data , uri ... ) data = append ( data , ':' ) data = append ( data , ns . uriToPrefix [ uri ] ... ) } return data , nil }
MarshalText implements encoding.TextMarshaler by
returning all the elements in the namespace sorted by
URI, joined to the associated prefix with a colon and
separated with spaces.
MarshalText implements encoding . TextMarshaler by returning all the elements in the namespace sorted by URI joined to the associated prefix with a colon and separated with spaces .