axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/message SOAPSAXHandler.java
Date Tue, 01 May 2001 22:04:41 GMT
gdaniels    01/05/01 15:04:41

  Modified:    java/src/org/apache/axis/message SOAPSAXHandler.java
  Log:
  Start roughing in ID/HREF support.  This likely will get a little complicated,
  since we can easily imagine being in the midst of deserializing an element
  when we find that we need another one by ID - so we'll then need to
  record SAX events, popping out as far as we need to on the element
  stack, until we hit the desired thing, then play back all the events we
  recorded....
  
  Revision  Changes    Path
  1.4       +27 -1     xml-axis/java/src/org/apache/axis/message/SOAPSAXHandler.java
  
  Index: SOAPSAXHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPSAXHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SOAPSAXHandler.java	2001/04/29 00:38:26	1.3
  +++ SOAPSAXHandler.java	2001/05/01 22:04:39	1.4
  @@ -95,6 +95,7 @@
       private static final int TARGET_NONE    = 0;
       private static final int TARGET_HEADER  = 1;
       private static final int TARGET_BODY    = 2;
  +    private static final int TARGET_ID      = 3;
       
       protected int state = INITIAL_STATE;
       private boolean parsedEnvelope = false;
  @@ -105,6 +106,7 @@
       // target element (header or body)
       private String targetNS = null;
       private String targetName = null;
  +    private String targetID = null;
       private int targetType = TARGET_NONE;
       private MessageElement targetElement = null;
       private boolean foundTarget = false;
  @@ -197,6 +199,22 @@
           parse();
       }
       
  +    public MessageElement parseForID(String id)
  +    {
  +        if (state == FINISHED)
  +            return null;
  +        
  +        targetID = id;
  +        targetType = TARGET_ID;
  +        
  +        // Because we set the target, this will stop once we hit the
  +        // desired element.
  +        parse();
  +        
  +        targetType = TARGET_NONE;
  +        
  +        return targetElement;
  +    }
       
       public SOAPHeader parseForHeader(String namespace, String localPart)
       {
  @@ -230,7 +248,7 @@
           this.targetType = TARGET_BODY;
   
           // Because we set the target, this will stop once we hit the
  -        // desired header.
  +        // desired body element.
           parse();
           
           this.targetType = TARGET_NONE;
  @@ -487,6 +505,14 @@
               // Let the event stream run until the end of this element,
               // sending the events to an appropriate handler.
               if (element != null) {
  +                
  +                if (targetType == TARGET_ID) {
  +                    if (targetID.equals(element.getID())) {
  +                        targetElement = element;
  +                        foundTarget = true;
  +                    }
  +                }
  +                
                   element.setEnvelope(envelope);
                   pushElementHandler(element.getContentHandler());
                   element.setPrefix(namespaces.getPrefix(namespace));
  
  
  

Mime
View raw message