1 package org.apache.axis.encoding.ser; 2 3 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 35 public class DocumentDeserializer extends DeserializerImpl 36 { 37 protected static Log log = 38 LogFactory.getLog(DocumentDeserializer.class.getName()); 39 40 public static final String DESERIALIZE_CURRENT_ELEMENT = "DeserializeCurrentElement"; 41 42 public final void onEndElement(String namespace, String localName, 43 DeserializationContext context) 44 throws SAXException 45 { 46 try { 47 MessageElement msgElem = context.getCurElement(); 48 if ( msgElem != null ) { 49 MessageContext messageContext = context.getMessageContext(); 50 Boolean currentElement = (Boolean ) messageContext.getProperty(DESERIALIZE_CURRENT_ELEMENT); 51 if (currentElement != null && currentElement.booleanValue()) { 52 value = msgElem.getAsDocument(); 53 messageContext.setProperty(DESERIALIZE_CURRENT_ELEMENT, Boolean.FALSE); 54 return; 55 } 56 List children = msgElem.getChildren(); 57 if ( children != null ) { 58 msgElem = (MessageElement) children.get(0); 59 if ( msgElem != null ) 60 value = msgElem.getAsDocument(); 61 } 62 } 63 } 64 catch( Exception exp ) { 65 log.error(Messages.getMessage("exception00"), exp); 66 throw new SAXException ( exp ); 67 } 68 } 69 } 70 | Popular Tags |