Skip to content

Xml.serialize stripComments parameter doesn't work #183

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

Closed
olafos opened this issue Jan 29, 2018 · 2 comments
Closed

Xml.serialize stripComments parameter doesn't work #183

olafos opened this issue Jan 29, 2018 · 2 comments

Comments

@olafos
Copy link
Contributor

olafos commented Jan 29, 2018

stripComments parameter in Utility.serialize is ignored due to unfortunate pattern matching expression:

      x match {
        case c: Comment if !stripComments => c buildString sb
        case s: SpecialNode               => s buildString sb
      ...

since Comment is also a SpecialNode the second pattern is applied after the first one doesn't match.

olafos pushed a commit to olafos/scala-xml that referenced this issue Jan 29, 2018
@ashawley
Copy link
Member

Indeed. This defect was introduced in 7662284 on Mar-08-2012, which references scala/bug#1118. That bug was about empty XML elements. So it seems there was some incidental refactoring done while fixing the bug that introduced the bug or it may have been reverting 8f433bc, that had it right, but I can't tell.

olafos added a commit to olafos/scala-xml that referenced this issue Jan 29, 2018
ashawley added a commit that referenced this issue Jan 29, 2018
@ashawley
Copy link
Member

Fixed in #184

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