forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r722889 - /forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
Date Wed, 03 Dec 2008 14:00:51 GMT
Author: thorsten
Date: Wed Dec  3 06:00:51 2008
New Revision: 722889

URL: http://svn.apache.org/viewvc?rev=722889&view=rev
Log:
Fixing various issues with the properties recording (should work fine again).

Modified:
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java?rev=722889&r1=722888&r2=722889&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
(original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
Wed Dec  3 06:00:51 2008
@@ -57,10 +57,12 @@
 import org.apache.cocoon.environment.SourceResolver;
 import org.apache.cocoon.transformation.AbstractSAXTransformer;
 import org.apache.cocoon.util.TraxErrorHandler;
+import org.apache.cocoon.xml.XMLUtils;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceException;
 import org.apache.excalibur.source.SourceValidity;
 import org.apache.excalibur.xml.sax.SAXParser;
+import org.apache.excalibur.xml.sax.XMLizable;
 import org.apache.forrest.dispatcher.api.Contract;
 import org.apache.forrest.dispatcher.api.Resolver;
 import org.apache.forrest.dispatcher.api.Structurer;
@@ -244,6 +246,8 @@
 
   private InputStream dataStream;
 
+  private String prefixString;
+
   /*
    * @see
    * org.apache.cocoon.transformation.AbstractSAXTransformer#configure(org.apache
@@ -389,9 +393,11 @@
       throws SAXException {
     // Process start element event
     // Are we inside of properties? If so we need to record the elements.
+    
     if (this.insideProperties && this.includeNodes) {
       // just start the recording
-      startSerializedXMLRecording(null);
+      super.startElement(uri, name, raw, attr);
+     //startSerializedXMLRecording(null);
     } else if (Captions.NS.equals(uri)) {
       // we are in the dispatcher ns
       try {
@@ -399,7 +405,7 @@
          * We are in the dispatcher ns.
          */
         getLogger().debug("Starting dispatcher element: " + raw);
-        if (Captions.STRUCTURER_ELEMENT.equals(name)) {
+        if (Captions.STRUCTURE_ELEMENT.equals(name)) {
           // we are in a structurer definition
           structurerProcessingStart(attr);
         }
@@ -434,6 +440,7 @@
    */
   public void endElement(String uri, String name, String raw)
       throws SAXException {
+    System.out.println();
     getLogger().debug("Ending element: " + raw);
     if (Captions.NS.equals(uri)) {
       // we are in the dispatcher ns
@@ -444,6 +451,7 @@
         } else if (Captions.HOOK_ELEMENT.equals(name) && this.includeNodes) {
           // we are inside a hook end element
           // FIXME Implement
+          System.out.println("FIXME Implement ");
         } else if (Captions.CONTRACT_ELEMENT.equals(name) && this.includeNodes) {
           // we are inside a contract end element
           contractProcessingEnd();
@@ -452,8 +460,9 @@
           if (allowXml) {
             String property = null;
             try {
-              super.endElement(uri, name, raw);
-              property = super.endSerializedXMLRecording();
+              property = prefixString+super.endSerializedXMLRecording()+"</forrest:property>";
+              insideProperties = false;
+              System.out.println("super.endSerializedXMLRecording(): "+property);
             } catch (ProcessingException e) {
               throw new SAXException(e);
             }
@@ -462,6 +471,7 @@
             }
           } else {
             // FIXME Implement
+            System.out.println("FIXME Implement ");
           }
         }
       } catch (ContractException e) {
@@ -473,7 +483,7 @@
       } catch (XMLStreamException e) {
         throw new SAXException(e);
       }
-    } else if (!this.insideProperties && this.includeNodes) {
+    } else if (this.insideProperties && this.includeNodes) {
       super.endElement(uri, name, raw);
     }
   }
@@ -546,7 +556,7 @@
         }
       } else {
         // lookup the node where we want to inject the result part
-        xpath = PATH_PREFIX + xpath;
+        xpath = "/" + PATH_PREFIX + xpath;
         // we need to feed the xpathSelector with the ns we may have
         AXIOMXPathCreate xpathSelector = new AXIOMXPathCreate(xpath);
         // add all namespaces that are known to the selector
@@ -601,6 +611,7 @@
   private void structurerProcessingEnd(String raw) {
     if (includeNodes) {
       // FIXME: implement
+      System.out.println("FIXME Implement "); 
     }
 
   }
@@ -619,9 +630,11 @@
       Attributes attr) throws SAXException {
     // determine the name and a possible value
     String id = null, value = null;
+    String attributesString ="";
     for (int i = 0; i < attr.getLength(); i++) {
       String localName = attr.getLocalName(i);
       String localValue = attr.getValue(i);
+      attributesString += " "+localName+"=\""+localValue+"\"";
       if (Captions.NAME_ATT.equals(localName)) {
         id = localValue;
       } else if (Captions.VALUE_ATT.equals(localName)) {
@@ -630,9 +643,9 @@
     }
     // if we allow xml properties we will just record them
     if (allowXml) {
-      // just start the recording
-      startSerializedXMLRecording(null);
-      super.startElement(uri, name, raw, attr);
+   // just start the recording
+      prefixString = "<"+raw+attributesString+">";
+      startSerializedXMLRecording(XMLUtils.createPropertiesForXML(true));
       currentProperty = id;
     } else {
       // if we do not allow xml we will use a simple key/value approach



Mime
View raw message