axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/message/events CharactersEvent.java EndElementEvent.java IDElementEvent.java SAXEvent.java StartElementEvent.java
Date Sat, 28 Apr 2001 13:52:17 GMT
rubys       01/04/28 06:52:17

  Modified:    java/src/org/apache/axis/handlers MsgDispatchHandler.java
               java/src/org/apache/axis/message ElementRecorder.java
                        RPCParam.java
               java/src/org/apache/axis/message/events CharactersEvent.java
                        EndElementEvent.java IDElementEvent.java
                        SAXEvent.java StartElementEvent.java
  Log:
  Add the ability to output an ElementRecorder to a SerializationContext
  
  Revision  Changes    Path
  1.19      +0 -2      xml-axis/java/src/org/apache/axis/handlers/MsgDispatchHandler.java
  
  Index: MsgDispatchHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/MsgDispatchHandler.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- MsgDispatchHandler.java	2001/04/27 15:24:25	1.18
  +++ MsgDispatchHandler.java	2001/04/28 13:52:15	1.19
  @@ -119,8 +119,6 @@
   
         SOAPEnvelope  reqEnv  = (SOAPEnvelope) reqMsg.getAs("SOAPEnvelope");
         
  -      System.err.println("Parsed the request message!");
  -      
         SOAPBodyElement reqBody = reqEnv.getFirstBody();
         Message       resMsg  = msgContext.getResponseMessage();
         SOAPEnvelope  resEnv  = (resMsg == null) ?
  
  
  
  1.2       +19 -0     xml-axis/java/src/org/apache/axis/message/ElementRecorder.java
  
  Index: ElementRecorder.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/ElementRecorder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ElementRecorder.java	2001/04/26 22:53:39	1.1
  +++ ElementRecorder.java	2001/04/28 13:52:15	1.2
  @@ -57,7 +57,9 @@
   
   import org.xml.sax.*;
   import org.apache.axis.message.events.*;
  +import org.apache.axis.encoding.*;
   import java.util.*;
  +import java.io.*;
   
   /** This guy records the basic SAX events into an event queue.  Then it can
    * play them back to any SAX ContentHandler.
  @@ -122,6 +124,23 @@
           while (e.hasMoreElements()) {
               SAXEvent event = (SAXEvent)e.nextElement();
               event.publishToHandler(handler);
  +        }
  +    }
  +
  +    /** 
  +      * Output all but the last element to a context.
  +      * Note: last element is presumably the end-element
  +      */
  +    public void output(SerializationContext context) 
  +        throws IOException
  +    {
  +        Enumeration e = _events.elements();
  +        if (e.hasMoreElements()) {
  +            SAXEvent event = (SAXEvent)e.nextElement();
  +            while (e.hasMoreElements()) {
  +                event.output(context);
  +                event = (SAXEvent)e.nextElement();
  +            }
           }
       }
   }
  
  
  
  1.3       +2 -0      xml-axis/java/src/org/apache/axis/message/RPCParam.java
  
  Index: RPCParam.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCParam.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RPCParam.java	2001/04/27 18:53:19	1.2
  +++ RPCParam.java	2001/04/28 13:52:15	1.3
  @@ -212,6 +212,8 @@
           // Output the value...
           if (val != null)
               context.writeString(value.toString());
  +        else if (value instanceof ElementRecorder)
  +            ((ElementRecorder)value).output(context);
           
           context.endElement();
       }
  
  
  
  1.2       +8 -0      xml-axis/java/src/org/apache/axis/message/events/CharactersEvent.java
  
  Index: CharactersEvent.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/events/CharactersEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CharactersEvent.java	2001/04/26 22:53:42	1.1
  +++ CharactersEvent.java	2001/04/28 13:52:16	1.2
  @@ -60,6 +60,9 @@
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   
  +import org.apache.axis.encoding.SerializationContext;
  +import java.io.IOException;
  +
   /** A <code>CharactersElementEvent</code>
    * 
    * @author Glen Daniels (gdaniels@allaire.com)
  @@ -82,5 +85,10 @@
       public void publishToHandler(ContentHandler handler) throws SAXException
       {
           handler.characters(_characters, _start, _length);
  +    }
  +    
  +    public void output(SerializationContext context) throws IOException
  +    {
  +        context.writeChars(_characters, _start, _length);
       }
   }
  
  
  
  1.2       +15 -0     xml-axis/java/src/org/apache/axis/message/events/EndElementEvent.java
  
  Index: EndElementEvent.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/events/EndElementEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EndElementEvent.java	2001/04/26 22:53:42	1.1
  +++ EndElementEvent.java	2001/04/28 13:52:16	1.2
  @@ -60,6 +60,9 @@
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   
  +import org.apache.axis.encoding.SerializationContext;
  +import java.io.IOException;
  +
   /** An <code>EndElementEvent</code>
    * 
    * @author Glen Daniels (gdaniels@allaire.com)
  @@ -81,5 +84,17 @@
       public void publishToHandler(ContentHandler handler) throws SAXException
       {
           handler.endElement(_namespace, _localPart, _qName);
  +    }
  +    
  +    public void output(SerializationContext context) throws IOException
  +    {
  +        context.writeString("</");
  +        if (_namespace!=null && _namespace.length()>0) {
  +          // FIXME: this really should be using a NSStack...
  +          context.writeString(_namespace);
  +          context.writeString(":");
  +        }
  +        context.writeString(_localPart);
  +        context.writeString(">");
       }
   }
  
  
  
  1.2       +8 -0      xml-axis/java/src/org/apache/axis/message/events/IDElementEvent.java
  
  Index: IDElementEvent.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/events/IDElementEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IDElementEvent.java	2001/04/26 22:53:42	1.1
  +++ IDElementEvent.java	2001/04/28 13:52:16	1.2
  @@ -61,6 +61,9 @@
   import org.xml.sax.SAXException;
   import org.apache.axis.message.MessageElement;
   
  +import org.apache.axis.encoding.SerializationContext;
  +import java.io.IOException;
  +
   /** An <code>IDElementEvent</code> represents hitting a sub-element
    * with an ID set, which means the engine put it into another MessageElement.
    * 
  @@ -83,5 +86,10 @@
       public void publishToHandler(ContentHandler handler) throws SAXException
       {
           _target.publishToHandler(handler);
  +    }
  +    
  +    public void output(SerializationContext context) throws IOException
  +    {
  +        _target.output(context);
       }
   }
  
  
  
  1.2       +6 -0      xml-axis/java/src/org/apache/axis/message/events/SAXEvent.java
  
  Index: SAXEvent.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/events/SAXEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SAXEvent.java	2001/04/26 22:53:42	1.1
  +++ SAXEvent.java	2001/04/28 13:52:16	1.2
  @@ -58,6 +58,9 @@
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   
  +import org.apache.axis.encoding.SerializationContext;
  +import java.io.IOException;
  +
   /** This is a simple interface for classes which store cached SAX events.
    * Each implementing class should keep some representation of the particular
    * event it reflects, and know how to "replay" that event to a ContentHandler.
  @@ -68,4 +71,7 @@
   {
       public void publishToHandler(ContentHandler handler)
           throws SAXException;
  +
  +    public void output(SerializationContext context)
  +        throws IOException;
   }
  
  
  
  1.2       +24 -0     xml-axis/java/src/org/apache/axis/message/events/StartElementEvent.java
  
  Index: StartElementEvent.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/events/StartElementEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StartElementEvent.java	2001/04/26 22:53:42	1.1
  +++ StartElementEvent.java	2001/04/28 13:52:16	1.2
  @@ -60,6 +60,9 @@
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   
  +import org.apache.axis.encoding.SerializationContext;
  +import java.io.IOException;
  +
   /** A <code>StartElementEvent</code>
    * 
    * @author Glen Daniels (gdaniels@allaire.com)
  @@ -84,5 +87,26 @@
       public void publishToHandler(ContentHandler handler) throws SAXException
       {
           handler.startElement(_namespace, _localPart, _qName, _attributes);
  +    }
  +    
  +    public void output(SerializationContext context) throws IOException
  +    {
  +        context.writeString("<");
  +        if (_namespace!=null && _namespace.length()>0) {
  +          // FIXME: this really should be using a NSStack...
  +          context.writeString(_namespace);
  +          context.writeString(":");
  +        }
  +        context.writeString(_localPart);
  +        for (int i=0; i<_attributes.getLength(); i++) {
  +           context.writeString(" ");
  +          // FIXME: this really should be namespace aware
  +           context.writeString(_attributes.getLocalName(i));
  +           context.writeString("=\"");
  +          // FIXME: this really should be properly escaped...
  +           context.writeString(_attributes.getValue(i));
  +           context.writeString("\"");
  +        }
  +        context.writeString(">");
       }
   }
  
  
  

Mime
View raw message