blob: 2e5efdc59acd8873e9b6cdd4863fc63a692f76d7 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_18) on Sun Apr 01 21:18:35 PDT 2012 -->
<TITLE>
DOM3Serializer
</TITLE>
<META NAME="keywords" CONTENT="org.apache.xml.serializer.DOM3Serializer interface">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="DOM3Serializer";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DOM3Serializer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../org/apache/xml/serializer/CharInfo.CharKey.html" title="class in org.apache.xml.serializer"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../org/apache/xml/serializer/DOMSerializer.html" title="interface in org.apache.xml.serializer"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/apache/xml/serializer/DOM3Serializer.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="DOM3Serializer.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.xml.serializer</FONT>
<BR>
Interface DOM3Serializer</H2>
<DL>
<DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../org/apache/xml/serializer/dom3/DOM3SerializerImpl.html" title="class in org.apache.xml.serializer.dom3">DOM3SerializerImpl</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public interface <A HREF="../../../../src-html/org/apache/xml/serializer/DOM3Serializer.html#line.115"><B>DOM3Serializer</B></A></DL>
</PRE>
<P>
This interface is not intended to be used
by an end user, but rather by an XML parser that is implementing the DOM
Level 3 Load and Save APIs.
<p>
See the DOM Level 3 Load and Save interface at <a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save.html#LS-LSSerializer">LSSeializer</a>.
For a list of configuration parameters for DOM Level 3 see <a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#DOMConfiguration">DOMConfiguration</a>.
For additional configuration parameters available with the DOM Level 3 Load and Save API LSSerializer see
<a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save.html#LS-LSSerializer-config">LSerializer config</a>.
<p>
The following example uses a DOM3Serializer indirectly, through an an XML
parser that uses this class as part of its implementation of the DOM Level 3
Load and Save APIs, and is the prefered way to serialize with DOM Level 3 APIs.
<p>
Example:
<pre>
public class TestDOM3 {
public static void main(String args[]) throws Exception {
// Get document to serialize
TestDOM3 test = new TestDOM3();
// Serialize using standard DOM Level 3 Load/Save APIs
System.out.println(test.testDOM3LS());
}
public org.w3c.dom.Document getDocument() throws Exception {
// Create a simple DOM Document.
javax.xml.parsers.DocumentBuilderFactory factory =
javax.xml.parsers.DocumentBuilderFactory.newInstance();
javax.xml.parsers.DocumentBuilder builder = factory.newDocumentBuilder();
byte[] bytes = "<parent><child/></parent>".getBytes();
java.io.InputStream is = new java.io.ByteArrayInputStream(bytes);
org.w3c.dom.Document doc = builder.parse(is);
return doc;
}
//
// This method uses standard DOM Level 3 Load Save APIs:
// org.w3c.dom.bootstrap.DOMImplementationRegistry
// org.w3c.dom.ls.DOMImplementationLS
// org.w3c.dom.ls.DOMImplementationLS
// org.w3c.dom.ls.LSSerializer
// org.w3c.dom.DOMConfiguration
//
// The only thing non-standard in this method is the value set for the
// name of the class implementing the DOM Level 3 Load Save APIs,
// which in this case is:
// org.apache.xerces.dom.DOMImplementationSourceImpl
//
public String testDOM3LS() throws Exception {
// Get a simple DOM Document that will be serialized.
org.w3c.dom.Document docToSerialize = getDocument();
// Get a factory (DOMImplementationLS) for creating a Load and Save object.
org.w3c.dom.ls.DOMImplementationLS impl =
(org.w3c.dom.ls.DOMImplementationLS)
org.w3c.dom.bootstrap.DOMImplementationRegistry.newInstance().getDOMImplementation("LS");
// Use the factory to create an object (LSSerializer) used to
// write out or save the document.
org.w3c.dom.ls.LSSerializer writer = impl.createLSSerializer();
org.w3c.dom.DOMConfiguration config = writer.getDomConfig();
config.setParameter("format-pretty-print", Boolean.TRUE);
// Use the LSSerializer to write out or serialize the document to a String.
String serializedXML = writer.writeToString(docToSerialize);
return serializedXML;
}
} // end of class TestDOM3
</pre>
<P>
<P>
<DL>
<DT><B>See Also:</B><DD><a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#DOMConfiguration">DOMConfiguration</a>,
<a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save.html#LS-LSSerializer-config">LSSerializer</a>,
<A HREF="../../../../org/apache/xml/serializer/Serializer.html" title="interface in org.apache.xml.serializer"><CODE>Serializer</CODE></A>,
<A HREF="../../../../org/apache/xml/serializer/DOMSerializer.html" title="interface in org.apache.xml.serializer"><CODE>DOMSerializer</CODE></A></DL>
<HR>
<P>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;org.w3c.dom.DOMErrorHandler</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/xml/serializer/DOM3Serializer.html#getErrorHandler()">getErrorHandler</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a DOMErrorHandler set on the DOM Level 3 Serializer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;org.w3c.dom.ls.LSSerializerFilter</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/xml/serializer/DOM3Serializer.html#getNodeFilter()">getNodeFilter</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a LSSerializerFilter set on the DOM Level 3 Serializer to filter nodes
during serialization.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/xml/serializer/DOM3Serializer.html#serializeDOM3(org.w3c.dom.Node)">serializeDOM3</A></B>(org.w3c.dom.Node&nbsp;node)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Serializes the Level 3 DOM node.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/xml/serializer/DOM3Serializer.html#setErrorHandler(org.w3c.dom.DOMErrorHandler)">setErrorHandler</A></B>(org.w3c.dom.DOMErrorHandler&nbsp;handler)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets a DOMErrorHandler on the DOM Level 3 Serializer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/xml/serializer/DOM3Serializer.html#setNewLine(char[])">setNewLine</A></B>(char[]&nbsp;newLine)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the end-of-line sequence of characters to be used during serialization</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/xml/serializer/DOM3Serializer.html#setNodeFilter(org.w3c.dom.ls.LSSerializerFilter)">setNodeFilter</A></B>(org.w3c.dom.ls.LSSerializerFilter&nbsp;filter)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets a LSSerializerFilter on the DOM Level 3 Serializer to filter nodes
during serialization.</TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="serializeDOM3(org.w3c.dom.Node)"><!-- --></A><H3>
serializeDOM3</H3>
<PRE>
void <A HREF="../../../../src-html/org/apache/xml/serializer/DOM3Serializer.html#line.125"><B>serializeDOM3</B></A>(org.w3c.dom.Node&nbsp;node)
throws java.io.IOException</PRE>
<DL>
<DD>Serializes the Level 3 DOM node. Throws an exception only if an I/O
exception occured while serializing.
This interface is a public API.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>node</CODE> - the Level 3 DOM node to serialize
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - if an I/O exception occured while serializing</DL>
</DD>
</DL>
<HR>
<A NAME="setErrorHandler(org.w3c.dom.DOMErrorHandler)"><!-- --></A><H3>
setErrorHandler</H3>
<PRE>
void <A HREF="../../../../src-html/org/apache/xml/serializer/DOM3Serializer.html#line.134"><B>setErrorHandler</B></A>(org.w3c.dom.DOMErrorHandler&nbsp;handler)</PRE>
<DL>
<DD>Sets a DOMErrorHandler on the DOM Level 3 Serializer.
This interface is a public API.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>handler</CODE> - the Level 3 DOMErrorHandler</DL>
</DD>
</DL>
<HR>
<A NAME="getErrorHandler()"><!-- --></A><H3>
getErrorHandler</H3>
<PRE>
org.w3c.dom.DOMErrorHandler <A HREF="../../../../src-html/org/apache/xml/serializer/DOM3Serializer.html#line.143"><B>getErrorHandler</B></A>()</PRE>
<DL>
<DD>Returns a DOMErrorHandler set on the DOM Level 3 Serializer.
This interface is a public API.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>A Level 3 DOMErrorHandler</DL>
</DD>
</DL>
<HR>
<A NAME="setNodeFilter(org.w3c.dom.ls.LSSerializerFilter)"><!-- --></A><H3>
setNodeFilter</H3>
<PRE>
void <A HREF="../../../../src-html/org/apache/xml/serializer/DOM3Serializer.html#line.153"><B>setNodeFilter</B></A>(org.w3c.dom.ls.LSSerializerFilter&nbsp;filter)</PRE>
<DL>
<DD>Sets a LSSerializerFilter on the DOM Level 3 Serializer to filter nodes
during serialization.
This interface is a public API.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>filter</CODE> - the Level 3 LSSerializerFilter</DL>
</DD>
</DL>
<HR>
<A NAME="getNodeFilter()"><!-- --></A><H3>
getNodeFilter</H3>
<PRE>
org.w3c.dom.ls.LSSerializerFilter <A HREF="../../../../src-html/org/apache/xml/serializer/DOM3Serializer.html#line.163"><B>getNodeFilter</B></A>()</PRE>
<DL>
<DD>Returns a LSSerializerFilter set on the DOM Level 3 Serializer to filter nodes
during serialization.
This interface is a public API.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>The Level 3 LSSerializerFilter</DL>
</DD>
</DL>
<HR>
<A NAME="setNewLine(char[])"><!-- --></A><H3>
setNewLine</H3>
<PRE>
void <A HREF="../../../../src-html/org/apache/xml/serializer/DOM3Serializer.html#line.169"><B>setNewLine</B></A>(char[]&nbsp;newLine)</PRE>
<DL>
<DD>Sets the end-of-line sequence of characters to be used during serialization
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>newLine</CODE> - The end-of-line sequence of characters to be used during serialization</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DOM3Serializer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../org/apache/xml/serializer/CharInfo.CharKey.html" title="class in org.apache.xml.serializer"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../org/apache/xml/serializer/DOMSerializer.html" title="interface in org.apache.xml.serializer"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/apache/xml/serializer/DOM3Serializer.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="DOM3Serializer.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>