org.apache.xml.utils.XML11Char类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(241)

本文整理了Java中org.apache.xml.utils.XML11Char类的一些代码示例,展示了XML11Char类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XML11Char类的具体详情如下:
包路径:org.apache.xml.utils.XML11Char
类名称:XML11Char

XML11Char介绍

[英]THIS IS A COPY OF THE XERCES-2J CLASS org.apache.xerces.utls.XMLChar This class defines the basic properties of characters in XML 1.1. The data in this class can be used to verify that a character is a valid XML 1.1 character or if the character is a space, name start, or name character.

A series of convenience methods are supplied to ease the burden of the developer. Using the character as an index into the XML11CHARS array and applying the appropriate mask flag (e.g. MASK_VALID), yields the same results as calling the convenience methods. There is one exception: check the comments for the isValid method for details.
[中]这是XERCES-2J课程组织的副本。阿帕奇。薛西斯。utls。XMLChar这个类定义了XML 1.1中字符的基本属性。此类中的数据可用于验证字符是否为有效的XML 1.1字符,或者该字符是否为空格、名称开头或名称字符。
提供了一系列方便的方法来减轻开发人员的负担。使用该字符作为XML11CHARS数组的索引,并应用适当的掩码标志(例如MASK_VALID),会产生与调用便利方法相同的结果。有一个例外:查看isValid方法的注释以了解详细信息。

代码示例

代码示例来源:origin: robovm/robovm

