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

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

本文整理了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

  1. /**
  2. * Parses an XML name with optional escaping in the middle.
  3. */
  4. protected String parseName() throws ParseException, IOException {
  5. StringBuffer sb = new StringBuffer();
  6. boolean midEscaped = false;
  7. do {
  8. sb.append((char) current);
  9. current = reader.read();
  10. midEscaped = false;
  11. if (current == '\\') {
  12. midEscaped = true;
  13. current = reader.read();
  14. }
  15. } while (XMLUtilities.isXMLNameCharacter((char) current)
  16. && (midEscaped || (current != '-' && current != '.')));
  17. return sb.toString();
  18. }

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

  1. /**
  2. * Parses an XML name with optional escaping in the middle.
  3. */
  4. protected String parseName() throws ParseException, IOException {
  5. StringBuffer sb = new StringBuffer();
  6. boolean midEscaped = false;
  7. do {
  8. sb.append((char) current);
  9. current = reader.read();
  10. midEscaped = false;
  11. if (current == '\\') {
  12. midEscaped = true;
  13. current = reader.read();
  14. }
  15. } while (XMLUtilities.isXMLNameCharacter((char) current)
  16. && (midEscaped || (current != '-' && current != '.')));
  17. return sb.toString();
  18. }

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

  1. /**
  2. * Parses an XML name with optional escaping in the middle.
  3. */
  4. protected String parseName() throws ParseException, IOException {
  5. StringBuffer sb = new StringBuffer();
  6. boolean midEscaped = false;
  7. do {
  8. sb.append((char) current);
  9. current = reader.read();
  10. midEscaped = false;
  11. if (current == '\\') {
  12. midEscaped = true;
  13. current = reader.read();
  14. }
  15. } while (XMLUtilities.isXMLNameCharacter((char) current)
  16. && (midEscaped || (current != '-' && current != '.')));
  17. return sb.toString();
  18. }

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

  1. if (!isXMLNameCharacter(c)) {
  2. return 0;

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

  1. if (!isXMLNameCharacter(c)) {
  2. return 0;

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

  1. /**
  2. * Parses an identifier.
  3. */
  4. protected void parseIdentifier() throws ParseException, IOException {
  5. for (;;) {
  6. if (current == -1 ||
  7. !XMLUtilities.isXMLNameCharacter((char)current)) {
  8. break;
  9. }
  10. bufferize();
  11. current = reader.read();
  12. }
  13. }

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

  1. /**
  2. * Reads a Nmtoken. The current character must be the first character.
  3. * @return LexicalUnits.NMTOKEN.
  4. */
  5. protected int readNmtoken() throws IOException, XMLException {
  6. if (current == -1) {
  7. throw createXMLException("unexpected.eof");
  8. }
  9. while (XMLUtilities.isXMLNameCharacter((char)current)) {
  10. nextChar();
  11. }
  12. return LexicalUnits.NMTOKEN;
  13. }

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

  1. /**
  2. * Parses an identifier.
  3. */
  4. protected void parseIdentifier() throws ParseException, IOException {
  5. for (;;) {
  6. if (current == -1 ||
  7. !XMLUtilities.isXMLNameCharacter((char)current)) {
  8. break;
  9. }
  10. bufferize();
  11. current = reader.read();
  12. }
  13. }

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

  1. /**
  2. * Reads a Nmtoken. The current character must be the first character.
  3. * @return LexicalUnits.NMTOKEN.
  4. */
  5. protected int readNmtoken() throws IOException, XMLException {
  6. if (current == -1) {
  7. throw createXMLException("unexpected.eof");
  8. }
  9. while (XMLUtilities.isXMLNameCharacter((char)current)) {
  10. nextChar();
  11. }
  12. return LexicalUnits.NMTOKEN;
  13. }

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

  1. /**
  2. * Parses an identifier.
  3. */
  4. protected void parseIdentifier() throws ParseException, IOException {
  5. for (;;) {
  6. if (current == -1 ||
  7. !XMLUtilities.isXMLNameCharacter((char)current)) {
  8. break;
  9. }
  10. bufferize();
  11. current = reader.read();
  12. }
  13. }

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

  1. /**
  2. * Reads a Nmtoken. The current character must be the first character.
  3. * @return LexicalUnits.NMTOKEN.
  4. */
  5. protected int readNmtoken() throws IOException, XMLException {
  6. if (current == -1) {
  7. throw createXMLException("unexpected.eof");
  8. }
  9. while (XMLUtilities.isXMLNameCharacter((char)current)) {
  10. nextChar();
  11. }
  12. return LexicalUnits.NMTOKEN;
  13. }

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

  1. /**
  2. * Reads the given identifier.
  3. * @param s The portion of the identifier to read.
  4. * @param type The lexical unit type of the identifier.
  5. * @param ntype The lexical unit type to set if the identifier do not
  6. * match or -1 if an error must be signaled.
  7. */
  8. protected int readIdentifier(String s, int type, int ntype)
  9. throws IOException, XMLException {
  10. int len = s.length();
  11. for (int i = 0; i < len; i++) {
  12. nextChar();
  13. if (current != s.charAt(i)) {
  14. if (ntype == -1) {
  15. throw createXMLException("invalid.character");
  16. } else {
  17. while (current != -1 &&
  18. XMLUtilities.isXMLNameCharacter((char)current)) {
  19. nextChar();
  20. }
  21. return ntype;
  22. }
  23. }
  24. }
  25. nextChar();
  26. return type;
  27. }

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

  1. /**
  2. * Reads the given identifier.
  3. * @param s The portion of the identifier to read.
  4. * @param type The lexical unit type of the identifier.
  5. * @param ntype The lexical unit type to set if the identifier do not
  6. * match or -1 if an error must be signaled.
  7. */
  8. protected int readIdentifier(String s, int type, int ntype)
  9. throws IOException, XMLException {
  10. int len = s.length();
  11. for (int i = 0; i < len; i++) {
  12. nextChar();
  13. if (current != s.charAt(i)) {
  14. if (ntype == -1) {
  15. throw createXMLException("invalid.character");
  16. } else {
  17. while (current != -1 &&
  18. XMLUtilities.isXMLNameCharacter((char)current)) {
  19. nextChar();
  20. }
  21. return ntype;
  22. }
  23. }
  24. }
  25. nextChar();
  26. return type;
  27. }

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

  1. /**
  2. * Reads the given identifier.
  3. * @param s The portion of the identifier to read.
  4. * @param type The lexical unit type of the identifier.
  5. * @param ntype The lexical unit type to set if the identifier do not
  6. * match or -1 if an error must be signaled.
  7. */
  8. protected int readIdentifier(String s, int type, int ntype)
  9. throws IOException, XMLException {
  10. int len = s.length();
  11. for (int i = 0; i < len; i++) {
  12. nextChar();
  13. if (current != s.charAt(i)) {
  14. if (ntype == -1) {
  15. throw createXMLException("invalid.character");
  16. } else {
  17. while (current != -1 &&
  18. XMLUtilities.isXMLNameCharacter((char)current)) {
  19. nextChar();
  20. }
  21. return ntype;
  22. }
  23. }
  24. }
  25. nextChar();
  26. return type;
  27. }

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

  1. /**
  2. * Reads a name. The current character must be the first character.
  3. * @param type The lexical unit type to set.
  4. * @return type.
  5. */
  6. protected int readName(int type) throws IOException, XMLException {
  7. if (current == -1) {
  8. throw createXMLException("unexpected.eof");
  9. }
  10. if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) {
  11. throw createXMLException("invalid.name");
  12. }
  13. do {
  14. nextChar();
  15. } while (current != -1 &&
  16. XMLUtilities.isXMLNameCharacter((char)current));
  17. return type;
  18. }

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

  1. /**
  2. * Reads a name. The current character must be the first character.
  3. * @param type The lexical unit type to set.
  4. * @return type.
  5. */
  6. protected int readName(int type) throws IOException, XMLException {
  7. if (current == -1) {
  8. throw createXMLException("unexpected.eof");
  9. }
  10. if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) {
  11. throw createXMLException("invalid.name");
  12. }
  13. do {
  14. nextChar();
  15. } while (current != -1 &&
  16. XMLUtilities.isXMLNameCharacter((char)current));
  17. return type;
  18. }

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

  1. /**
  2. * Reads a name. The current character must be the first character.
  3. * @param type The lexical unit type to set.
  4. * @return type.
  5. */
  6. protected int readName(int type) throws IOException, XMLException {
  7. if (current == -1) {
  8. throw createXMLException("unexpected.eof");
  9. }
  10. if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) {
  11. throw createXMLException("invalid.name");
  12. }
  13. do {
  14. nextChar();
  15. } while (current != -1 &&
  16. XMLUtilities.isXMLNameCharacter((char)current));
  17. return type;
  18. }

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

  1. /**
  2. * Reads a parameter entity reference. The current character must be '%'.
  3. * @return type.
  4. */
  5. protected int readPEReference() throws IOException, XMLException {
  6. nextChar();
  7. if (current == -1) {
  8. throw createXMLException("unexpected.eof");
  9. }
  10. if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) {
  11. throw createXMLException("invalid.parameter.entity");
  12. }
  13. do {
  14. nextChar();
  15. } while (current != -1 &&
  16. XMLUtilities.isXMLNameCharacter((char)current));
  17. if (current != ';') {
  18. throw createXMLException("invalid.parameter.entity");
  19. }
  20. nextChar();
  21. return LexicalUnits.PARAMETER_ENTITY_REFERENCE;
  22. }

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

  1. /**
  2. * Reads a parameter entity reference. The current character must be '%'.
  3. * @return type.
  4. */
  5. protected int readPEReference() throws IOException, XMLException {
  6. nextChar();
  7. if (current == -1) {
  8. throw createXMLException("unexpected.eof");
  9. }
  10. if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) {
  11. throw createXMLException("invalid.parameter.entity");
  12. }
  13. do {
  14. nextChar();
  15. } while (current != -1 &&
  16. XMLUtilities.isXMLNameCharacter((char)current));
  17. if (current != ';') {
  18. throw createXMLException("invalid.parameter.entity");
  19. }
  20. nextChar();
  21. return LexicalUnits.PARAMETER_ENTITY_REFERENCE;
  22. }

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

  1. /**
  2. * Reads a parameter entity reference. The current character must be '%'.
  3. * @return type.
  4. */
  5. protected int readPEReference() throws IOException, XMLException {
  6. nextChar();
  7. if (current == -1) {
  8. throw createXMLException("unexpected.eof");
  9. }
  10. if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) {
  11. throw createXMLException("invalid.parameter.entity");
  12. }
  13. do {
  14. nextChar();
  15. } while (current != -1 &&
  16. XMLUtilities.isXMLNameCharacter((char)current));
  17. if (current != ';') {
  18. throw createXMLException("invalid.parameter.entity");
  19. }
  20. nextChar();
  21. return LexicalUnits.PARAMETER_ENTITY_REFERENCE;
  22. }

相关文章