1 package com.sun.tools.xjc.runtime; 2 3 import org.dom4j.DocumentFactory; 4 import org.dom4j.Element; 5 import org.dom4j.io.SAXContentHandler; 6 import org.xml.sax.Attributes ; 7 import org.xml.sax.SAXException ; 8 9 18 public class Dom4jUnmarshallingEventHandler extends UnmarshallingEventHandlerAdaptor { 19 private Element owner; 20 21 public Dom4jUnmarshallingEventHandler(UnmarshallingContext _ctxt) throws SAXException { 22 super(_ctxt, new SAXContentHandler(new DocumentFactory())); 23 } 24 25 public void enterElement(String uri, String local, String qname, Attributes atts) throws SAXException { 26 super.enterElement(uri, local, qname, atts); 27 if( owner==null ) 28 owner = ((SAXContentHandler)handler).getDocument().getRootElement(); 29 } 30 31 public Object owner() { 32 return owner; 33 } 34 public Element getOwner() { 35 return owner; 36 } 37 } 38 | Popular Tags |