gpt4 book ai didi

org.apache.openjpa.lib.xml.XMLFactory类的使用及代码示例

转载 作者:知者 更新时间:2024-03-23 16:21:05 25 4
gpt4 key购买 nike

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

XMLFactory介绍

[英]The XMLFactory produces validating and non-validating DOM level 2 and SAX level 2 parsers and XSL transformers through JAXP. It uses caching to avoid repeatedly paying the relatively expensive runtime costs associated with resolving the correct XML implementation through the JAXP configuration mechanisms.
[中]XMLFactory通过JAXP生成验证和非验证DOM级别2和SAX级别2解析器以及XSL转换器。它使用缓存来避免重复支付与通过JAXP配置机制解析正确的XML实现相关的相对昂贵的运行时成本。

代码示例

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Return a new DOM Document.
 */
public static Document getDocument() {
  return getDOMParser(false, false).newDocument();
}

代码示例来源:origin: org.apache.openejb.patch/openjpa-xmlstore

/**
 * Read a collection of {@link ObjectData}s from the contents of the
 * given file.
 */
private Collection read(File f)
  throws Exception {
  // parse the file and return the objects it contains
  SAXParser parser = XMLFactory.getSAXParser(false, false);
  ObjectDataHandler handler = new ObjectDataHandler(_conf);
  parser.parse(f, handler);
  return handler.getExtent();
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Return a DocumentBuilder with the specified configuration.
 */
public static DocumentBuilder getDOMParser(boolean validating,
  boolean namespaceAware) {
  DocumentBuilder db;
  try {
    db = _domFactories[factoryIndex(validating, namespaceAware)].
      newDocumentBuilder();
  } catch (ParserConfigurationException pce) {
    throw new RuntimeException(pce);
  }
  if (validating)
    db.setErrorHandler(_validating);
  return db;
}

代码示例来源:origin: org.apache.openjpa/openjpa-lib

/**
 * Return a new DOM Document.
 */
public static Document getDocument() {
  return getDOMParser(false, false).newDocument();
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Read a collection of {@link ObjectData}s from the contents of the
 * given file.
 */
private Collection read(File f)
  throws Exception {
  // parse the file and return the objects it contains
  SAXParser parser = XMLFactory.getSAXParser(false, false);
  ObjectDataHandler handler = new ObjectDataHandler(_conf);
  parser.parse(f, handler);
  return handler.getExtent();
}

代码示例来源:origin: org.apache.openjpa/openjpa-lib

/**
 * Return a DocumentBuilder with the specified configuration.
 */
public static DocumentBuilder getDOMParser(boolean validating,
  boolean namespaceAware) {
  DocumentBuilder db;
  try {
    db = _domFactories[factoryIndex(validating, namespaceAware)].
      newDocumentBuilder();
  } catch (ParserConfigurationException pce) {
    throw new RuntimeException(pce);
  }
  if (validating)
    db.setErrorHandler(_validating);
  return db;
}

代码示例来源:origin: org.apache.openjpa/com.springsource.org.apache.openjpa

/**
 * Return a new DOM Document.
 */
public static Document getDocument() {
  return getDOMParser(false, false).newDocument();
}

代码示例来源:origin: org.apache.openjpa/com.springsource.org.apache.openjpa

SAXParser parser = XMLFactory.getSAXParser(validating, true);
Object schema = null;
if (validating) {

代码示例来源:origin: org.apache.openjpa/com.springsource.org.apache.openjpa

/**
 * Return a DocumentBuilder with the specified configuration.
 */
public static DocumentBuilder getDOMParser(boolean validating,
  boolean namespaceAware) {
  DocumentBuilder db;
  try {
    db = _domFactories[factoryIndex(validating, namespaceAware)].
      newDocumentBuilder();
  } catch (ParserConfigurationException pce) {
    throw new NestableRuntimeException(pce);
  }
  if (validating)
    db.setErrorHandler(_validating);
  return db;
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

/**
 * Return a new DOM Document.
 */
public static Document getDocument() {
  return getDOMParser(false, false).newDocument();
}

代码示例来源:origin: org.apache.openjpa/openjpa-lib

parser = XMLFactory.getSAXParser(validating, true);
Object schema = null;
if (validating) {

代码示例来源:origin: org.apache.openejb.patch/openjpa

/**
 * Return a DocumentBuilder with the specified configuration.
 */
public static DocumentBuilder getDOMParser(boolean validating,
  boolean namespaceAware) {
  DocumentBuilder db;
  try {
    db = _domFactories[factoryIndex(validating, namespaceAware)].
      newDocumentBuilder();
  } catch (ParserConfigurationException pce) {
    throw new NestableRuntimeException(pce);
  }
  if (validating)
    db.setErrorHandler(_validating);
  return db;
}

代码示例来源:origin: org.apache.openejb.patch/openjpa-jdbc

public List<String> getDictionaries(InputStream in) {
  List<String> result = new ArrayList<String>();
  DocumentBuilder builder = XMLFactory.getDOMParser(false, false);
  try {
    Document doc = builder.parse(in);
    Element root = doc.getDocumentElement();
    NodeList nodes = root.getElementsByTagName("dictionary");
    for (int i = 0; i < nodes.getLength(); i++) {
      Node node = nodes.item(i);
      NamedNodeMap attrs = node.getAttributes();
      Node dictionary = attrs.getNamedItem("class");
      if (dictionary != null) {
        result.add(dictionary.getNodeValue());
      }
    }
  } catch (Throwable e) {
    if (log.isWarnEnabled()) {
      log.error(_loc.get("error-code-parse-error"));
    }
  } finally {
    try {
      in.close();
    } catch (IOException e) {
      // ignore
    }
  }
  return result;
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

parser = XMLFactory.getSAXParser(validating, true);
Object schema = null;
if (validating) {

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Return a SAXParser with the specified configuration.
 */
public static SAXParser getSAXParser(boolean validating,
  boolean namespaceAware) {
  SAXParser sp;
  try {
    sp = _saxFactories[factoryIndex(validating, namespaceAware)].
      newSAXParser();
  } catch (ParserConfigurationException pce) {
    throw new RuntimeException(pce);
  } catch (SAXException se) {
    throw new RuntimeException(se);
  }
  if (validating) {
    try {
      sp.getXMLReader().setErrorHandler(_validating);
    } catch (SAXException se) {
      throw new RuntimeException(se);
    }
  }
  return sp;
}

代码示例来源:origin: org.apache.openjpa/openjpa-jdbc

public List<String> getDictionaries(InputStream in) {
  List<String> result = new ArrayList<String>();
  DocumentBuilder builder = XMLFactory.getDOMParser(false, false);
  try {
    Document doc = builder.parse(in);
    Element root = doc.getDocumentElement();
    NodeList nodes = root.getElementsByTagName("dictionary");
    for (int i = 0; i < nodes.getLength(); i++) {
      Node node = nodes.item(i);
      NamedNodeMap attrs = node.getAttributes();
      Node dictionary = attrs.getNamedItem("class");
      if (dictionary != null) {
        result.add(dictionary.getNodeValue());
      }
    }
  } catch (Throwable e) {
    if (log.isWarnEnabled()) {
      log.error(_loc.get("error-code-parse-error"));
    }
  } finally {
    try {
      in.close();
    } catch (IOException e) {
      // ignore
    }
  }
  return result;
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

parser = XMLFactory.getSAXParser(validating, true);
Object schema = null;
if (validating) {

代码示例来源:origin: org.apache.openjpa/openjpa-lib

/**
 * Return a SAXParser with the specified configuration.
 */
public static SAXParser getSAXParser(boolean validating,
  boolean namespaceAware) {
  SAXParser sp;
  try {
    sp = _saxFactories[factoryIndex(validating, namespaceAware)].
      newSAXParser();
  } catch (ParserConfigurationException pce) {
    throw new RuntimeException(pce);
  } catch (SAXException se) {
    throw new RuntimeException(se);
  }
  if (validating) {
    try {
      sp.getXMLReader().setErrorHandler(_validating);
    } catch (SAXException se) {
      throw new RuntimeException(se);
    }
  }
  return sp;
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

public List<String> getDictionaries(InputStream in) {
  List<String> result = new ArrayList<String>();
  DocumentBuilder builder = XMLFactory.getDOMParser(false, false);
  try {
    Document doc = builder.parse(in);
    Element root = doc.getDocumentElement();
    NodeList nodes = root.getElementsByTagName("dictionary");
    for (int i = 0; i < nodes.getLength(); i++) {
      Node node = nodes.item(i);
      NamedNodeMap attrs = node.getAttributes();
      Node dictionary = attrs.getNamedItem("class");
      if (dictionary != null) {
        result.add(dictionary.getNodeValue());
      }
    }
  } catch (Throwable e) {
    if (log.isWarnEnabled()) {
      log.error(_loc.get("error-code-parse-error"));
    }
  } finally {
    try {
      in.close();
    } catch (IOException e) {
      // ignore
    }
  }
  return result;
}

代码示例来源:origin: org.apache.openjpa/com.springsource.org.apache.openjpa

/**
 * Return a SAXParser with the specified configuration.
 */
public static SAXParser getSAXParser(boolean validating,
  boolean namespaceAware) {
  SAXParser sp;
  try {
    sp = _saxFactories[factoryIndex(validating, namespaceAware)].
      newSAXParser();
  } catch (ParserConfigurationException pce) {
    throw new NestableRuntimeException(pce);
  } catch (SAXException se) {
    throw new NestableRuntimeException(se);
  }
  if (validating) {
    try {
      sp.getXMLReader().setErrorHandler(_validating);
    } catch (SAXException se) {
      throw new NestableRuntimeException(se);
    }
  }
  return sp;
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com