Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples should cover XML writing more thoroughly #686

Open
dralley opened this issue Nov 22, 2023 · 1 comment
Open

Examples should cover XML writing more thoroughly #686

dralley opened this issue Nov 22, 2023 · 1 comment

Comments

@dralley
Copy link
Collaborator

dralley commented Nov 22, 2023

Currently we have many examples of XML reading, and nothing for XML writing.

@Mingun
Copy link
Collaborator

Mingun commented Nov 22, 2023

I started to write some docstring examples (well, almost couple of years ago), but realized, that we should fix our constructors. Currently we trust to users that the strings passed to constructors (for PI, CData, or Comment in particular) does not contain end sequences. We should instead:

  • wrap data only up to ?> for PI and return error. If user is fine with that it can use returned event;
  • wrap data only up to --> for Comment and return error. If user is fine with that it can use returned event;
  • construct an iterator over CData content if we find ]]> in the data:
    impl BytesCData {
      // abcd]]>efgh => "abcd]]" + ">efgh"
      pub fn new(content: &str) -> impl Iterator<Item = Self> { ... }
    }

That is one reason why I want to split reader events from writer events

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

No branches or pull requests

2 participants