- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.fcrepo.utilities.XmlTransformUtility.returnDocumentBuilder()
方法的一些代码示例,展示了XmlTransformUtility.returnDocumentBuilder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlTransformUtility.returnDocumentBuilder()
方法的具体详情如下:
包路径:org.fcrepo.utilities.XmlTransformUtility
类名称:XmlTransformUtility
方法名:returnDocumentBuilder
暂无
代码示例来源:origin: org.fcrepo/fcrepo-server
private static void prettyPrint(InputStream source,
OutputStream destination)
throws Exception {
BufferedWriter outWriter = new BufferedWriter(new PrintWriter(destination));
DocumentBuilder builder = XmlTransformUtility.borrowDocumentBuilder();
try {
Document doc = builder.parse(source);
XercesXmlSerializers.writeConsoleWithDocType(doc, outWriter);
outWriter.close();
} finally {
XmlTransformUtility.returnDocumentBuilder(builder);
}
}
代码示例来源:origin: fcrepo3/fcrepo
private static void prettyPrint(InputStream source,
OutputStream destination)
throws Exception {
BufferedWriter outWriter = new BufferedWriter(new PrintWriter(destination));
DocumentBuilder builder = XmlTransformUtility.borrowDocumentBuilder();
try {
Document doc = builder.parse(source);
XercesXmlSerializers.writeConsoleWithDocType(doc, outWriter);
outWriter.close();
} finally {
XmlTransformUtility.returnDocumentBuilder(builder);
}
}
代码示例来源:origin: fcrepo3/fcrepo
public static Document getDocumentFromFile(File file) throws Exception {
byte[] document = loadFile(file);
DocumentBuilder docBuilder =
XmlTransformUtility.borrowDocumentBuilder();
Document doc = null;
try {
doc = docBuilder.parse(new ByteArrayInputStream(document));
} finally {
XmlTransformUtility.returnDocumentBuilder(docBuilder);
}
return doc;
}
代码示例来源:origin: fcrepo3/fcrepo
public static String format(byte[] document) throws Exception {
DocumentBuilder builder = XmlTransformUtility.borrowDocumentBuilder();
Document doc = null;
try {
doc = builder.parse(new ByteArrayInputStream(document));
} finally {
XmlTransformUtility.returnDocumentBuilder(builder);
}
return format(doc);
}
代码示例来源:origin: fcrepo3/fcrepo
/**
* Get a new DOM Document object from parsing the specified InputStream.
*
* @param in
* the InputStream to parse.
* @return a new DOM Document object.
* @throws ParserConfigurationException
* if a DocumentBuilder cannot be created.
* @throws SAXException
* If any parse errors occur.
* @throws IOException
* If any IO errors occur.
*/
protected static Document getDocument(InputStream in)
throws Exception {
DocumentBuilder builder = XmlTransformUtility.borrowDocumentBuilder();
Document doc = null;
try {
doc = builder.parse(in);
} finally {
XmlTransformUtility.returnDocumentBuilder(builder);
}
return doc;
}
}
代码示例来源:origin: org.fcrepo/fcrepo-common
public void addXmlContent(String dsvId, String xmlContent) {
DocumentBuilder builder = null;
try {
builder = XmlTransformUtility.borrowDocumentBuilder();
Document contentDoc = builder.parse(new InputSource(new StringReader(xmlContent)));
Node importedContent = doc.adoptNode(contentDoc.getDocumentElement());
Node dsv = getDatastreamVersion(dsvId);
Element content = doc.createElementNS(FOXML_NS, "foxml:xmlContent");
dsv.appendChild(content);
content.appendChild(importedContent);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if (builder != null) {
XmlTransformUtility.returnDocumentBuilder(builder);
}
}
}
代码示例来源:origin: org.fcrepo/fcrepo-common
/**
* Get a new DOM Document object from parsing the specified InputStream.
*
* @param in
* the InputStream to parse.
* @return a new DOM Document object.
* @throws ParserConfigurationException
* if a DocumentBuilder cannot be created.
* @throws SAXException
* If any parse errors occur.
* @throws IOException
* If any IO errors occur.
*/
protected static Document getDocument(InputStream in)
throws Exception {
DocumentBuilder builder = XmlTransformUtility.borrowDocumentBuilder();
Document doc = null;
try {
doc = builder.parse(in);
} finally {
XmlTransformUtility.returnDocumentBuilder(builder);
}
return doc;
}
}
代码示例来源:origin: fcrepo3/fcrepo
public void addXmlContent(String dsvId, String xmlContent) {
DocumentBuilder builder = null;
try {
builder = XmlTransformUtility.borrowDocumentBuilder();
Document contentDoc = builder.parse(new InputSource(new StringReader(xmlContent)));
Node importedContent = doc.adoptNode(contentDoc.getDocumentElement());
Node dsv = getDatastreamVersion(dsvId);
Element content = doc.createElementNS(FOXML_NS, "foxml:xmlContent");
dsv.appendChild(content);
content.appendChild(importedContent);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if (builder != null) {
XmlTransformUtility.returnDocumentBuilder(builder);
}
}
}
代码示例来源:origin: fcrepo3/fcrepo
public static void saveDocument(String filename, byte[] document)
throws Exception {
try {
DocumentBuilderFactory documentBuilderFactory =
DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder docBuilder =
XmlTransformUtility.borrowDocumentBuilder();
Document doc = null;
try {
doc = docBuilder.parse(new ByteArrayInputStream(document));
} finally {
XmlTransformUtility.returnDocumentBuilder(docBuilder);
}
File file = new File(filename.trim());
String data = format(doc);
PrintWriter writer = new PrintWriter(file, "UTF-8");
writer.print(data);
writer.flush();
writer.close();
} catch (Exception e) {
logger.error("Unable to save file: " + filename, e);
throw new Exception("Unable to save file: " + filename, e);
}
}
代码示例来源:origin: fcrepo3/fcrepo
public static void saveDocument(String filename, byte[] document)
throws Exception {
try {
DocumentBuilder docBuilder =
XmlTransformUtility.borrowDocumentBuilder();
Document doc = null;
try {
doc = docBuilder.parse(new ByteArrayInputStream(document));
} finally {
XmlTransformUtility.returnDocumentBuilder(docBuilder);
}
saveDocument(filename, doc);
} catch (Exception e) {
String message = "Unable to save file: " + filename;
logger.error(message,e);
throw new Exception(message, e);
}
}
代码示例来源:origin: org.fcrepo/fcrepo-common
public Foxml11Document(String pid) throws Exception {
DocumentBuilder builder = null;
try {
builder = XmlTransformUtility.borrowDocumentBuilder();
DOMImplementation impl = builder.getDOMImplementation();
doc = impl.createDocument(FOXML_NS, "foxml:digitalObject", null);
rootElement = doc.getDocumentElement();
rootElement.setAttributeNS("http://www.w3.org/2000/xmlns/",
"xmlns:xsi",
"http://www.w3.org/1999/XMLSchema-instance");
rootElement.setAttributeNS("http://www.w3.org/1999/XMLSchema-instance",
"xsi:schemaLocation",
"info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd");
rootElement.setAttribute("VERSION", "1.1");
rootElement.setAttribute("PID", pid);
} finally {
if (builder != null) {
XmlTransformUtility.returnDocumentBuilder(builder);
}
}
NamespaceContextImpl nsCtx = new NamespaceContextImpl();
nsCtx.addNamespace("foxml", FOXML_NS);
XPathFactory factory = XPathFactory.newInstance();
xpath = factory.newXPath();
xpath.setNamespaceContext(nsCtx);
}
代码示例来源:origin: fcrepo3/fcrepo
public Foxml11Document(String pid) throws Exception {
DocumentBuilder builder = null;
try {
builder = XmlTransformUtility.borrowDocumentBuilder();
DOMImplementation impl = builder.getDOMImplementation();
doc = impl.createDocument(FOXML_NS, "foxml:digitalObject", null);
rootElement = doc.getDocumentElement();
rootElement.setAttributeNS("http://www.w3.org/2000/xmlns/",
"xmlns:xsi",
"http://www.w3.org/1999/XMLSchema-instance");
rootElement.setAttributeNS("http://www.w3.org/1999/XMLSchema-instance",
"xsi:schemaLocation",
"info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd");
rootElement.setAttribute("VERSION", "1.1");
rootElement.setAttribute("PID", pid);
} finally {
if (builder != null) {
XmlTransformUtility.returnDocumentBuilder(builder);
}
}
NamespaceContextImpl nsCtx = new NamespaceContextImpl();
nsCtx.addNamespace("foxml", FOXML_NS);
XPathFactory factory = XPathFactory.newInstance();
xpath = factory.newXPath();
xpath.setNamespaceContext(nsCtx);
}
代码示例来源:origin: fcrepo3/fcrepo
if (documentBuilder != null) XmlTransformUtility.returnDocumentBuilder(documentBuilder);
doc.setXmlVersion("1.0");
代码示例来源:origin: fcrepo3/fcrepo
public static byte[] fedoraXMLHashFormat(byte[] data) throws Exception {
ReadableCharArrayWriter writer = new ReadableCharArrayWriter();
DocumentBuilder builder = XmlTransformUtility.borrowDocumentBuilder();
try {
Document doc = builder.parse(new ByteArrayInputStream(data));
XercesXmlSerializers.writeXmlNoSpace(doc, "UTF-8", writer);
writer.close();
} finally {
XmlTransformUtility.returnDocumentBuilder(builder);
}
BufferedReader br =
new BufferedReader(writer.toReader());
String line = null;
ReadableByteArrayOutputStream outStream = new ReadableByteArrayOutputStream();
OutputStreamWriter sb = new OutputStreamWriter(outStream, "UTF-8");
while ((line = br.readLine()) != null) {
line = line.trim();
sb.write(line);
}
sb.close();
return outStream.toByteArray();
}
代码示例来源:origin: fcrepo3/fcrepo
out.close();
} finally {
if (builder != null) XmlTransformUtility.returnDocumentBuilder(builder);
代码示例来源:origin: org.fcrepo/fcrepo-server
out.close();
} finally {
if (builder != null) XmlTransformUtility.returnDocumentBuilder(builder);
代码示例来源:origin: fcrepo3/fcrepo
} finally {
if (domParser != null) {
XmlTransformUtility.returnDocumentBuilder(domParser);
代码示例来源:origin: org.fcrepo/fcrepo-server
} finally {
if (domParser != null) {
XmlTransformUtility.returnDocumentBuilder(domParser);
本文整理了Java中org.fcrepo.utilities.XmlTransformUtility.parseWithoutValidating()方法的一些代码示例,展示了XmlTransform
本文整理了Java中org.fcrepo.utilities.XmlTransformUtility.returnDocumentBuilder()方法的一些代码示例,展示了XmlTransformU
本文整理了Java中org.fcrepo.utilities.XmlTransformUtility.returnTransformerFactory()方法的一些代码示例,展示了XmlTransfo
本文整理了Java中org.fcrepo.utilities.XmlTransformUtility.borrowDocumentBuilder()方法的一些代码示例,展示了XmlTransformU
本文整理了Java中org.fcrepo.utilities.XmlTransformUtility.parseNamespaceAware()方法的一些代码示例,展示了XmlTransformUti
本文整理了Java中org.fcrepo.utilities.XmlTransformUtility.getTransformer()方法的一些代码示例,展示了XmlTransformUtility.
本文整理了Java中org.fcrepo.utilities.XmlTransformUtility.borrowTransformerFactory()方法的一些代码示例,展示了XmlTransfo
我是一名优秀的程序员,十分优秀!