package atom import ( "errors" "fmt" ) type ID struct { *CommonAttributes URI IRI `xml:"uri"` } // NewID creates a new ID. It returns a *ID. func NewID(id string) *ID { return &ID{URI: IRI(id)} } // Check checks the ID for incompatibilities with RFC4287. It returns an error. func (i *ID) Check() error { if i.URI == "" { return errors.New("uri element of id empty") } else { if !isValidIRI(i.URI) { return fmt.Errorf("uri element %v of id not correctly formatted", i.URI) } } return nil }