org.apache.batik.xml.XMLUtilities类的使用及代码示例

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

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

XMLUtilities介绍

[英]A collection of utility functions for XML.
[中]XML的实用函数集合。

代码示例

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

/**
 * Tells whether the given character represents white spaces.
 */
protected boolean isWhiteSpace(char[] text) {
  for (int i = 0; i < text.length; i++) {
    if (!XMLUtilities.isXMLSpace(text[i])) {
      return false;
    }
  }
  return true;
}

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

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

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

Reader r = createXMLDeclarationReader(pbis, "UTF8");
  String enc = getXMLDeclarationEncoding(r, "UTF8");
  return new InputStreamReader(pbis, enc);
(buf[2] & 0x00FF) == 0x00a7 &&
(buf[3] & 0x00FF) == 0x0094) {
Reader r = createXMLDeclarationReader(pbis, "CP037");
String enc = getXMLDeclarationEncoding(r, "CP037");
return new InputStreamReader(pbis, enc);

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

if (!isXMLSpace((char)(c = r.read()))) {
  return e;
while (isXMLSpace((char)(c = r.read())));
while (isXMLSpace((char)c)) {
  c = r.read();
while (isXMLSpace((char)(c = r.read())));
    break;
  if (!isXMLVersionCharacter((char)c)) {
    return e;
if (!isXMLSpace((char)(c = r.read()))) {
  return e;
while (isXMLSpace((char)(c = r.read())));
while (isXMLSpace((char)c)) {
  c = r.read();
while (isXMLSpace((char)(c = r.read())));
    return encodingToJavaEncoding(enc.toString(), e);

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

do {
  nextChar();
} while (current != -1 && XMLUtilities.isXMLSpace((char)current));
context = (depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT;
return LexicalUnits.S;
  int c1 = nextChar();
  if (c1 == -1 ||
    !XMLUtilities.isXMLNameFirstCharacter((char)c1)) {
    throw createXMLException("invalid.pi.target");
  if (c2 == -1 || !XMLUtilities.isXMLNameCharacter((char)c2)) {
    return LexicalUnits.PI_START;
  if (c3 == -1 || !XMLUtilities.isXMLNameCharacter((char)c3)) {
    return LexicalUnits.PI_START;
  if (c4 != -1 && XMLUtilities.isXMLNameCharacter((char)c4)) {
    do {
      nextChar();
    } while (current != -1 &&
         XMLUtilities.isXMLNameCharacter((char)current));
    return LexicalUnits.PI_START;

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

do {
  nextChar();
} while (current != -1 && XMLUtilities.isXMLSpace((char)current));
return LexicalUnits.S;
    nextChar();
  } while (current != -1 &&
       XMLUtilities.isXMLNameCharacter((char)current));
  return LexicalUnits.NAME;
  !XMLUtilities.isXMLNameCharacter((char)current)) {
  return LexicalUnits.ID_IDENTIFIER;
    nextChar();
  } while (current != -1 &&
       XMLUtilities.isXMLNameCharacter((char)current));
  return LexicalUnits.NAME;
  !XMLUtilities.isXMLNameCharacter((char)current)) {
  return LexicalUnits.NAME;
    nextChar();
  } while (current != -1 &&
       XMLUtilities.isXMLNameCharacter((char)current));
  return LexicalUnits.NAME;
  !XMLUtilities.isXMLNameCharacter((char)current)) {
  return LexicalUnits.NAME;

代码示例来源: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: fr.avianey.apache-xmlgraphics/batik

float offset = parseOffset();
  ret = new Object[] { new Integer(TIME_OFFSET), new Float(offset) };
} else if (XMLUtilities.isXMLNameFirstCharacter((char) current)) {
  ret = parseIDValue(escaped);
} else {

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

/**
 * <b>DOM</b>: Implements DOMImplementation#createDocumentType(String,String,String).
 */
public DocumentType createDocumentType(String qualifiedName,
                    String publicId,
                    String systemId) {
  if (qualifiedName == null) {
    qualifiedName = "";
  }
  int test = XMLUtilities.testXMLQName(qualifiedName);
  if ((test & XMLUtilities.IS_XML_10_NAME) == 0) {
    throw new DOMException
      (DOMException.INVALID_CHARACTER_ERR,
       formatMessage("xml.name",
              new Object[] { qualifiedName }));
  }
  if ((test & XMLUtilities.IS_XML_10_QNAME) == 0) {
    throw new DOMException
      (DOMException.INVALID_CHARACTER_ERR,
       formatMessage("invalid.qname",
              new Object[] { qualifiedName }));
  }
  return new GenericDocumentType(qualifiedName, publicId, systemId);
}

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

public void run() {
    char [] buffer = new char[4096];
    try {
      Document  doc = new XMLDocument();
      ParsedURL purl = new ParsedURL(svgDocument.getURL());
      InputStream is
        = u.openStream(getInputHandler(purl).
                getHandledMimeTypes());
      // u.openStream(MimeTypeConstants.MIME_TYPES_SVG_LIST.iterator());
      Reader in = XMLUtilities.createXMLDocumentReader(is);
      int len;
      while ((len=in.read(buffer, 0, buffer.length)) != -1) {
        doc.insertString(doc.getLength(),
                 new String(buffer, 0, len), null);
      }
      ta.setDocument(doc);
      ta.setEditable(false);
      // ta.setBackground(Color.white);
      fr.setVisible(true);
    } catch (Exception ex) {
      userAgent.displayError(ex);
    }
  }
}.start();

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

do {
  nextChar();
} while (current != -1 && XMLUtilities.isXMLSpace((char)current));
context = (depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT;
return LexicalUnits.S;
  int c1 = nextChar();
  if (c1 == -1 ||
    !XMLUtilities.isXMLNameFirstCharacter((char)c1)) {
    throw createXMLException("invalid.pi.target");
  if (c2 == -1 || !XMLUtilities.isXMLNameCharacter((char)c2)) {
    return LexicalUnits.PI_START;
  if (c3 == -1 || !XMLUtilities.isXMLNameCharacter((char)c3)) {
    return LexicalUnits.PI_START;
  if (c4 != -1 && XMLUtilities.isXMLNameCharacter((char)c4)) {
    do {
      nextChar();
    } while (current != -1 &&
         XMLUtilities.isXMLNameCharacter((char)current));
    return LexicalUnits.PI_START;

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

if (!isXMLSpace((char)(c = r.read()))) {
  return e;
while (isXMLSpace((char)(c = r.read()))) {
while (isXMLSpace((char)c)) {
  c = r.read();
while (isXMLSpace((char)(c = r.read()))) {
    break;
  if (!isXMLVersionCharacter((char)c)) {
    return e;
if (!isXMLSpace((char)(c = r.read()))) {
  return e;
while (isXMLSpace((char)(c = r.read()))) {
while (isXMLSpace((char)c)) {
  c = r.read();
while (isXMLSpace((char)(c = r.read()))) {
    return encodingToJavaEncoding(enc.toString(), e);

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

do {
  nextChar();
} while (current != -1 && XMLUtilities.isXMLSpace((char)current));
return LexicalUnits.S;
    nextChar();
  } while (current != -1 &&
       XMLUtilities.isXMLNameCharacter((char)current));
  return LexicalUnits.NAME;
  !XMLUtilities.isXMLNameCharacter((char)current)) {
  return LexicalUnits.ID_IDENTIFIER;
    nextChar();
  } while (current != -1 &&
       XMLUtilities.isXMLNameCharacter((char)current));
  return LexicalUnits.NAME;
  !XMLUtilities.isXMLNameCharacter((char)current)) {
  return LexicalUnits.NAME;
    nextChar();
  } while (current != -1 &&
       XMLUtilities.isXMLNameCharacter((char)current));
  return LexicalUnits.NAME;
  !XMLUtilities.isXMLNameCharacter((char)current)) {
  return LexicalUnits.NAME;

代码示例来源: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: org.apache.xmlgraphics/batik-parser

float offset = parseOffset();
  ret = new Object[] {TIME_OFFSET, offset};
} else if (XMLUtilities.isXMLNameFirstCharacter((char) current)) {
  ret = parseIDValue(escaped);
} else {

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

/**
 * <b>DOM</b>: Implements DOMImplementation#createDocumentType(String,String,String).
 */
public DocumentType createDocumentType(String qualifiedName,
                    String publicId,
                    String systemId) {
  if (qualifiedName == null) {
    qualifiedName = "";
  }
  int test = XMLUtilities.testXMLQName(qualifiedName);
  if ((test & XMLUtilities.IS_XML_10_NAME) == 0) {
    throw new DOMException
      (DOMException.INVALID_CHARACTER_ERR,
       formatMessage("xml.name",
              new Object[] { qualifiedName }));
  }
  if ((test & XMLUtilities.IS_XML_10_QNAME) == 0) {
    throw new DOMException
      (DOMException.INVALID_CHARACTER_ERR,
       formatMessage("invalid.qname",
              new Object[] { qualifiedName }));
  }
  return new GenericDocumentType(qualifiedName, publicId, systemId);
}

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

public void run() {
    char [] buffer = new char[4096];
    try {
      Document  doc = new XMLDocument();
      ParsedURL purl = new ParsedURL(svgDocument.getURL());
      InputStream is
        = u.openStream(getInputHandler(purl).
                getHandledMimeTypes());
      // u.openStream(MimeTypeConstants.MIME_TYPES_SVG_LIST.iterator());
      Reader in = XMLUtilities.createXMLDocumentReader(is);
      int len;
      while ((len=in.read(buffer, 0, buffer.length)) != -1) {
        doc.insertString(doc.getLength(),
                 new String(buffer, 0, len), null);
      }
      ta.setDocument(doc);
      ta.setEditable(false);
      // ta.setBackground(Color.white);
      fr.setVisible(true);
    } catch (Exception ex) {
      userAgent.displayError(ex);
    }
  }
}.start();

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

/**
 * Tells whether the given character represents white spaces.
 */
protected boolean isWhiteSpace(char[] text) {
  for (char aText : text) {
    if (!XMLUtilities.isXMLSpace(aText)) {
      return false;
    }
  }
  return true;
}

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

do {
  nextChar();
} while (current != -1 && XMLUtilities.isXMLSpace((char)current));
context = (depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT;
return LexicalUnits.S;
  int c1 = nextChar();
  if (c1 == -1 ||
    !XMLUtilities.isXMLNameFirstCharacter((char)c1)) {
    throw createXMLException("invalid.pi.target");
  if (c2 == -1 || !XMLUtilities.isXMLNameCharacter((char)c2)) {
    return LexicalUnits.PI_START;
  if (c3 == -1 || !XMLUtilities.isXMLNameCharacter((char)c3)) {
    return LexicalUnits.PI_START;
  if (c4 != -1 && XMLUtilities.isXMLNameCharacter((char)c4)) {
    do {
      nextChar();
    } while (current != -1 &&
         XMLUtilities.isXMLNameCharacter((char)current));
    return LexicalUnits.PI_START;

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

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

相关文章