Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JBrowser Source Code Files
JBrowser Source Code Files are provided in the
source package file.
You can download JBrowser source package as described in the previous tutorial and go to the "src" sub-folder to view Source Code files.
You can also browse JBrowser Source Code files below:
✍: FYIcenter
⏎ org/mozilla/browser/impl/DOMUtils.java
package org.mozilla.browser.impl;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.StringWriter;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
/**
* utility functions for DOM manipulation
*/
public class DOMUtils
{
public static void writeDOMToFile(Document doc, File f)
throws IOException
{
OutputStream os = null;
try {
os = new BufferedOutputStream(new FileOutputStream(f));
writeDOMToStream(doc, os);
}
finally {
if (os!=null) os.close();
}
}
public static String writeDOMToString(Document doc)
{
try {
StringWriter w = new StringWriter();
try {
StreamResult sr = new StreamResult(w);
writeDOMToSource(doc, sr, "UTF-8"); //$NON-NLS-1$
return w.toString();
}
finally {
if (w!=null) w.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public static String writeDOMToString(Node n)
{
try {
StringWriter w = new StringWriter();
try {
StreamResult sr = new StreamResult(w);
writeDOMToSource(n, sr, "UTF-8"); //$NON-NLS-1$
return w.toString();
} finally {
if (w!=null) w.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public static void writeDOMToStream(Document doc,
OutputStream os)
throws IOException
{
writeDOMToStream(doc, os, "UTF-8"); //$NON-NLS-1$
}
public static void writeDOMToStream(Node n,
OutputStream os)
throws IOException
{
StreamResult sr = new StreamResult(os);
writeDOMToSource(n, sr, "UTF-8"); //$NON-NLS-1$
}
public static void writeDOMToStream(Document doc,
OutputStream os,
String encoding)
throws IOException
{
StreamResult sr = new StreamResult(os);
writeDOMToSource(doc, sr, encoding);
}
public static void writeDOMToSource(Node n,
StreamResult sr,
String encoding)
throws IOException
{
try {
//create transformer
TransformerFactory trf = TransformerFactory.newInstance();
Transformer tr = trf.newTransformer();
tr.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
tr.setOutputProperty(OutputKeys.ENCODING, encoding);
tr.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
//serialize DOM
tr.transform(new DOMSource(n), sr);
}
catch (TransformerException e) {
//wrap to IOException
IOException ioe = new IOException();
ioe.initCause(e);
throw ioe;
}
}
}
⏎ org/mozilla/browser/impl/DOMUtils.java
Or download all of them as a single archive file:
File name: jbrowser-1.9-fyi.zip File size: 625318 bytes Release date: 2022-11-10 Download
⇐ Download and Install JBrowser Source Package
2017-07-17, ≈46🔥, 1💬
Popular Posts:
JDK 17 java.sql.rowset.jmod is the JMOD file for JDK 17 SQL Rowset module. JDK 17 SQL Rowset module ...
JDK 11 jdk.internal.opt.jmod is the JMOD file for JDK 11 Internal Opt module. JDK 11 Internal Opt mo...
JAX-WS is an API for building web services and clients. It is the next generation Web Services API r...
JDK 11 java.naming.jmod is the JMOD file for JDK 11 Naming module. JDK 11 Naming module compiled cla...
jTDS JDBC Driver Source Code Files are provided in the source package file, jtds-1.3.1-fyi.zip. You ...