Skip to content

Commit 9b65348

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 007ea4a commit 9b65348

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
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-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ package scala.xml
22

33
import org.junit.Test
44
import org.junit.Assert.assertTrue
5-
import org.junit.Assert.assertFalse
65
import org.junit.Assert.assertEquals
76

87
class UtilityTest {
98

109
@Test
1110
def isNameStart: Unit = {
1211
assertTrue(Utility.isNameStart('b'))
13-
assertFalse(Utility.isNameStart(':'))
12+
assertTrue(Utility.isNameStart(':'))
1413
}
1514

1615
@Test

0 commit comments

Comments
 (0)