本文整理了Java中org.modeshape.common.xml.XmlCharacters.isValidNcNameStart()
方法的一些代码示例,展示了XmlCharacters.isValidNcNameStart()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlCharacters.isValidNcNameStart()
方法的具体详情如下:
包路径:org.modeshape.common.xml.XmlCharacters
类名称:XmlCharacters
方法名:isValidNcNameStart
[英]Determine whether the supplied character is a valid first character in an XML NCName. The first character in an XML NCName is more restrictive than the #isValidName(int).
[中]确定提供的字符是否是XML名称中的有效第一个字符。XML NCName中的第一个字符比#isValidName(int)更具限制性。
代码示例来源:origin: org.fcrepo/modeshape-common
/**
* Determine if the supplied name is a valid XML NCName.
*
* @param name the string being checked
* @return true if the supplied name is indeed a valid XML NCName, or false otherwise
*/
public static boolean isValidNcName( String name ) {
if (name == null || name.length() == 0) return false;
CharacterIterator iter = new StringCharacterIterator(name);
char c = iter.first();
if (!isValidNcNameStart(c)) return false;
while (c != CharacterIterator.DONE) {
if (!isValidNcName(c)) return false;
c = iter.next();
}
return true;
}
}
代码示例来源:origin: org.modeshape/modeshape-common
/**
* Determine if the supplied name is a valid XML NCName.
*
* @param name the string being checked
* @return true if the supplied name is indeed a valid XML NCName, or false otherwise
*/
public static boolean isValidNcName( String name ) {
if (name == null || name.length() == 0) return false;
CharacterIterator iter = new StringCharacterIterator(name);
char c = iter.first();
if (!isValidNcNameStart(c)) return false;
while (c != CharacterIterator.DONE) {
if (!isValidNcName(c)) return false;
c = iter.next();
}
return true;
}
}
代码示例来源:origin: ModeShape/modeshape
/**
* Determine if the supplied name is a valid XML NCName.
*
* @param name the string being checked
* @return true if the supplied name is indeed a valid XML NCName, or false otherwise
*/
public static boolean isValidNcName( String name ) {
if (name == null || name.length() == 0) return false;
CharacterIterator iter = new StringCharacterIterator(name);
char c = iter.first();
if (!isValidNcNameStart(c)) return false;
while (c != CharacterIterator.DONE) {
if (!isValidNcName(c)) return false;
c = iter.next();
}
return true;
}
}
代码示例来源:origin: ModeShape/modeshape
@Test
public void shouldNotAllowDigitAsFirstCharacterInNcName() {
assertThat(XmlCharacters.isValidNcNameStart('0'), is(false));
assertThat(XmlCharacters.isValidNcNameStart('1'), is(false));
assertThat(XmlCharacters.isValidNcNameStart('2'), is(false));
assertThat(XmlCharacters.isValidNcNameStart('3'), is(false));
assertThat(XmlCharacters.isValidNcNameStart('4'), is(false));
assertThat(XmlCharacters.isValidNcNameStart('5'), is(false));
assertThat(XmlCharacters.isValidNcNameStart('6'), is(false));
assertThat(XmlCharacters.isValidNcNameStart('7'), is(false));
assertThat(XmlCharacters.isValidNcNameStart('8'), is(false));
assertThat(XmlCharacters.isValidNcNameStart('9'), is(false));
}
}
代码示例来源:origin: ModeShape/modeshape
@Test
public void shouldNotAllowColonInNcName() {
assertThat(XmlCharacters.isValidNcNameStart(':'), is(false));
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
pos = input.position(startIndex);
int tokenType = (XmlCharacters.isValidNcNameStart(c)) ? NAME : OTHER;
while (input.isNextValidXmlNcNameCharacter()) {
c = input.next();
代码示例来源:origin: ModeShape/modeshape
pos = input.position(startIndex);
int tokenType = (XmlCharacters.isValidNcNameStart(c)) ? NAME : OTHER;
while (input.isNextValidXmlNcNameCharacter()) {
c = input.next();
内容来源于网络,如有侵权,请联系作者删除!