Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 839 → Rev 840

/sun/xmleditor/trunk/src/document/OurDocument.java
4,10 → 4,10
* Coded by: Group 5, software practice summer 2003
* University of Bielefeld, Germany
*
* @version $Revision: 1.65 $
* @version $Revision: 1.66 $
*
* Last modification: $Date: 2003/07/26 10:56:21 $
* $Id: OurDocument.java,v 1.65 2003/07/26 10:56:21 smcsporr Exp $
* Last modification: $Date: 2003/07/26 11:29:27 $
* $Id: OurDocument.java,v 1.66 2003/07/26 11:29:27 smcsporr Exp $
*/
package src.document;
44,7 → 44,7
*
* @author S. McSporran
*
* @version $Revision: 1.65 $ Last modification: $Date: 2003/07/26 10:56:21 $
* @version $Revision: 1.66 $ Last modification: $Date: 2003/07/26 11:29:27 $
*/
public class OurDocument {
326,55 → 326,33
PrintWriter outputWr = new PrintWriter(strWriter);
StreamResult sResult = new StreamResult(outputWr);
 
if (dtdFile == null) {
try {
try {
if (dtdFile != null) {
/* Set the 'DOCTYPE' entry in the XML file. */
docTransformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, dtdFile.getPath());
} else {
}
log(LogInterface.TYPE_INFO, "dtdFile null");
/* Transform the document, delete any DOCTYPE entry. */
docTransformer.transform(dSource,sResult);
/* Transform the document, delete any DOCTYPE entry. */
docTransformer.transform(dSource,sResult);
/* Get the buffer associated with the StringWriter outputWr. */
String bufferString = strWriter.getBuffer().toString();
/* Get the buffer associated with the StringWriter outputWr. */
String bufferString = strWriter.getBuffer().toString();
aParser.parse(bufferString);
myDocument = aParser.getDocument();
aParser.parse(bufferString);
myDocument = aParser.getDocument();
if (dtdFile != null) {
log(LogInterface.TYPE_INFO, "DTD changed to: " + myDocument.getDoctype().getSystemId());
} else {
log(LogInterface.TYPE_INFO, "DTD "+ oldDocType + " removed.");
}
/* Catch and log transformation errors. */
catch (TransformerException te){
log(LogInterface.TYPE_ERROR,"Transformer error: " + te.getMessage());
}
} else {
log(LogInterface.TYPE_INFO, "dtdFile non-null");
/* Process an identity transform with the parameter DTD file. */
String docTypeFile = dtdFile.getPath();
/* Set the 'DOCTYPE' entry in the XML file. */
docTransformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, dtdFile.getPath());
try {
docTransformer.transform(dSource,sResult);
 
/* Get the buffer associated with the StringWriter outputWr. */
String bufferString = strWriter.getBuffer().toString();
 
/* Parse the document and set it as the instances document. */
aParser.parse(bufferString);
myDocument = aParser.getDocument();
log(LogInterface.TYPE_INFO, "DTD changed to: " + myDocument.getDoctype().getSystemId());
}
/* Catch and log transformation errors. */
catch (TransformerException te) {
log (LogInterface.TYPE_ERROR, "Transformation error: " + te.getMessage());
}
}
/* Catch and log transformation errors. */
catch (TransformerException te) {
log(LogInterface.TYPE_ERROR, "Transformation error: " + te.getMessage());
}
}
/**
410,13 → 388,11
String docTypeFile = (new File(saveDoc.getDoctype().getSystemId())).getName();
docTransformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, docTypeFile);
}
 
try {
/* Create an OutputStream from saveDoc with ftsi as output target. */
docTransformer.transform(dSource, strResult);
log(LogInterface.TYPE_INFO, "Document saved successfully.");
}
 
/* Catch and log exceptions thrown by the transformer. */
catch (TransformerException te) {
log(LogInterface.TYPE_ERROR, "Transformation error: " +
446,7 → 422,6
String docTypeFile = (new File(saveDoc.getDoctype().getSystemId())).getName();
docTransformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, docTypeFile);
}
 
try {
/* Create an OutputStream from saveDoc with ftsi as output target. */
docTransformer.transform(dSource, strResult);