1 16 17 package org.apache.axis.encoding.ser; 18 19 import org.apache.axis.MessageContext; 20 import org.apache.axis.components.logger.LogFactory; 21 import org.apache.axis.encoding.DeserializationContext; 22 import org.apache.axis.encoding.DeserializerImpl; 23 import org.apache.axis.message.MessageElement; 24 import org.apache.axis.utils.Messages; 25 import org.apache.commons.logging.Log; 26 import org.xml.sax.SAXException ; 27 28 import java.util.List ; 29 30 36 public class ElementDeserializer extends DeserializerImpl 37 { 38 protected static Log log = 39 LogFactory.getLog(ElementDeserializer.class.getName()); 40 41 public static final String DESERIALIZE_CURRENT_ELEMENT = "DeserializeCurrentElement"; 42 43 public final void onEndElement(String namespace, String localName, 44 DeserializationContext context) 45 throws SAXException 46 { 47 try { 48 MessageElement msgElem = context.getCurElement(); 49 if ( msgElem != null ) { 50 MessageContext messageContext = context.getMessageContext(); 51 Boolean currentElement = (Boolean ) messageContext.getProperty(DESERIALIZE_CURRENT_ELEMENT); 52 if (currentElement != null && currentElement.booleanValue()) { 53 value = msgElem.getAsDOM(); 54 messageContext.setProperty(DESERIALIZE_CURRENT_ELEMENT, Boolean.FALSE); 55 return; 56 } 57 List children = msgElem.getChildren(); 58 if ( children != null ) { 59 msgElem = (MessageElement) children.get(0); 60 if ( msgElem != null ) 61 value = msgElem.getAsDOM(); 62 } 63 } 64 } 65 catch( Exception exp ) { 66 log.error(Messages.getMessage("exception00"), exp); 67 throw new SAXException ( exp ); 68 } 69 } 70 } 71 | Popular Tags |