return newText;
} // end else if
else if (node.getNodeType() == Node.ENTITY_NODE) {
Entity oldText = (Entity) node;
String text = getChildAsText(oldText);
Entity newText = new CEntity("!ENTITY " + oldText.getNodeName()
+ " \"" + text + "\"", oldText.getNodeName(), oldText
.getNotationName(), text, oldText.getPublicId(), oldText
.getSystemId(), false, document);
return newText;
} // end else if
else if (node.getNodeType() == Node.NOTATION_NODE) {
Notation oldText = (Notation) node;
if (oldText.getPublicId() != null) {
Notation newText = new CNotation("!NOTATION "
+ oldText.getNodeName() + " PUBLIC \""
+ oldText.getPublicId() + "\" \""
+ oldText.getSystemId() + "\"", oldText.getNodeName(),
oldText.getPublicId(), oldText.getSystemId(), document);
return newText;
} else {
Notation newText = new CNotation("!NOTATION "
+ oldText.getNodeName() + " SYSTEM \""
+ oldText.getSystemId() + "\"", oldText.getNodeName(),
oldText.getPublicId(), oldText.getSystemId(), document);
return newText;
}
} // end else if
else if (node.getNodeType() == Node.COMMENT_NODE) {
Comment oldComment = (Comment) node;
Comment newComment = new CComment(oldComment.getNodeValue(),
document);
newNode = newComment;
} // end else if
else if (node.getNodeType() == Node.CDATA_SECTION_NODE) {
CDATASection newCData = new CCDATASection(node.getNodeValue(),
document);
newNode = newCData;
} // end else if
else if (node.getNodeType() == Node.DOCUMENT_TYPE_NODE) {
if (node.getClass() == CDocType.class) {
try {
CDocType o2 = (CDocType) ((CDocType) node).clone();
o2.setOwnerDocument(document);
o2.setParent(null);
newNode = o2;
} catch (CloneNotSupportedException e) {
}
} else {
DocumentType old = (DocumentType) node;
String pi = old.getPublicId();
String si = old.getSystemId();
String is = old.getInternalSubset();
StringBuffer content = new StringBuffer();
content.append("!DOCTYPE ");
content.append(old.getName());
if (pi != null) {
content.append(" PUBLIC \"");
content.append(pi);
content.append("\" ");
if (si != null) {
content.append("\"");
content.append(si);
content.append("\" ");
}
} else if (si != null) {
content.append(" SYSTEM \"");
content.append(si);
content.append("\" ");
}
if (is != null) {
content.append("[\n");
content.append(is);
content.append("]");
}
CDocType dt = new CDocType(content.toString(), old.getName(),
old.getPublicId(), old.getSystemId(), document);
dt.isReadOnly = false;
CNamedNodeMap dtent = (CNamedNodeMap) dt.getEntities();
dtent.setFreeze(false);
NamedNodeMap nnm = old.getEntities();
for (int i = 0; i < nnm.getLength(); i++) {
CEntity ent = (CEntity) _CloneNode(document, nnm.item(i),
deep, importNotSpecified);
dtent.setNamedItem(ent);
}
dtent.setFreeze(true);
CNamedNodeMap dnot = (CNamedNodeMap) dt.getNotations();