deweese 2004/09/06 11:26:59 Modified: sources/org/apache/batik/dom GenericDocumentType.java sources/org/apache/batik/dom/svg SVGOMDocument.java sources/org/apache/batik/dom/util DOMUtilities.java Log: 1) Can now create a DocumentType node and if present DOMUtilities will now emit a proper doctype specification. Revision Changes Path 1.2 +1 -1 xml-batik/sources/org/apache/batik/dom/GenericDocumentType.java Index: GenericDocumentType.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/GenericDocumentType.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- GenericDocumentType.java 6 Sep 2004 00:01:58 -0000 1.1 +++ GenericDocumentType.java 6 Sep 2004 18:26:59 -0000 1.2 @@ -22,7 +22,7 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; -public class GenericDocumentType extends AbstractNode +public class GenericDocumentType extends AbstractChildNode implements DocumentType { protected String qualifiedName; 1.52 +7 -1 xml-batik/sources/org/apache/batik/dom/svg/SVGOMDocument.java Index: SVGOMDocument.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SVGOMDocument.java,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- SVGOMDocument.java 18 Aug 2004 07:13:15 -0000 1.51 +++ SVGOMDocument.java 6 Sep 2004 18:26:59 -0000 1.52 @@ -30,6 +30,7 @@ import org.apache.batik.dom.GenericCDATASection; import org.apache.batik.dom.GenericComment; import org.apache.batik.dom.GenericDocumentFragment; +import org.apache.batik.dom.GenericDocumentType; import org.apache.batik.dom.GenericElement; import org.apache.batik.dom.GenericEntityReference; import org.apache.batik.dom.GenericProcessingInstruction; @@ -121,6 +122,11 @@ public SVGOMDocument(DocumentType dt, DOMImplementation impl) { super(impl); if (dt != null) { + if (dt instanceof GenericDocumentType) { + GenericDocumentType gdt = (GenericDocumentType)dt; + if (gdt.getOwnerDocument() == null) + gdt.setOwnerDocument(this); + } appendChild(dt); } } 1.11 +16 -2 xml-batik/sources/org/apache/batik/dom/util/DOMUtilities.java Index: DOMUtilities.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/util/DOMUtilities.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- DOMUtilities.java 18 Aug 2004 07:13:37 -0000 1.10 +++ DOMUtilities.java 6 Sep 2004 18:26:59 -0000 1.11 @@ -25,6 +25,7 @@ import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; +import org.w3c.dom.DocumentType; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -115,7 +116,20 @@ w.write(n.getNodeValue()); w.write("-->"); break; - case Node.DOCUMENT_TYPE_NODE: + case Node.DOCUMENT_TYPE_NODE: { + DocumentType dt = (DocumentType)n; + w.write ("<!DOCTYPE "); + w.write (n.getOwnerDocument().getDocumentElement().getNodeName()); + String pubID = dt.getPublicId(); + if (pubID != null) { + w.write (" PUBLIC \"" + dt.getNodeName() + "\" \"" + + pubID + "\">"); + } else { + String sysID = dt.getSystemId(); + if (sysID != null) + w.write (" SYSTEM \"" + sysID + "\">"); + } + } break; default: throw new Error("Internal error (" + n.getNodeType() + ")");
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]