-
Notifications
You must be signed in to change notification settings - Fork 231
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
Writer: Add ability to separate attributes by newlines #275
Comments
I want to help here/implement this. Please give any tips @Mingun, especially for the interface/API you'd like for this:
Why I want thisTo store XML files in git, it would be nice to have a fast, reliable, one-way git-filter that gets applied to all XML based files (especially interesting for SVGs, to me), to a very stable, fixed standard, applied by everyone (in a project/repo). |
... thinking about it .... How confident would you be about quick-xml in such a scenario? |
I can't imagine which API will be convenient without using it. Probably we should start from adding methods to writer
.create_element("element")
//.new_line() (1)
.with_attribute("first", "1")
.with_attribute("second", "2")
.new_line()
.with_attribute("third", "3")
//.new_line() (2)
.write_empty(); <!-- result of the code above -->
<element first="1" second="2"
third="3"/>
<!-- if uncomment (1) - indent depends on indentation settings - 2 spaces here -->
<element
first="1" second="2"
third="3"/>
<!-- if uncomment (2) -->
<element first="1" second="2"
third="3"
/>
Personally, I've never use it for writing XML documents, all my needs in reading them. There are also not so much tests for writing capabilities, so some bugs can exist. Improving our testsuite and fixing them are welcome. From the other hand writing is much more simply then reading, so the probability of bugs is reduced. |
What about setting a property on the |
That is also possible solution, in addition to manual control. I think, it can be implemented in the follow-up PR. |
First attempt to add newlines between attributes. (#275)
I can control indentation now on tags, but individual tags and their attributes all appear on one line. As I need to make pretty XML, I need this level of control. As tags are rendered in one, I don't think I can achieve this by writing to the inner writer.
The text was updated successfully, but these errors were encountered: