soapical.util
Class SAXToSOAPElement

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended bysoapical.util.SAXToSOAPElement
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, SoapkitConstants

public class SAXToSOAPElement
extends org.xml.sax.helpers.DefaultHandler
implements SoapkitConstants

A SAX2 ContentHandler which converts the input tree into a SOAPElement.

Easy way:

 // Reader yourStuff;
 // SOAPEnvelope yourEnvelope; 
 
 // if you just want a regular SOAPElement:
 SOAPElement se = Soapkit.toSOAPElement( yourStuff );
 
 // if you want to create a SOAPBodyElement: 
 SOAPBody soapBody = yourEnvelope.getBody();
 SOAPBodyElement sbe = 
   Soapkit.toSOAPBodyElement( soapBody, yourStuff );

 // if you want to create a SOAPHeaderElement:
 SOAPHeader soapHeader = yourEnvelope.getHeader();
 SOAPHeaderElement she = 
   Soapkit.toSOAPHeaderElement( soapHeader, yourStuff );
 

Not-so-easy way: use this like a regular ContentHandler, and call getLastParse to get the results.

Version:
$Revision: 1.1.1.1 $
$Date: 2003/04/21 09:43:18 $
Author:
Eric Kow (kow at loria point fr)
See Also:
Soapkit

Field Summary
 
Fields inherited from interface soapical.util.SoapkitConstants
XMLNS
 
Constructor Summary
SAXToSOAPElement()
          Use this constructor if you just want to create a regular SOAPElement.
SAXToSOAPElement(javax.xml.soap.SOAPBody body)
          Use this constructor if you want to parse into a SOAPBodyElement.
SAXToSOAPElement(javax.xml.soap.SOAPHeader header)
          Use this constructor if you want to parse into a SOAPHeaderElement.
 
Method Summary
 void characters(char[] ch, int start, int len)
           
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
           
 void endPrefixMapping(java.lang.String prefix)
           
 javax.xml.soap.SOAPElement getLastParse()
          Returns a SOAPElement representing the XML most recently parsed with this SAXToSOAPElement
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
           
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXToSOAPElement

public SAXToSOAPElement()
                 throws javax.xml.soap.SOAPException
Use this constructor if you just want to create a regular SOAPElement.


SAXToSOAPElement

public SAXToSOAPElement(javax.xml.soap.SOAPBody body)
                 throws javax.xml.soap.SOAPException
Use this constructor if you want to parse into a SOAPBodyElement.

Parameters:
body - the parent of the SOAPBodyElement you want to create

SAXToSOAPElement

public SAXToSOAPElement(javax.xml.soap.SOAPHeader header)
                 throws javax.xml.soap.SOAPException
Use this constructor if you want to parse into a SOAPHeaderElement.

Parameters:
header - the parent of the SOAPHeaderElement you want to create
Method Detail

getLastParse

public javax.xml.soap.SOAPElement getLastParse()
Returns a SOAPElement representing the XML most recently parsed with this SAXToSOAPElement

Returns:
the last produced SOAPElement or null if there was none

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int len)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException