cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r123623 - /cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/XMLSerializer.java
Date Wed, 29 Dec 2004 10:50:53 GMT
Author: antonio
Date: Wed Dec 29 02:50:49 2004
New Revision: 123623

URL: http://svn.apache.org/viewcvs?view=rev&rev=123623
Log:
Use new method DocType.toString()
Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/XMLSerializer.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/XMLSerializer.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/XMLSerializer.java?view=diff&rev=123623&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/XMLSerializer.java&r1=123622&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/XMLSerializer.java&r2=123623
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/XMLSerializer.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/XMLSerializer.java
Wed Dec 29 02:50:49 2004
@@ -25,7 +25,6 @@
 
 /**
  *
- *
  * @author <a href="mailto:pier@apache.org">Pier Fumagalli</a>, February 2003
  * @version CVS $Id$
  */
@@ -39,12 +38,6 @@
     private static final char S_DOCUMENT_2[] = "\" encoding=\"".toCharArray();
     private static final char S_DOCUMENT_3[] = "\"?>".toCharArray();
 
-    private static final char S_DOCTYPE_1[] = "<!DOCTYPE ".toCharArray();
-    private static final char S_DOCTYPE_2[] = " PUBLIC \"".toCharArray();
-    private static final char S_DOCTYPE_3[] = "\" \"".toCharArray();
-    private static final char S_DOCTYPE_4[] = " SYSTEM \"".toCharArray();
-    private static final char S_DOCTYPE_5[] = "\">".toCharArray();
-
     private static final char S_ELEMENT_1[] = "=\"".toCharArray();
     private static final char S_ELEMENT_2[] = "</".toCharArray();
     private static final char S_ELEMENT_3[] = " />".toCharArray();
@@ -187,43 +180,20 @@
     public void body(String uri, String local, String qual)
     throws SAXException {
         this.processing_prolog = false;
-
         this.writeln();
 
         /* We have a document type. */
         if (this.doctype != null) {
 
             String root_name = this.doctype.getName();
-            String public_id = this.doctype.getPublicId();
-            String system_id = this.doctype.getSystemId();
-
             /* Check the DTD and the root element */
             if (!root_name.equals(qual)) {
                 throw new SAXException("Root element name \"" + root_name
                         + "\" declared by document type declaration differs "
                         + "from actual root element name \"" + qual + "\"");
             }
-
-            /* Output a <!DOCTYPE ...> declaration. */
-            this.write(S_DOCTYPE_1); // [<!DOCTYPE ]
-            this.write(root_name);
-            if (public_id != null) {
-                this.write(S_DOCTYPE_2); // [ PUBLIC "]
-                this.write(public_id);
-                /* This is wring in XML, but not in SGML/HTML */
-                if (system_id != null) {
-                    this.write(S_DOCTYPE_3); // [" "]
-                    this.write(system_id);
-                }
-                this.write(S_DOCTYPE_5); // [">]
-            } else if (system_id != null) {
-                this.write(S_DOCTYPE_4); // [ SYSTEM "]
-                this.write(system_id);
-                this.write(S_DOCTYPE_5); // [">]
-            } else {
-                this.write(C_GT); // [>]
-            }
-            this.writeln();
+            /* Output the <!DOCTYPE ...> declaration. */
+            this.write(this.doctype.toString());
         }
 
         /* Output all PIs and comments we cached in the prolog */

Mime
View raw message