int i = 1;
char ch = ncName.charAt(0);
if( !isXML11NCNameStart(ch) ) {
  if ( length > 1 && isXML11NameHighSurrogate(ch) ) {
    char ch2 = ncName.charAt(1);
    if ( !XMLChar.isLowSurrogate(ch2) || 
       !isXML11NCNameStart(XMLChar.supplemental(ch, ch2)) ) {
      return false;
  if ( !isXML11NCName(ch) ) {
    if ( ++i < length && isXML11NameHighSurrogate(ch) ) {
      char ch2 = ncName.charAt(i);
      if ( !XMLChar.isLowSurrogate(ch2) || 
         !isXML11NCName(XMLChar.supplemental(ch, ch2)) ) {
        return false;

代码示例来源:origin: robovm/robovm

int i = 1;
char ch = name.charAt(0);
if( !isXML11NameStart(ch) ) {
  if ( length > 1 && isXML11NameHighSurrogate(ch) ) {
    char ch2 = name.charAt(1);
    if ( !XMLChar.isLowSurrogate(ch2) || 
       !isXML11NameStart(XMLChar.supplemental(ch, ch2)) ) {
      return false;
  if ( !isXML11Name(ch) ) {
    if ( ++i < length && isXML11NameHighSurrogate(ch) ) {
      char ch2 = name.charAt(i);
      if ( !XMLChar.isLowSurrogate(ch2) || 
         !isXML11Name(XMLChar.supplemental(ch, ch2)) ) {
        return false;

代码示例来源:origin: robovm/robovm

/**
 * Returns true if the specified character is invalid.
 *
 * @param c The character to check.
 */
public static boolean isXML11Invalid(int c) {
  return !isXML11Valid(c);
} // isXML11Invalid(int):boolean

代码示例来源:origin: robovm/robovm

/**
 * Check to see if a string is a valid Nmtoken according to [7]
 * in the XML 1.1 Recommendation
 *
 * @param nmtoken string to check
 * @return true if nmtoken is a valid Nmtoken 
 */
public static boolean isXML11ValidNmtoken(String nmtoken) {
  int length = nmtoken.length();
  if (length == 0)
    return false;
  for (int i = 0; i < length; ++i ) {
    char ch = nmtoken.charAt(i);
    if( !isXML11Name(ch) ) {
      if ( ++i < length && isXML11NameHighSurrogate(ch) ) {
        char ch2 = nmtoken.charAt(i);
        if ( !XMLChar.isLowSurrogate(ch2) || 
           !isXML11Name(XMLChar.supplemental(ch, ch2)) ) {
          return false;
        }
      }
      else {
        return false;
      }
    }
  }
  return true;
} // isXML11ValidName(String):boolean

代码示例来源:origin: robovm/robovm

/**
 * Simple check to determine if qname is legal. If it returns false
 * then <param>str</param> is illegal; if it returns true then 
 * <param>str</param> is legal.
 */
 public static boolean isXML11ValidQName(String str) {
  final int colon = str.indexOf(':');
  if (colon == 0 || colon == str.length() - 1) {
    return false;
  }
    if (colon > 0) {
    final String prefix = str.substring(0,colon);
    final String localPart = str.substring(colon+1);
    return isXML11ValidNCName(prefix) && isXML11ValidNCName(localPart);
  }
  else {
    return isXML11ValidNCName(str);
  }
 }

代码示例来源:origin: robovm/robovm

/**
 * Validate that the node name is good.
 * 
 * @param nodeName Name of the node being constructed, which may be null.
 * 
 * @return true if the node name is valid, false otherwise.
 */
 protected boolean validateNodeName(String nodeName)
 {
  if(null == nodeName)
   return false;
  if(nodeName.equals("xmlns"))
   return false;
  return XML11Char.isXML11ValidQName(nodeName);
 }

代码示例来源:origin: robovm/robovm

if ((avt.isSimple()) && (!XML11Char.isXML11ValidNmtoken(value))) {
 handleError(handler,XSLTErrorResources.INVALID_NMTOKEN, new Object[] {name,value},null);
 return null;
if (!XML11Char.isXML11ValidNmtoken(value)) {
 handleError(handler,XSLTErrorResources.INVALID_NMTOKEN, new Object[] {name,value},null);
 return null;

代码示例来源:origin: xalan/xalan

/**
 * Check to see if a string is a valid Nmtoken according to [7]
 * in the XML 1.1 Recommendation
 *
 * @param nmtoken string to check
 * @return true if nmtoken is a valid Nmtoken 
 */
public static boolean isXML11ValidNmtoken(String nmtoken) {
  int length = nmtoken.length();
  if (length == 0)
    return false;
  for (int i = 0; i < length; ++i ) {
    char ch = nmtoken.charAt(i);
    if( !isXML11Name(ch) ) {
      if ( ++i < length && isXML11NameHighSurrogate(ch) ) {
        char ch2 = nmtoken.charAt(i);
        if ( !XMLChar.isLowSurrogate(ch2) || 
           !isXML11Name(XMLChar.supplemental(ch, ch2)) ) {
          return false;
        }
      }
      else {
        return false;
      }
    }
  }
  return true;
} // isXML11ValidName(String):boolean

代码示例来源:origin: xalan/xalan

/**
 * Simple check to determine if qname is legal. If it returns false
 * then <param>str</param> is illegal; if it returns true then 
 * <param>str</param> is legal.
 */
 public static boolean isXML11ValidQName(String str) {
  final int colon = str.indexOf(':');
  if (colon == 0 || colon == str.length() - 1) {
    return false;
  }
    if (colon > 0) {
    final String prefix = str.substring(0,colon);
    final String localPart = str.substring(colon+1);
    return isXML11ValidNCName(prefix) && isXML11ValidNCName(localPart);
  }
  else {
    return isXML11ValidNCName(str);
  }
 }

代码示例来源:origin: xalan/xalan

/**
 * Validate that the node name is good.
 * 
 * @param nodeName Name of the node being constructed, which may be null.
 * 
 * @return true if the node name is valid, false otherwise.
 */
 protected boolean validateNodeName(String nodeName)
 {
  if(null == nodeName)
   return false;
  if(nodeName.equals("xmlns"))
   return false;
  return XML11Char.isXML11ValidQName(nodeName);
 }

代码示例来源:origin: xalan/xalan

if ((avt.isSimple()) && (!XML11Char.isXML11ValidNmtoken(value))) {
 handleError(handler,XSLTErrorResources.INVALID_NMTOKEN, new Object[] {name,value},null);
 return null;
if (!XML11Char.isXML11ValidNmtoken(value)) {
 handleError(handler,XSLTErrorResources.INVALID_NMTOKEN, new Object[] {name,value},null);
 return null;

代码示例来源:origin: xalan/xalan

int i = 1;
char ch = name.charAt(0);
if( !isXML11NameStart(ch) ) {
  if ( length > 1 && isXML11NameHighSurrogate(ch) ) {
    char ch2 = name.charAt(1);
    if ( !XMLChar.isLowSurrogate(ch2) || 
       !isXML11NameStart(XMLChar.supplemental(ch, ch2)) ) {
      return false;
  if ( !isXML11Name(ch) ) {
    if ( ++i < length && isXML11NameHighSurrogate(ch) ) {
      char ch2 = name.charAt(i);
      if ( !XMLChar.isLowSurrogate(ch2) || 
         !isXML11Name(XMLChar.supplemental(ch, ch2)) ) {
        return false;

代码示例来源:origin: xalan/xalan

int i = 1;
char ch = ncName.charAt(0);
if( !isXML11NCNameStart(ch) ) {
  if ( length > 1 && isXML11NameHighSurrogate(ch) ) {
    char ch2 = ncName.charAt(1);
    if ( !XMLChar.isLowSurrogate(ch2) || 
       !isXML11NCNameStart(XMLChar.supplemental(ch, ch2)) ) {
      return false;
  if ( !isXML11NCName(ch) ) {
    if ( ++i < length && isXML11NameHighSurrogate(ch) ) {
      char ch2 = ncName.charAt(i);
      if ( !XMLChar.isLowSurrogate(ch2) || 
         !isXML11NCName(XMLChar.supplemental(ch, ch2)) ) {
        return false;

代码示例来源:origin: MobiVM/robovm

/**
 * Check to see if a string is a valid Nmtoken according to [7]
 * in the XML 1.1 Recommendation
 *
 * @param nmtoken string to check
 * @return true if nmtoken is a valid Nmtoken 
 */
public static boolean isXML11ValidNmtoken(String nmtoken) {
  int length = nmtoken.length();
  if (length == 0)
    return false;
  for (int i = 0; i < length; ++i ) {
    char ch = nmtoken.charAt(i);
    if( !isXML11Name(ch) ) {
      if ( ++i < length && isXML11NameHighSurrogate(ch) ) {
        char ch2 = nmtoken.charAt(i);
        if ( !XMLChar.isLowSurrogate(ch2) || 
           !isXML11Name(XMLChar.supplemental(ch, ch2)) ) {
          return false;
        }
      }
      else {
        return false;
      }
    }
  }
  return true;
} // isXML11ValidName(String):boolean

代码示例来源:origin: xalan/xalan

/**
 * Utility function to check if a name is a valid ncname
 * This method should only be invoked if the attribute value is an AVT
 */    
public static void checkNCName(String name) {
  if (!XML11Char.isXML11ValidNCName(name)) {
    runTimeError(INVALID_NCNAME_ERR,name); 
  }  
}

代码示例来源:origin: xalan/xalan

/**
 * Checks if the string is valid list of qnames
 */
public static boolean isValidQNames(String str) {
  if ((str != null) && (!str.equals(Constants.EMPTYSTRING))) {
    final StringTokenizer tokens = new StringTokenizer(str);
    while (tokens.hasMoreTokens()) {
      if (!XML11Char.isXML11ValidQName(tokens.nextToken())) {
        return false;
      }
    }
  }
  return true;
}

代码示例来源:origin: xalan/xalan

/**
 * Returns true if the specified character is invalid.
 *
 * @param c The character to check.
 */
public static boolean isXML11Invalid(int c) {
  return !isXML11Valid(c);
} // isXML11Invalid(int):boolean

代码示例来源:origin: MobiVM/robovm

if ((avt.isSimple()) && (!XML11Char.isXML11ValidNmtoken(value))) {
 handleError(handler,XSLTErrorResources.INVALID_NMTOKEN, new Object[] {name,value},null);
 return null;
if (!XML11Char.isXML11ValidNmtoken(value)) {
 handleError(handler,XSLTErrorResources.INVALID_NMTOKEN, new Object[] {name,value},null);
 return null;

代码示例来源:origin: MobiVM/robovm

int i = 1;
char ch = name.charAt(0);
if( !isXML11NameStart(ch) ) {
  if ( length > 1 && isXML11NameHighSurrogate(ch) ) {
    char ch2 = name.charAt(1);
    if ( !XMLChar.isLowSurrogate(ch2) || 
       !isXML11NameStart(XMLChar.supplemental(ch, ch2)) ) {
      return false;
  if ( !isXML11Name(ch) ) {
    if ( ++i < length && isXML11NameHighSurrogate(ch) ) {
      char ch2 = name.charAt(i);
      if ( !XMLChar.isLowSurrogate(ch2) || 
         !isXML11Name(XMLChar.supplemental(ch, ch2)) ) {
        return false;

代码示例来源:origin: ibinti/bugvm

int i = 1;
char ch = ncName.charAt(0);
if( !isXML11NCNameStart(ch) ) {
  if ( length > 1 && isXML11NameHighSurrogate(ch) ) {
    char ch2 = ncName.charAt(1);
    if ( !XMLChar.isLowSurrogate(ch2) || 
       !isXML11NCNameStart(XMLChar.supplemental(ch, ch2)) ) {
      return false;
  if ( !isXML11NCName(ch) ) {
    if ( ++i < length && isXML11NameHighSurrogate(ch) ) {
      char ch2 = ncName.charAt(i);
      if ( !XMLChar.isLowSurrogate(ch2) || 
         !isXML11NCName(XMLChar.supplemental(ch, ch2)) ) {
        return false;

相关文章