1 22 package org.jboss.xb.binding.sunday.xop; 23 24 import javax.xml.namespace.QName ; 25 import javax.xml.namespace.NamespaceContext ; 26 import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; 27 import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; 28 import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; 29 import org.jboss.xb.binding.sunday.unmarshalling.DefaultHandlers; 30 import org.xml.sax.Attributes ; 31 32 36 public class XOPElementHandler 37 implements ParticleHandler 38 { 39 public Object startParticle(Object parent, 40 QName elementName, 41 ParticleBinding particle, 42 Attributes attrs, 43 NamespaceContext nsCtx) 44 { 45 ElementBinding element = (ElementBinding)particle.getTerm(); 46 XOPUnmarshaller xopUnmarshaller = element.getXopUnmarshaller(); 47 if(xopUnmarshaller == null || !xopUnmarshaller.isXOPPackage()) 48 { 49 return null; 50 } 51 else 52 { 53 return new XOPElement(); 54 } 55 } 56 57 public Object endParticle(Object o, QName elementName, ParticleBinding particle) 58 { 59 return o instanceof XOPElement ? ((XOPElement)o).value : o; 60 } 61 62 public void setParent(Object parent, 63 Object o, 64 QName elementName, 65 ParticleBinding particle, 66 ParticleBinding parentParticle) 67 { 68 if(parent == o) 69 { 70 return; 71 } 72 73 DefaultHandlers.ELEMENT_HANDLER.setParent(parent, o, elementName, particle, parentParticle); 75 } 76 77 public static class XOPElement 78 { 79 public Object value; 80 } 81 } 82 | Popular Tags |