本文整理了Java中org.modeshape.common.xml.XmlCharacters
类的一些代码示例,展示了XmlCharacters
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlCharacters
类的具体详情如下:
包路径:org.modeshape.common.xml.XmlCharacters
类名称:XmlCharacters
[英]A utility class for determining the validity of various XML names, per the XML 1.0 Specification.
[中]一个实用类,用于根据{$0$}确定各种XML名称的有效性。
代码示例来源:origin: org.fcrepo/modeshape-common
@Override
public boolean isNextValidXmlNcNameCharacter() {
int nextIndex = lastIndex + 1;
return nextIndex <= maxIndex && XmlCharacters.isValidNcName(content[nextIndex]);
}
}
代码示例来源:origin: ModeShape/modeshape
@Override
public boolean isNextValidXmlCharacter() {
int nextIndex = lastIndex + 1;
return nextIndex <= maxIndex && XmlCharacters.isValid(content[nextIndex]);
}
代码示例来源:origin: ModeShape/modeshape
@Override
public boolean isNextValidXmlNameCharacter() {
int nextIndex = lastIndex + 1;
return nextIndex <= maxIndex && XmlCharacters.isValidName(content[nextIndex]);
}
代码示例来源: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: 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: org.fcrepo/modeshape-common
/**
* Determine if the supplied name is a valid XML Name.
*
* @param name the string being checked
* @return true if the supplied name is indeed a valid XML Name, or false otherwise
*/
public static boolean isValidName( String name ) {
if (name == null || name.length() == 0) return false;
CharacterIterator iter = new StringCharacterIterator(name);
char c = iter.first();
if (!isValidNameStart(c)) return false;
while (c != CharacterIterator.DONE) {
if (!isValidName(c)) return false;
c = iter.next();
}
return true;
}
代码示例来源:origin: ModeShape/modeshape
@Test
public void shouldNotAllowDigitAsFirstCharacterInName() {
assertThat(XmlCharacters.isValidNameStart('0'), is(false));
assertThat(XmlCharacters.isValidNameStart('1'), is(false));
assertThat(XmlCharacters.isValidNameStart('2'), is(false));
assertThat(XmlCharacters.isValidNameStart('3'), is(false));
assertThat(XmlCharacters.isValidNameStart('4'), is(false));
assertThat(XmlCharacters.isValidNameStart('5'), is(false));
assertThat(XmlCharacters.isValidNameStart('6'), is(false));
assertThat(XmlCharacters.isValidNameStart('7'), is(false));
assertThat(XmlCharacters.isValidNameStart('8'), is(false));
assertThat(XmlCharacters.isValidNameStart('9'), is(false));
}
代码示例来源: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
@Test
public void shouldNotAllowColonInNcName() {
assertThat(XmlCharacters.isValidNcNameStart(':'), is(false));
}
代码示例来源:origin: org.modeshape/modeshape-common
/**
* Determine if the supplied name is a valid XML Name.
*
* @param name the string being checked
* @return true if the supplied name is indeed a valid XML Name, or false otherwise
*/
public static boolean isValidName( String name ) {
if (name == null || name.length() == 0) return false;
CharacterIterator iter = new StringCharacterIterator(name);
char c = iter.first();
if (!isValidNameStart(c)) return false;
while (c != CharacterIterator.DONE) {
if (!isValidName(c)) return false;
c = iter.next();
}
return true;
}
代码示例来源:origin: ModeShape/modeshape
@Test
public void shouldAllowLettersAsFirstCharacterInName() {
for (char c = 'a'; c <= 'z'; ++c) {
assertThat(XmlCharacters.isValidNameStart(c), is(true));
}
for (char c = 'A'; c <= 'Z'; ++c) {
assertThat(XmlCharacters.isValidNameStart(c), is(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: org.modeshape/modeshape-common
@Override
public boolean isNextValidXmlNcNameCharacter() {
int nextIndex = lastIndex + 1;
return nextIndex <= maxIndex && XmlCharacters.isValidNcName(content[nextIndex]);
}
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
pos = input.position(startIndex);
int tokenType = (XmlCharacters.isValidNcNameStart(c)) ? NAME : OTHER;
while (input.isNextValidXmlNcNameCharacter()) {
c = input.next();
代码示例来源:origin: org.modeshape/modeshape-common
@Override
public boolean isNextValidXmlCharacter() {
int nextIndex = lastIndex + 1;
return nextIndex <= maxIndex && XmlCharacters.isValid(content[nextIndex]);
}
代码示例来源:origin: ModeShape/modeshape
/**
* Determine if the supplied name is a valid XML Name.
*
* @param name the string being checked
* @return true if the supplied name is indeed a valid XML Name, or false otherwise
*/
public static boolean isValidName( String name ) {
if (name == null || name.length() == 0) return false;
CharacterIterator iter = new StringCharacterIterator(name);
char c = iter.first();
if (!isValidNameStart(c)) return false;
while (c != CharacterIterator.DONE) {
if (!isValidName(c)) return false;
c = iter.next();
}
return true;
}
代码示例来源:origin: org.modeshape/modeshape-common
@Override
public boolean isNextValidXmlNameCharacter() {
int nextIndex = lastIndex + 1;
return nextIndex <= maxIndex && XmlCharacters.isValidName(content[nextIndex]);
}
代码示例来源:origin: ModeShape/modeshape
@Override
public boolean isNextValidXmlNcNameCharacter() {
int nextIndex = lastIndex + 1;
return nextIndex <= maxIndex && XmlCharacters.isValidNcName(content[nextIndex]);
}
}
代码示例来源:origin: ModeShape/modeshape
pos = input.position(startIndex);
int tokenType = (XmlCharacters.isValidNcNameStart(c)) ? NAME : OTHER;
while (input.isNextValidXmlNcNameCharacter()) {
c = input.next();
代码示例来源:origin: org.fcrepo/modeshape-common
@Override
public boolean isNextValidXmlCharacter() {
int nextIndex = lastIndex + 1;
return nextIndex <= maxIndex && XmlCharacters.isValid(content[nextIndex]);
}
内容来源于网络,如有侵权,请联系作者删除!