FileDocCategorySizeDatePackage
DataFeedMessageSerializer.javaAPI DocExample2059Tue Jan 15 11:22:46 GMT 2002javasoap.book.ch6

DataFeedMessageSerializer

public class DataFeedMessageSerializer extends Object implements Deserializer, Serializer

Fields Summary
Constructors Summary
public DataFeedMessageSerializer()

  
Methods Summary
public voidmarshall(java.lang.String inScopeEncStyle, java.lang.Class javaType, java.lang.Object src, java.lang.Object context, java.io.Writer sink, NSStack nsStack, XMLJavaMappingRegistry xjmr, org.apache.soap.rpc.SOAPContext ctx)

    
    if(!javaType.equals(DataFeedMessage.class)) {
      throw new IllegalArgumentException(
        "Can only serialize javasoap.book.ch6.DataFeedMessage instances");
    }
    
    nsStack.pushScope();
    
    if (src != null)
    {
      SoapEncUtils.generateStructureHeader(inScopeEncStyle,
                                           javaType, context,
                                           sink, nsStack, xjmr);
      DataFeedMessage msg = (DataFeedMessage)src;
      String data = msg.toString();
      sink.write(data);
      sink.write("</" + context + '>");
    }
    else
    {
      SoapEncUtils.generateNullStructure(inScopeEncStyle,
                                           javaType, context,
                                           sink, nsStack, xjmr);
    }
    nsStack.popScope();
  
public Beanunmarshall(java.lang.String inScopeEncStyle, QName elementType, org.w3c.dom.Node src, XMLJavaMappingRegistry xjmr, org.apache.soap.rpc.SOAPContext ctx)

    
    Element elem = (Element)src;
    String value = DOMUtils.getChildCharacterData(elem);
    
    DataFeedMessage msg = null;
    if(value!=null && !((value=value.trim()).equals("")) {
       msg = new DataFeedMessage();
       msg.parseFormattedMessage(value);
    }
    return new Bean(DataFeedMessage.class, msg);