error.fType = "no-output-specified";
error.fMessage = msg;
error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
ser.fDOMErrorHandler.handleError(error);
}
throw new LSException(LSException.SERIALIZE_ERR, msg);
}
else {
ser.setOutputByteStream(XMLEntityManager.createOutputStream(uri));
}
}
else {
// byte stream was specified
ser.setOutputByteStream(outputStream);
}
}
else {
// character stream is specified
ser.setOutputCharStream(writer);
}
if (node.getNodeType() == Node.DOCUMENT_NODE)
ser.serialize((Document) node);
else if (node.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)
ser.serialize((DocumentFragment) node);
else if (node.getNodeType() == Node.ELEMENT_NODE)
ser.serialize((Element) node);
else
return false;
}
catch( UnsupportedEncodingException ue) {
if (ser.fDOMErrorHandler != null) {
DOMErrorImpl error = new DOMErrorImpl();
error.fException = ue;
error.fType = "unsupported-encoding";
error.fMessage = ue.getMessage();
error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
ser.fDOMErrorHandler.handleError(error);
}
throw new LSException(LSException.SERIALIZE_ERR,
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.SERIALIZER_DOMAIN,
"unsupported-encoding", null));
//return false;
}