XPathParser { protected String parseNCName( TokenStream tokens ) { String name = tokens.consume(); if (!XmlCharacters.isValidNcName(name)) { throw new ParsingException(tokens.previousPosition(), "Expected valid NCName but found " + name); } return name; } XPathParser( TypeSystem context ); Component parseXPath( String xpath );  }
@Test( expected = ParsingException.class ) public void shouldFailToParseQNameIfStartsWithDigit() { parser.parseNCName(tokenize("3ABC:def")); }
@Test public void shouldParseNCName() { assertThat(parser.parseNCName(tokenize("ABCDEFGHIJKLMNOPQRSTUVWXYZ")), is("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); assertThat(parser.parseNCName(tokenize("abcdefghijklmnopqrstuvwxyz")), is("abcdefghijklmnopqrstuvwxyz")); assertThat(parser.parseNCName(tokenize("a0123456789")), is("a0123456789")); assertThat(parser.parseNCName(tokenize("a_-3b")), is("a_-3b")); assertThat(parser.parseNCName(tokenize("abc:def")), is("abc")); }
@Test( expected = ParsingException.class ) public void shouldFailToParseNCNameIfStartsWithDigit() { parser.parseNCName(tokenize("3ABC")); }