-
Notifications
You must be signed in to change notification settings - Fork 716
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor RSS parser to use default namespace
This change avoid some limitations of the Go XML parser regarding XML namespaces
- Loading branch information
Showing
6 changed files
with
185 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package rss // import "miniflux.app/v2/internal/reader/rss" | ||
|
||
import "strings" | ||
|
||
type AtomAuthor struct { | ||
Author AtomPerson `xml:"http://www.w3.org/2005/Atom author"` | ||
} | ||
|
||
func (a *AtomAuthor) String() string { | ||
return a.Author.String() | ||
} | ||
|
||
type AtomPerson struct { | ||
Name string `xml:"name"` | ||
Email string `xml:"email"` | ||
} | ||
|
||
func (a *AtomPerson) String() string { | ||
var name string | ||
|
||
switch { | ||
case a.Name != "": | ||
name = a.Name | ||
case a.Email != "": | ||
name = a.Email | ||
} | ||
|
||
return strings.TrimSpace(name) | ||
} | ||
|
||
type AtomLink struct { | ||
URL string `xml:"href,attr"` | ||
Type string `xml:"type,attr"` | ||
Rel string `xml:"rel,attr"` | ||
Length string `xml:"length,attr"` | ||
} | ||
|
||
type AtomLinks struct { | ||
Links []*AtomLink `xml:"http://www.w3.org/2005/Atom link"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.