Skip to content

Commit 6af8f0a

Browse files
committed
Allow a colon to start a name
* jvm/src/main/scala/scala/xml/parsing/TokenTests.scala (isNameChar): Add middle dot. * jvm/src/main/scala/scala/xml/parsing/TokenTests.scala (isNameStart): Allow colon to start a name. * jvm/src/test/scala/scala/xml/UtilityTest.scala (isNameStart): Colon should be able to start a name.
1 parent ce156c0 commit 6af8f0a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: shared/src/main/scala/scala/xml/parsing/TokenTests.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ trait TokenTests {
5656

5757
/**
5858
* {{{
59-
* NameStart ::= ( Letter | '_' )
59+
* NameStart ::= ( Letter | '_' | ':' )
6060
* }}}
6161
* where Letter means in one of the Unicode general
6262
* categories `{ Ll, Lu, Lo, Lt, Nl }`.
6363
*
6464
* We do not allow a name to start with `:`.
65-
* See [3] and Appendix B of XML 1.0 specification
65+
* See [4] and Appendix B of XML 1.0 specification
6666
*/
6767
def isNameStart(ch: Char) = {
6868
import java.lang.Character._
@@ -71,7 +71,7 @@ trait TokenTests {
7171
case LOWERCASE_LETTER |
7272
UPPERCASE_LETTER | OTHER_LETTER |
7373
TITLECASE_LETTER | LETTER_NUMBER => true
74-
case _ => ch == '_'
74+
case _ => ":_".contains(ch)
7575
}
7676
}
7777

Diff for: shared/src/test/scala/scala/xml/UtilityTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class UtilityTest {
1313
@Test
1414
def isNameStart: Unit = {
1515
assertTrue(Utility.isNameStart('b'))
16-
assertFalse(Utility.isNameStart(':'))
16+
assertTrue(Utility.isNameStart(':'))
1717
}
1818

1919
@Test

0 commit comments

Comments
 (0)