org.apache.batik.xml.XMLUtilities.isXMLNameCharacter()方法的使用及代码示例

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

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

XMLUtilities.isXMLNameCharacter介绍

[英]Tests whether the given character is a valid XML name character.
[中]测试给定字符是否为有效的XML名称字符。

代码示例

代码示例来源:origin: apache/batik

/**
 * Parses an XML name with optional escaping in the middle.
 */
protected String parseName() throws ParseException, IOException {
  StringBuffer sb = new StringBuffer();
  boolean midEscaped = false;
  do {
    sb.append((char) current);
    current = reader.read();
    midEscaped = false;
    if (current == '\\') {
      midEscaped = true;
      current = reader.read();
    }
  } while (XMLUtilities.isXMLNameCharacter((char) current)
      && (midEscaped || (current != '-' && current != '.')));
  return sb.toString();
}

代码示例来源:origin: org.apache.xmlgraphics/batik-parser

/**
 * Parses an XML name with optional escaping in the middle.
 */
protected String parseName() throws ParseException, IOException {
  StringBuffer sb = new StringBuffer();
  boolean midEscaped = false;
  do {
    sb.append((char) current);
    current = reader.read();
    midEscaped = false;
    if (current == '\\') {
      midEscaped = true;
      current = reader.read();
    }
  } while (XMLUtilities.isXMLNameCharacter((char) current)
      && (midEscaped || (current != '-' && current != '.')));
  return sb.toString();
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Parses an XML name with optional escaping in the middle.
 */
protected String parseName() throws ParseException, IOException {
  StringBuffer sb = new StringBuffer();
  boolean midEscaped = false;
  do {
    sb.append((char) current);
    current = reader.read();
    midEscaped = false;
    if (current == '\\') {
      midEscaped = true;
      current = reader.read();
    }
  } while (XMLUtilities.isXMLNameCharacter((char) current)
      && (midEscaped || (current != '-' && current != '.')));
  return sb.toString();
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

if (!isXMLNameCharacter(c)) {
  return 0;

代码示例来源:origin: apache/batik

if (!isXMLNameCharacter(c)) {
  return 0;

代码示例来源:origin: org.apache.xmlgraphics/batik-parser

/**
 * Parses an identifier.
 */
protected void parseIdentifier() throws ParseException, IOException {
  for (;;) {
    if (current == -1 ||
      !XMLUtilities.isXMLNameCharacter((char)current)) {
      break;
    }
    bufferize();
    current = reader.read();
  }
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Reads a Nmtoken. The current character must be the first character.
 * @return LexicalUnits.NMTOKEN.
 */
protected int readNmtoken() throws IOException, XMLException {
  if (current == -1) {
    throw createXMLException("unexpected.eof");
  }
  while (XMLUtilities.isXMLNameCharacter((char)current)) {
    nextChar();
  }
  return LexicalUnits.NMTOKEN;
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Parses an identifier.
 */
protected void parseIdentifier() throws ParseException, IOException {
  for (;;) {
    if (current == -1 ||
      !XMLUtilities.isXMLNameCharacter((char)current)) {
      break;
    }
    bufferize();
    current = reader.read();
  }
}

代码示例来源:origin: org.apache.xmlgraphics/batik-xml

/**
 * Reads a Nmtoken. The current character must be the first character.
 * @return LexicalUnits.NMTOKEN.
 */
protected int readNmtoken() throws IOException, XMLException {
  if (current == -1) {
    throw createXMLException("unexpected.eof");
  }
  while (XMLUtilities.isXMLNameCharacter((char)current)) {
    nextChar();
  }
  return LexicalUnits.NMTOKEN;
}

代码示例来源:origin: apache/batik

/**
 * Parses an identifier.
 */
protected void parseIdentifier() throws ParseException, IOException {
  for (;;) {
    if (current == -1 ||
      !XMLUtilities.isXMLNameCharacter((char)current)) {
      break;
    }
    bufferize();
    current = reader.read();
  }
}

代码示例来源:origin: apache/batik

/**
 * Reads a Nmtoken. The current character must be the first character.
 * @return LexicalUnits.NMTOKEN.
 */
protected int readNmtoken() throws IOException, XMLException {
  if (current == -1) {
    throw createXMLException("unexpected.eof");
  }
  while (XMLUtilities.isXMLNameCharacter((char)current)) {
    nextChar();
  }
  return LexicalUnits.NMTOKEN;
}

代码示例来源:origin: org.apache.xmlgraphics/batik-xml

/**
 * Reads the given identifier.
 * @param s The portion of the identifier to read.
 * @param type The lexical unit type of the identifier.
 * @param ntype The lexical unit type to set if the identifier do not
 * match or -1 if an error must be signaled.
 */
protected int readIdentifier(String s, int type, int ntype)
  throws IOException, XMLException {
  int len = s.length();
  for (int i = 0; i < len; i++) {
    nextChar();
    if (current != s.charAt(i)) {
      if (ntype == -1) {
        throw createXMLException("invalid.character");
      } else {
        while (current != -1 &&
            XMLUtilities.isXMLNameCharacter((char)current)) {
          nextChar();
        }
        return ntype;
      }
    }
  }
  nextChar();
  return type;
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Reads the given identifier.
 * @param s The portion of the identifier to read.
 * @param type The lexical unit type of the identifier.
 * @param ntype The lexical unit type to set if the identifier do not
 * match or -1 if an error must be signaled.
 */
protected int readIdentifier(String s, int type, int ntype)
  throws IOException, XMLException {
  int len = s.length();
  for (int i = 0; i < len; i++) {
    nextChar();
    if (current != s.charAt(i)) {
      if (ntype == -1) {
        throw createXMLException("invalid.character");
      } else {
        while (current != -1 &&
            XMLUtilities.isXMLNameCharacter((char)current)) {
          nextChar();
        }
        return ntype;
      }
    }
  }
  nextChar();
  return type;
}

代码示例来源:origin: apache/batik

/**
 * Reads the given identifier.
 * @param s The portion of the identifier to read.
 * @param type The lexical unit type of the identifier.
 * @param ntype The lexical unit type to set if the identifier do not
 * match or -1 if an error must be signaled.
 */
protected int readIdentifier(String s, int type, int ntype)
  throws IOException, XMLException {
  int len = s.length();
  for (int i = 0; i < len; i++) {
    nextChar();
    if (current != s.charAt(i)) {
      if (ntype == -1) {
        throw createXMLException("invalid.character");
      } else {
        while (current != -1 &&
            XMLUtilities.isXMLNameCharacter((char)current)) {
          nextChar();
        }
        return ntype;
      }
    }
  }
  nextChar();
  return type;
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Reads a name. The current character must be the first character.
 * @param type The lexical unit type to set.
 * @return type.
 */
protected int readName(int type) throws IOException, XMLException {
  if (current == -1) {
    throw createXMLException("unexpected.eof");
  }
  if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) {
    throw createXMLException("invalid.name");
  }
  do {
    nextChar();
  } while (current != -1 &&
       XMLUtilities.isXMLNameCharacter((char)current));
  return type;
}

代码示例来源:origin: apache/batik

/**
 * Reads a name. The current character must be the first character.
 * @param type The lexical unit type to set.
 * @return type.
 */
protected int readName(int type) throws IOException, XMLException {
  if (current == -1) {
    throw createXMLException("unexpected.eof");
  }
  if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) {
    throw createXMLException("invalid.name");
  }
  do {
    nextChar();
  } while (current != -1 &&
       XMLUtilities.isXMLNameCharacter((char)current));
  return type;
}

代码示例来源:origin: org.apache.xmlgraphics/batik-xml

/**
 * Reads a name. The current character must be the first character.
 * @param type The lexical unit type to set.
 * @return type.
 */
protected int readName(int type) throws IOException, XMLException {
  if (current == -1) {
    throw createXMLException("unexpected.eof");
  }
  if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) {
    throw createXMLException("invalid.name");
  }
  do {
    nextChar();
  } while (current != -1 &&
       XMLUtilities.isXMLNameCharacter((char)current));
  return type;
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Reads a parameter entity reference. The current character must be '%'.
 * @return type.
 */
protected int readPEReference() throws IOException, XMLException {
  nextChar();
  if (current == -1) {
    throw createXMLException("unexpected.eof");
  }
  if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) {
    throw createXMLException("invalid.parameter.entity");
  }
  do {
    nextChar();
  } while (current != -1 &&
       XMLUtilities.isXMLNameCharacter((char)current));
  if (current != ';') {
    throw createXMLException("invalid.parameter.entity");
  }
  nextChar();
  return LexicalUnits.PARAMETER_ENTITY_REFERENCE;
}

代码示例来源:origin: org.apache.xmlgraphics/batik-xml

/**
 * Reads a parameter entity reference. The current character must be '%'.
 * @return type.
 */
protected int readPEReference() throws IOException, XMLException {
  nextChar();
  if (current == -1) {
    throw createXMLException("unexpected.eof");
  }
  if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) {
    throw createXMLException("invalid.parameter.entity");
  }
  do {
    nextChar();
  } while (current != -1 &&
       XMLUtilities.isXMLNameCharacter((char)current));
  if (current != ';') {
    throw createXMLException("invalid.parameter.entity");
  }
  nextChar();
  return LexicalUnits.PARAMETER_ENTITY_REFERENCE;
}

代码示例来源:origin: apache/batik

/**
 * Reads a parameter entity reference. The current character must be '%'.
 * @return type.
 */
protected int readPEReference() throws IOException, XMLException {
  nextChar();
  if (current == -1) {
    throw createXMLException("unexpected.eof");
  }
  if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) {
    throw createXMLException("invalid.parameter.entity");
  }
  do {
    nextChar();
  } while (current != -1 &&
       XMLUtilities.isXMLNameCharacter((char)current));
  if (current != ';') {
    throw createXMLException("invalid.parameter.entity");
  }
  nextChar();
  return LexicalUnits.PARAMETER_ENTITY_REFERENCE;
}

相关文章