forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r700022 - /forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java
Date Mon, 29 Sep 2008 08:09:45 GMT
Author: thorsten
Date: Mon Sep 29 01:09:45 2008
New Revision: 700022

URL: http://svn.apache.org/viewvc?rev=700022&view=rev
Log:
Using the enhanced properties treatment. Looking if the value is of type InputSource. If so
we will request a DOM represent of the source. If not we will pass a simple String.

Modified:
    forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java

Modified: forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java?rev=700022&r1=700021&r2=700022&view=diff
==============================================================================
--- forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java
(original)
+++ forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java
Mon Sep 29 01:09:45 2008
@@ -70,20 +70,26 @@
     transformer.setOutputProperty(OutputKeys.INDENT, "yes");
     transformer.setOutputProperty(OutputKeys.METHOD, "xml");
     // do we allow xml properties?
-    if(!allowXmlProperties){
+    if(allowXmlProperties){
+      DocumentBuilder builder = DocumentBuilderFactory.newInstance()
+      .newDocumentBuilder();
       for (Iterator<String> iter = params.keySet().iterator(); iter.hasNext();) {
         String key = iter.next();
-        String value = (String) params.get(key);
-        transformer.setParameter(key,value);
+        Class<InputSource> source = InputSource.class;
+        Object value = params.get(key);
+        if (source.isInstance(value)){
+          transformer.setParameter(key, builder.parse((InputSource)value));
+        }else{
+          transformer.setParameter(key,value);
+        }
       }
     }else{
-      DocumentBuilder builder = DocumentBuilderFactory.newInstance()
-      .newDocumentBuilder();
       for (Iterator<String> iter = params.keySet().iterator(); iter.hasNext();) {
         String key = iter.next();
-        InputSource source = (InputSource) params.get(key);
-        transformer.setParameter(key, builder.parse(source));
+        String value = (String) params.get(key);
+        transformer.setParameter(key,value);
       }
+      
     }
   }
 



Mime
View raw message