Skip to content

Compiler looses name of entity references in XML attribute values #5133

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
scabug opened this issue Nov 1, 2011 · 3 comments
Closed

Compiler looses name of entity references in XML attribute values #5133

scabug opened this issue Nov 1, 2011 · 3 comments

Comments

@scabug
Copy link

scabug commented Nov 1, 2011

The name of the entity ("oacute" in this example) is lost:

scala> <input value="Adi&oacute;s" />
res0: scala.xml.Elem = <input value="Adi&;s"></input>

scala> <input value="Adi&oacute;s" />.attributes.value(1).asInstanceOf[scala.xml.EntityRef].text
res1: String = &;

Note this is different from behaviour in Element content:

scala> <p>Adi&oacute;s</p>.child(1).asInstanceOf[scala.xml.EntityRef].text
res2: String = &oacute;
@scabug
Copy link
Author

scabug commented Nov 1, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5133?orig=1
Reporter: @jsalvata
Affected Versions: 2.9.0-1

@scabug
Copy link
Author

scabug commented Nov 2, 2011

@jsalvata said:
I've just noticed that such entity references, while legal in XML, are not acceptable in Scala according to the Scala Language Specification 2.9 (24 may 2011): section 10.1 of the SLR, unlike the XML specification, defines AttValue to include characters and character references, but not entity references.

If the SLR is considered correct, the expected result of the code above would be a compilation error. But then there would be no reason for an attribute value to be a NodeSeq -- a simple String would do, just like in SAX2. So I believe it is actually a documentation bug.

@scabug
Copy link
Author

scabug commented Jul 17, 2015

@SethTisue said:
The scala-xml library is now community-maintained. Issues with it are now tracked at https://github.com/scala/scala-xml/issues instead of here in the Scala JIRA.

Interested community members: if you consider this issue significant, feel free to open a new issue for it on GitHub, with links in both directions.

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

No branches or pull requests

1 participant