-
Notifications
You must be signed in to change notification settings - Fork 29
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
Escape end of line characters based on 'XML End-Of-Line Encoding' SEP. #349
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,15 @@ class XmlPullSerializer(pretty: Boolean, private val serializer: XmlSerializer = | |
} | ||
|
||
override fun text(text: String): XmlStreamWriter { | ||
serializer.text(text) | ||
text.forEach { character -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure sounds good. I sort of figured as much |
||
when (character) { | ||
'\n' -> serializer.entityRef("#xA") | ||
'\r' -> serializer.entityRef("#xD") | ||
'\u0085' -> serializer.entityRef("#x85") | ||
'\u2028' -> serializer.entityRef("#x2028") | ||
else -> serializer.text(character.toString()) | ||
} | ||
} | ||
return this | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment
or you could just write your own quick loop, something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's better I'll update before push.