Properly use xml names
This commit is contained in:
parent
26e0c99150
commit
9c38048bd2
@ -1,12 +1,14 @@
|
||||
package atom
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"html"
|
||||
)
|
||||
|
||||
type Category struct {
|
||||
XMLName xml.Name `xml:"category"`
|
||||
*CommonAttributes
|
||||
Term string `xml:"term,attr"`
|
||||
Scheme IRI `xml:"scheme,attr,omitempty"`
|
||||
|
16
entry.go
16
entry.go
@ -1,6 +1,7 @@
|
||||
package atom
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
@ -12,16 +13,17 @@ import (
|
||||
// a non-empty atom:summary element when the entry contains no atom:content
|
||||
// element.
|
||||
type Entry struct {
|
||||
XMLName xml.Name `xml:"entry"`
|
||||
*CommonAttributes
|
||||
Authors []*Person `xml:"author,omitempty"`
|
||||
Categories []*Category `xml:"category,omitempty"`
|
||||
Content Content `xml:"content,omitempty"`
|
||||
Contributors []*Person `xml:"contributors,omitempty"`
|
||||
ID *ID `xml:"id"`
|
||||
Links []*Link `xml:"link,omitempty"`
|
||||
Authors []*Person `xml:"author,omitempty"`
|
||||
Categories []*Category `xml:",omitempty"`
|
||||
Content Content `xml:",omitempty"`
|
||||
Contributors []*Person `xml:"contributors,omitempty"`
|
||||
ID *ID
|
||||
Links []*Link `xml:",omitempty"`
|
||||
Published *Date `xml:"published,omitempty"`
|
||||
Rights Text `xml:"rights,omitempty"`
|
||||
Source *Source `xml:"source,omitempty"`
|
||||
Source *Source `xml:",omitempty"`
|
||||
Summary Text `xml:"summary,omitempty"`
|
||||
Title Text `xml:"title"`
|
||||
Updated *Date `xml:"updated"`
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
// TODO: Is this really correct?
|
||||
type ExtensionAttribute struct {
|
||||
Value any `xml:",attr"`
|
||||
XMLName xml.Name
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
// TODO: Is this really correct?
|
||||
type ExtensionElement struct {
|
||||
Value any `xml:",innerxml"`
|
||||
XMLName xml.Name
|
||||
|
18
feed.go
18
feed.go
@ -10,20 +10,20 @@ import (
|
||||
type Feed struct {
|
||||
XMLName xml.Name `xml:"http://www.w3.org/2005/Atom feed"`
|
||||
*CommonAttributes
|
||||
Authors []*Person `xml:"author,omitempty"`
|
||||
Categories []*Category `xml:"category,omitempty"`
|
||||
Contributors []*Person `xml:"contributor,omitempty"`
|
||||
Generator *Generator `xml:"generator,omitempty"`
|
||||
Icon *Icon `xml:"icon,omitempty"`
|
||||
ID *ID `xml:"id"`
|
||||
Links []*Link `xml:"link,omitempty"`
|
||||
Logo *Logo `xml:"logo,omitempty"`
|
||||
Authors []*Person `xml:"author,omitempty"`
|
||||
Categories []*Category `xml:",omitempty"`
|
||||
Contributors []*Person `xml:"contributor,omitempty"`
|
||||
Generator *Generator `xml:",omitempty"`
|
||||
Icon *Icon `xml:",omitempty"`
|
||||
ID *ID
|
||||
Links []*Link `xml:",omitempty"`
|
||||
Logo *Logo `xml:",omitempty"`
|
||||
Rights Text `xml:"rights,omitempty"`
|
||||
Subtitle Text `xml:"subtitle,omitempty"`
|
||||
Title Text `xml:"title"`
|
||||
Updated *Date `xml:"updated"`
|
||||
Extensions []*ExtensionElement `xml:",any,omitempty"`
|
||||
Entries []*Entry `xml:"entry,omitempty"`
|
||||
Entries []*Entry `xml:",omitempty"`
|
||||
}
|
||||
|
||||
// NewFeed creates a new Feed. It returns a *Feed and an error.
|
||||
|
@ -1,12 +1,14 @@
|
||||
package atom
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"html"
|
||||
)
|
||||
|
||||
type Generator struct {
|
||||
XMLName xml.Name `xml:"generator"`
|
||||
*CommonAttributes
|
||||
URI IRI `xml:"uri,attr,omitempty"`
|
||||
Version string `xml:"version,attr,omitempty"`
|
||||
|
2
icon.go
2
icon.go
@ -1,11 +1,13 @@
|
||||
package atom
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Icon struct {
|
||||
XMLName xml.Name `xml:"icon"`
|
||||
*CommonAttributes
|
||||
URI IRI `xml:",chardata"`
|
||||
}
|
||||
|
2
id.go
2
id.go
@ -1,11 +1,13 @@
|
||||
package atom
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type ID struct {
|
||||
XMLName xml.Name `xml:"id"`
|
||||
*CommonAttributes
|
||||
URI IRI `xml:",chardata"`
|
||||
}
|
||||
|
@ -1,12 +1,14 @@
|
||||
package atom
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"mime"
|
||||
)
|
||||
|
||||
type InlineOtherContent struct {
|
||||
XMLName xml.Name `xml:"content"`
|
||||
*CommonAttributes
|
||||
AnyElement any `xml:",chardata"`
|
||||
Type MediaType `xml:"type,attr,omitempty"`
|
||||
|
@ -1,11 +1,13 @@
|
||||
package atom
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type InlineTextContent struct {
|
||||
XMLName xml.Name `xml:"content"`
|
||||
*CommonAttributes
|
||||
Type string `xml:"type,attr,omitempty"` // Must be text or html
|
||||
Text string `xml:",chardata"`
|
||||
|
@ -1,11 +1,13 @@
|
||||
package atom
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type InlineXHTMLContent struct {
|
||||
XMLName xml.Name `xml:"content"`
|
||||
*CommonAttributes
|
||||
XHTMLDiv *XHTMLDiv
|
||||
Type string `xml:"type,attr"`
|
||||
|
2
link.go
2
link.go
@ -1,12 +1,14 @@
|
||||
package atom
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Link struct {
|
||||
XMLName xml.Name `xml:"link"`
|
||||
*CommonAttributes
|
||||
Title string `xml:"title,attr,omitempty"`
|
||||
Href IRI `xml:"href,attr"`
|
||||
|
2
logo.go
2
logo.go
@ -1,11 +1,13 @@
|
||||
package atom
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Logo struct {
|
||||
XMLName xml.Name `xml:"logo"`
|
||||
*CommonAttributes
|
||||
URI IRI `xml:",chardata"`
|
||||
}
|
||||
|
@ -1,12 +1,14 @@
|
||||
package atom
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"mime"
|
||||
)
|
||||
|
||||
type OutOfLineContent struct {
|
||||
XMLName xml.Name `xml:"content"`
|
||||
*CommonAttributes
|
||||
Type MediaType `xml:"type,attr,omitempty"`
|
||||
SRC IRI `xml:"src,attr"`
|
||||
|
18
source.go
18
source.go
@ -1,17 +1,21 @@
|
||||
package atom
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Source struct {
|
||||
XMLName xml.Name `xml:"source"`
|
||||
*CommonAttributes
|
||||
Authors []*Person `xml:"author,omitempty"`
|
||||
Categories []*Category `xml:"category,omitempty"`
|
||||
Categories []*Category `xml:",omitempty"`
|
||||
Contributors []*Person `xml:"contributor,omitempty"`
|
||||
Generator *Generator `xml:"generator,omitempty"`
|
||||
Icon *Icon `xml:"icon,omitempty"`
|
||||
ID *ID `xml:"id,omitempty"`
|
||||
Links []*Link `xml:"link,omitempty"`
|
||||
Logo *Logo `xml:"logo,omitempty"`
|
||||
Generator *Generator `xml:",omitempty"`
|
||||
Icon *Icon `xml:",omitempty"`
|
||||
ID *ID `xml:",omitempty"`
|
||||
Links []*Link `xml:",omitempty"`
|
||||
Logo *Logo `xml:",omitempty"`
|
||||
Rights Text `xml:"rights,omitempty"`
|
||||
Subtitle Text `xml:"subtitle,omitempty"`
|
||||
Title Text `xml:"title,omitempty"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user