/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// J2SE1.4 feature
// import java.nio.charset.Charset;
// import java.nio.charset.UnsupportedCharsetException;
/**
* Partial default <tt>Marshaller</tt> implementation.
*
* <p>
* This class provides a partial default implementation for the
* {@link javax.xml.bind.Marshaller} interface.
*
* <p>
* The only methods that a JAXB Provider has to implement are
* {@link Marshaller#marshal(Object, javax.xml.transform.Result) marshal(Object, javax.xml.transform.Result)},
* {@link Marshaller#marshal(Object, javax.xml.transform.Result) marshal(Object, javax.xml.stream.XMLStreamWriter)}, and
* {@link Marshaller#marshal(Object, javax.xml.transform.Result) marshal(Object, javax.xml.stream.XMLEventWriter)}.
*
* @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li></ul>
* @see javax.xml.bind.Marshaller
* @since JAXB1.0
*/
{
/** handler that will be used to process errors and warnings during marshal */
//J2SE1.4 feature
//private Charset encoding = null;
/** store the value of the encoding property. */
/** store the value of the schemaLocation property. */
/** store the value of the noNamespaceSchemaLocation property. */
/** store the value of the formattedOutput property. */
private boolean formattedOutput = false;
/** store the value of the fragment property. */
private boolean fragment = false;
throws JAXBException {
}
try {
try {
} finally {
}
} catch (IOException e) {
throw new JAXBException(e);
}
}
throws JAXBException {
}
throws JAXBException {
}
throws JAXBException {
}
/**
* By default, the getNode method is unsupported and throw
* an {@link java.lang.UnsupportedOperationException}.
*
* Implementations that choose to support this method must
* override this method.
*/
throw new UnsupportedOperationException();
}
/**
* Convenience method for getting the current output encoding.
*
* @return the current encoding or "UTF-8" if it hasn't been set.
*/
return encoding;
}
/**
* Convenience method for setting the output encoding.
*
* @param encoding a valid encoding as specified in the Marshaller class
* documentation
*/
}
/**
* Convenience method for getting the current schemaLocation.
*
* @return the current schemaLocation or null if it hasn't been set
*/
return schemaLocation;
}
/**
* Convenience method for setting the schemaLocation.
*
* @param location the schemaLocation value
*/
}
/**
* Convenience method for getting the current noNamespaceSchemaLocation.
*
* @return the current noNamespaceSchemaLocation or null if it hasn't
* been set
*/
return noNSSchemaLocation;
}
/**
* Convenience method for setting the noNamespaceSchemaLocation.
*
* @param location the noNamespaceSchemaLocation value
*/
}
/**
* Convenience method for getting the formatted output flag.
*
* @return the current value of the formatted output flag or false if
* it hasn't been set.
*/
protected boolean isFormattedOutput() {
return formattedOutput;
}
/**
* Convenience method for setting the formatted output flag.
*
* @param v value of the formatted output flag.
*/
protected void setFormattedOutput( boolean v ) {
formattedOutput = v;
}
/**
* Convenience method for getting the fragment flag.
*
* @return the current value of the fragment flag or false if
* it hasn't been set.
*/
protected boolean isFragment() {
return fragment;
}
/**
* Convenience method for setting the fragment flag.
*
* @param v value of the fragment flag.
*/
protected void setFragment( boolean v ) {
fragment = v;
}
"UTF-8", "UTF8",
"UTF-16", "Unicode",
"UTF-16BE", "UnicodeBigUnmarked",
"UTF-16LE", "UnicodeLittleUnmarked",
"US-ASCII", "ASCII",
"TIS-620", "TIS620",
// taken from the project-X parser
"ISO-10646-UCS-2", "Unicode",
"EBCDIC-CP-US", "cp037",
"EBCDIC-CP-CA", "cp037",
"EBCDIC-CP-NL", "cp037",
"EBCDIC-CP-WT", "cp037",
"EBCDIC-CP-DK", "cp277",
"EBCDIC-CP-NO", "cp277",
"EBCDIC-CP-FI", "cp278",
"EBCDIC-CP-SE", "cp278",
"EBCDIC-CP-IT", "cp280",
"EBCDIC-CP-ES", "cp284",
"EBCDIC-CP-GB", "cp285",
"EBCDIC-CP-FR", "cp297",
"EBCDIC-CP-AR1", "cp420",
"EBCDIC-CP-HE", "cp424",
"EBCDIC-CP-BE", "cp500",
"EBCDIC-CP-CH", "cp500",
"EBCDIC-CP-ROECE", "cp870",
"EBCDIC-CP-YU", "cp870",
"EBCDIC-CP-IS", "cp871",
"EBCDIC-CP-AR2", "cp918",
// IANA also defines two that JDK 1.2 doesn't handle:
// EBCDIC-CP-GR --> CP423
// EBCDIC-CP-TR --> CP905
};
/**
* Gets the corresponding Java encoding name from an IANA name.
*
* This method is a helper method for the derived class to convert
* encoding names.
*
* @exception UnsupportedEncodingException
* If this implementation couldn't find the Java encoding name.
*/
try {
return encoding;
} catch( UnsupportedEncodingException e ) {
// try known alias
return aliases[i+1];
}
}
throw new UnsupportedEncodingException(encoding);
}
/* J2SE1.4 feature
try {
this.encoding = Charset.forName( _encoding );
} catch( UnsupportedCharsetException uce ) {
throw new JAXBException( uce );
}
*/
}
/**
* Default implementation of the setProperty method handles
* the four defined properties in Marshaller. If a provider
* needs to handle additional properties, it should override
* this method in a derived class.
*/
throws PropertyException {
throw new IllegalArgumentException(
}
// recognize and handle four pre-defined properties.
return;
}
return;
}
return;
}
return;
}
return;
}
}
/**
* Default implementation of the getProperty method handles
* the four defined properties in Marshaller. If a provider
* needs to support additional provider specific properties,
* it should override this method in a derived class.
*/
throws PropertyException {
throw new IllegalArgumentException(
}
// recognize and handle four pre-defined properties.
return getEncoding();
return getNoNSSchemaLocation();
return getSchemaLocation();
throw new PropertyException(name);
}
/**
* @see javax.xml.bind.Marshaller#getEventHandler()
*/
return eventHandler;
}
/**
* @see javax.xml.bind.Marshaller#setEventHandler(ValidationEventHandler)
*/
throws JAXBException {
} else {
}
}
/*
* assert that the given object is a Boolean
*/
throw new PropertyException(
}
/*
* assert that the given object is a String
*/
throw new PropertyException(
}
/*
* assert that the parameters are not null
*/
throw new IllegalArgumentException(
}
throw new IllegalArgumentException(
}
}
throws JAXBException {
throw new UnsupportedOperationException();
}
throws JAXBException {
throw new UnsupportedOperationException();
}
throw new UnsupportedOperationException();
}
throw new UnsupportedOperationException();
}
throw new IllegalArgumentException();
}
throw new UnsupportedOperationException();
}
throw new UnsupportedOperationException();
}
throw new UnsupportedOperationException();
}
throw new UnsupportedOperationException();
}
throw new UnsupportedOperationException();
}
throw new UnsupportedOperationException();
}
}