gpt4 book ai didi

org.xhtmlrenderer.resource.XMLResource.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 04:33:05 34 4
gpt4 key购买 nike

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

XMLResource.<init>介绍

暂无

代码示例

代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer

public static XMLResource load(InputStream stream) {
  return XML_RESOURCE_BUILDER.createXMLResource(new XMLResource(stream));
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer

public static XMLResource load(Reader reader) {
  return XML_RESOURCE_BUILDER.createXMLResource(new XMLResource(new InputSource(reader)));
}

代码示例来源:origin: org.xhtmlrenderer/core-renderer

public static XMLResource load(Reader reader) {
  return XML_RESOURCE_BUILDER.createXMLResource(new XMLResource(new InputSource(reader)));
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer

public static XMLResource load(InputSource source) {
  return XML_RESOURCE_BUILDER.createXMLResource(new XMLResource(source));
}

代码示例来源:origin: org.xhtmlrenderer/core-renderer

public static XMLResource load(InputStream stream) {
  return XML_RESOURCE_BUILDER.createXMLResource(new XMLResource(stream));
}

代码示例来源:origin: org.xhtmlrenderer/core-renderer

public static XMLResource load(InputSource source) {
  return XML_RESOURCE_BUILDER.createXMLResource(new XMLResource(source));
}

代码示例来源:origin: org.xhtmlrenderer/core-renderer

public XMLResource createXMLResource(Source source) {
    DOMResult output = null;
    TransformerFactory xformFactory = null;
    Transformer idTransform = null;
    long st = 0L;
    st = System.currentTimeMillis();
    try {
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      dbf.setNamespaceAware(true);
      dbf.setValidating(false);//validation is the root of all evil in xml - tobe
      output = new DOMResult(dbf.newDocumentBuilder().newDocument());
      xformFactory = TransformerFactory.newInstance();
      idTransform = xformFactory.newTransformer();
    } catch (Exception ex) {
      throw new XRRuntimeException("Failed on configuring SAX to DOM transformer.", ex);
    }
    try {
      idTransform.transform(source, output);
    } catch (Exception ex) {
      throw new XRRuntimeException("Can't load the XML resource (using TRaX transformer). " + ex.getMessage(), ex);
    }
    long end = System.currentTimeMillis();
    //HACK: should rather use a default constructor
    XMLResource target = new XMLResource((InputSource) null);
    target.setElapsedLoadTime(end - st);
    XRLog.load("Loaded document in ~" + target.getElapsedLoadTime() + "ms");
    target.setDocument((Document) output.getNode());
    return target;
  }
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer

public XMLResource createXMLResource(Source source) {
    DOMResult output = null;
    TransformerFactory xformFactory = null;
    Transformer idTransform = null;
    long st = 0L;
    st = System.currentTimeMillis();
    try {
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      dbf.setNamespaceAware(true);
      dbf.setValidating(false);//validation is the root of all evil in xml - tobe
      output = new DOMResult(dbf.newDocumentBuilder().newDocument());
      xformFactory = TransformerFactory.newInstance();
      idTransform = xformFactory.newTransformer();
    } catch (Exception ex) {
      throw new XRRuntimeException("Failed on configuring SAX to DOM transformer.", ex);
    }
    try {
      idTransform.transform(source, output);
    } catch (Exception ex) {
      throw new XRRuntimeException("Can't load the XML resource (using TRaX transformer). " + ex.getMessage(), ex);
    }
    long end = System.currentTimeMillis();
    //HACK: should rather use a default constructor
    XMLResource target = new XMLResource((InputSource) null);
    target.setElapsedLoadTime(end - st);
    XRLog.load("Loaded document in ~" + target.getElapsedLoadTime() + "ms");
    target.setDocument((Document) output.getNode());
    return target;
  }
}

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