diff --git a/app/src/main/java/run/halo/feed/RssXmlBuilder.java b/app/src/main/java/run/halo/feed/RssXmlBuilder.java index f555634..5305b5e 100644 --- a/app/src/main/java/run/halo/feed/RssXmlBuilder.java +++ b/app/src/main/java/run/halo/feed/RssXmlBuilder.java @@ -64,6 +64,7 @@ public String toXmlString() { Element root = DocumentHelper.createElement("rss"); root.addAttribute("version", "2.0"); + root.addNamespace("dc", "http://purl.org/dc/elements/1.1/"); root.addNamespace("media", "http://search.yahoo.com/mrss/"); document.setRootElement(root); @@ -167,7 +168,9 @@ private void createItemElementToChannel(Element channel, RSS2.Item item) { .addText(item.getGuid()); if (StringUtils.isNotBlank(item.getAuthor())) { - itemElement.addElement("author").addText(item.getAuthor()); + // https://www.rssboard.org/rss-validator/docs/error/InvalidContact.html + itemElement.addElement("dc:creator") + .addText(item.getAuthor()); } if (StringUtils.isNotBlank(item.getEnclosureUrl())) { diff --git a/app/src/test/java/run/halo/feed/RSS2Test.java b/app/src/test/java/run/halo/feed/RSS2Test.java index 34271d5..80cb37d 100644 --- a/app/src/test/java/run/halo/feed/RSS2Test.java +++ b/app/src/test/java/run/halo/feed/RSS2Test.java @@ -45,7 +45,8 @@ void toXmlString() { // language=xml var expected = """ - + title link @@ -109,7 +110,7 @@ void extractRssTagsTest() { // language=xml var expected = """ - title @@ -161,7 +162,8 @@ void invalidCharTest() { // language=xml var expected = """ - + title link