Skip to content

Add support for reading and writing standalone Entry values. - #97

Open
mdorman wants to merge 2 commits into
rust-syndication:masterfrom
jaunder-org:standalone-entry
Open

Add support for reading and writing standalone Entry values.#97
mdorman wants to merge 2 commits into
rust-syndication:masterfrom
jaunder-org:standalone-entry

Conversation

@mdorman

@mdorman mdorman commented Jul 28, 2026

Copy link
Copy Markdown

When implementing AtomPub support, one needs the ability to read and write Entry values outside of a Feed context. The API intentionally apes the API for Feed values.

Because Entry values must now be emitted with (standalone) and without (feed) namespace declarations, the actual writing of the values is moved from the ToXml implementation into a private to_xml_inner() function with an additional parameter to govern the namespace decl.

Tests:

  • Read standalone entries from a file and a string
  • Make sure non- documents are rejected
  • Make sure EOF is appropriate handled
  • Write a standalone entry
  • Make sure xmlns isn't emitted on an entry in a feed

When implementing AtomPub support, one needs the ability to read and
write `Entry` values outside of a `Feed` context.  The API
intentionally apes the API for `Feed` values.

Because `Entry` values must now be emitted with (standalone) and
without (feed) namespace declarations, the actual writing of the
values is moved from the `ToXml` implementation into a private
`to_xml_inner()` function with an additional parameter to govern the
namespace decl.

Tests:
 - Read standalone entries from a file and a string
 - Make sure non-<entry> documents are rejected
 - Make sure EOF is appropriate handled
 - Write a standalone entry
 - Make sure `xmlns` isn't emitted on an entry in a feed
@mdorman
mdorman marked this pull request as draft July 28, 2026 18:51
@mdorman

mdorman commented Jul 28, 2026

Copy link
Copy Markdown
Author

I just realized that my implementation was too naive: it doesn't properly track the namespaces, which renders the extensions values kinda useless. Fixing it, moved this to draft for the moment.

I missed this detail before: since an `Entry` can now have its own
namespace declarations, we have to track them.  We use the same
approach as for `Feed` values.

Tests:
 - Make sure a namespace is parsed
 - Make sure a namespace is emitted
@mdorman
mdorman marked this pull request as ready for review July 28, 2026 19:03
@mdorman

mdorman commented Jul 28, 2026

Copy link
Copy Markdown
Author

Fixed the namespace issue, everything should be golden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant