cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/transformation WriteDOMSessionTransformer.java
Date Wed, 26 Sep 2001 13:03:23 GMT
cziegeler    01/09/26 06:03:23

  Modified:    src/org/apache/cocoon/transformation
                        WriteDOMSessionTransformer.java
  Log:
  This patch fixes a bug in the WriteDOMSessionTransformer, which does not currently build
xml documents with namespaces correctly.
  Submitted by: Greg Weinger [gweinger@itmedicine.net]
  
  Revision  Changes    Path
  1.4       +25 -3     xml-cocoon2/src/org/apache/cocoon/transformation/WriteDOMSessionTransformer.java
  
  Index: WriteDOMSessionTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/transformation/WriteDOMSessionTransformer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WriteDOMSessionTransformer.java	2001/08/20 13:55:17	1.3
  +++ WriteDOMSessionTransformer.java	2001/09/26 13:03:23	1.4
  @@ -26,6 +26,8 @@
   
   import java.io.IOException;
   import java.util.Map;
  +import java.util.HashMap;
  +import java.util.Iterator;
   
   
   /**
  @@ -42,7 +44,7 @@
    *   dom-root-element is the trigger that will be the root element of the DOM
    *
    * @author <a href="mailto:sven.beauprez@the-ecorp.com">Sven Beauprez</a>
  - * @version CVS $Revision: 1.3 $ $Date: 2001/08/20 13:55:17 $ $Author: dims $
  + * @version CVS $Revision: 1.4 $ $Date: 2001/09/26 13:03:23 $ $Author: cziegeler $
    */
   
   public class WriteDOMSessionTransformer extends AbstractTransformer implements 
  @@ -63,6 +65,7 @@
   
       private String DOMName;
       private String rootElement;
  +  	private Map storedPrefixMap;
   
       /** BEGIN SitemapComponent methods **/
   
  @@ -81,6 +84,7 @@
                               DOMName + "; " + WriteDOMSessionTransformer.DOM_ROOT_ELEMENT
+ "=" +
                               rootElement);
             sessionAvailable = true;
  +					storedPrefixMap = new HashMap();  
           } else  {
             getLogger().error("WriteSessionTransformer: need " + WriteDOMSessionTransformer.DOM_NAME
+
                               " and " + WriteDOMSessionTransformer.DOM_ROOT_ELEMENT + " parameters");
  @@ -116,7 +120,9 @@
         super.startPrefixMapping(prefix,uri);
         if (buildDom)  {
           builder.startPrefixMapping(prefix,uri);
  -      }
  +      } else {
  +				storePrefixMapping(prefix,uri);
  +			}
       }
   
       public void startElement(String uri, String name, String raw, Attributes attributes)
  @@ -127,6 +133,7 @@
             buildDom = true;
             builder = new DOMBuilder(parser);
             builder.startDocument();
  +					launchStoredMappings();
             builder.startElement(uri,name,raw,attributes);
           } else if (buildDom)  {
             builder.startElement(uri,name,raw,attributes);
  @@ -176,6 +183,21 @@
   
       /** END SAX ContentHandler handlers **/
   
  + 	  protected void storePrefixMapping(String prefix, String uri) {  
  +		   storedPrefixMap.put(prefix,uri);  
  +   	}  
  +	
  +	  protected void launchStoredMappings() 
  +		throws SAXException {  
  +		    Iterator it = storedPrefixMap.keySet().iterator();
  +				while(it.hasNext()) {  
  +					String pre = (String)it.next();
  +					String uri = (String)storedPrefixMap.get(pre);
  +					getLogger().debug("WriteSessionTransformer: launching prefix mapping[ pre: "+pre+"
uri: "+uri+" ]");
  +					builder.startPrefixMapping(pre,uri);
  +				} 
  +		} 
  +
   
   
  -}
  \ No newline at end of file
  +}
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message