4,10 → 4,10 |
* Coded by: Group 5, software practice summer 2003 |
* University of Bielefeld, Germany |
* |
* @version $Revision: 1.66 $ |
* @version $Revision: 1.67 $ |
* |
* Last modification: $Date: 2003/07/26 11:29:27 $ |
* $Id: OurDocument.java,v 1.66 2003/07/26 11:29:27 smcsporr Exp $ |
* Last modification: $Date: 2003/07/26 11:48:47 $ |
* $Id: OurDocument.java,v 1.67 2003/07/26 11:48:47 smcsporr Exp $ |
*/ |
|
package src.document; |
44,7 → 44,7 |
* |
* @author S. McSporran |
* |
* @version $Revision: 1.66 $ Last modification: $Date: 2003/07/26 11:29:27 $ |
* @version $Revision: 1.67 $ Last modification: $Date: 2003/07/26 11:48:47 $ |
*/ |
public class OurDocument { |
|
266,7 → 266,7 |
|
String namespaceTarget = ""; |
|
if ((schemaFile == null) && (changeDoc.getDocumentElement().hasAttribute("xsi:schemaLocation"))) { |
if (schemaFile == null) { |
Element rootElement = changeDoc.getDocumentElement(); |
rootElement.removeAttribute("xsi:schemaLocation"); |
myDocument = changeDoc; |
318,8 → 318,11 |
|
/* Set the document parameter as source for the transformation. */ |
DOMSource dSource = new DOMSource(changeDoc); |
String oldDocType = null; |
|
String oldDocType = changeDoc.getDoctype().getName(); |
if (changeDoc.getDoctype() != null) { |
oldDocType = changeDoc.getDoctype().getName(); |
} |
|
/* Save the transformation result to a string buffer. */ |
StringWriter strWriter = new StringWriter(); |
338,17 → 341,23 |
|
/* Get the buffer associated with the StringWriter outputWr. */ |
String bufferString = strWriter.getBuffer().toString(); |
|
|
aParser.parse(bufferString); |
myDocument = aParser.getDocument(); |
|
|
/* Operation: Change DTD. */ |
if (dtdFile != null) { |
log(LogInterface.TYPE_INFO, "DTD changed to: " + myDocument.getDoctype().getSystemId()); |
} else { |
log(LogInterface.TYPE_INFO, "DTD "+ oldDocType + " removed."); |
} |
|
/* Operation: Remove DTD. */ |
else { |
if (oldDocType != null) { |
log(LogInterface.TYPE_INFO, "DTD "+ oldDocType + " removed."); |
} |
} |
} |
|
|
/* Catch and log transformation errors. */ |
catch (TransformerException te) { |
log(LogInterface.TYPE_ERROR, "Transformation error: " + te.getMessage()); |
418,7 → 427,7 |
|
/* Adds the DOCTYPE-entry to the file to save (if present). */ |
if (((saveDoc.getDoctype()) != null) && (saveDoc.getDoctype().getInternalSubset() |
== null)) { |
== null)) { |
String docTypeFile = (new File(saveDoc.getDoctype().getSystemId())).getName(); |
docTransformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, docTypeFile); |
} |