cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: rev 53982 - in cocoon/trunk/src/java/org/apache/cocoon: components/sax xml
Date Thu, 07 Oct 2004 14:39:15 GMT
Author: vgritsenko
Date: Thu Oct  7 07:39:14 2004
New Revision: 53982

Modified:
   cocoon/trunk/src/java/org/apache/cocoon/components/sax/XMLByteStreamFragment.java
   cocoon/trunk/src/java/org/apache/cocoon/xml/SaxBuffer.java
Log:
SaxBuffer: implement XMLFragment in case someone needs toDOM.
XMLByteStreamFragment: cleanup.


Modified: cocoon/trunk/src/java/org/apache/cocoon/components/sax/XMLByteStreamFragment.java
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/sax/XMLByteStreamFragment.java	(original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/sax/XMLByteStreamFragment.java	Thu
Oct  7 07:39:14 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,9 +26,8 @@
  * store SAX events and insert them in an XSP result using <xsp:expr>.
  *
  * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
- * @version CVS $Id: XMLByteStreamFragment.java,v 1.2 2004/03/05 13:02:50 bdelacretaz Exp
$
+ * @version CVS $Id$
  */
-
 public class XMLByteStreamFragment extends AbstractSAXFragment {
 
     /** The XML byte stream */
@@ -41,27 +40,17 @@
      * @param bytes the XML byte stream representing the document fragment
      */
     public XMLByteStreamFragment(Object bytes) {
-        xmlBytes = bytes;
+        this.xmlBytes = bytes;
     }
 
     /**
      * Output the fragment. If the fragment is a document, start/endDocument
      * events are discarded.
      */
-    public void toSAX(ContentHandler ch)
-      throws SAXException {
-
+    public void toSAX(ContentHandler ch) throws SAXException {
         // Stream bytes and discard start/endDocument
-        XMLByteStreamInterpreter interp = new XMLByteStreamInterpreter();
-        EmbeddedXMLPipe pipe = new EmbeddedXMLPipe(ch);
-
-        // If ch is an XMLConsumer, set it as such so that XML comments are
-        // also deserialized.
-        if (ch instanceof XMLConsumer)
-            pipe.setConsumer((XMLConsumer) ch);
-
-        interp.setContentHandler(pipe);
-
-        interp.deserialize(xmlBytes);
+        XMLByteStreamInterpreter deserializer = new XMLByteStreamInterpreter();
+        deserializer.setContentHandler(new EmbeddedXMLPipe(ch));
+        deserializer.deserialize(this.xmlBytes);
     }
 }

Modified: cocoon/trunk/src/java/org/apache/cocoon/xml/SaxBuffer.java
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/xml/SaxBuffer.java	(original)
+++ cocoon/trunk/src/java/org/apache/cocoon/xml/SaxBuffer.java	Thu Oct  7 07:39:14 2004
@@ -48,7 +48,8 @@
  *
  * @version CVS $Id$
  */
-public class SaxBuffer implements XMLConsumer, XMLizable, Recyclable, Serializable {
+public class SaxBuffer extends AbstractSAXFragment
+                       implements XMLConsumer, Recyclable, Serializable {
 
     /**
      * Stores list of {@link SaxBit} objects.

Mime
View raw message