Hehe...I was going there...thus the reason I asked JAXB vs JAXB2...but I didn't follow up ;-) Glad the solution bubbled itself up ;-)
Jeff David Blevins wrote: > On Jul 17, 2006, at 8:54 PM, Jeff Genender wrote: > >> JAXB or JAXB2? >> >> David Blevins wrote: >>> I have the start of support for the EJB3 ejb-jar.xml worked in using >>> JAXB. It's working great and the itests run, the only trick is it >>> *only* supports ejb3 descriptors, i.e. you *must* have this at the top >>> of your ejb-jar.xml >>> >>> <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" ...> >>> >>> Using the previous namespace or using no namespace at all no longer >>> works. This might be easy to solve, but I'm quite a JAXB novice. >>> >>> The namespace info comes from an annotation in a package-info.java >>> class. Don't know if there is some other way to specify it or override >>> the annotation. >>> >>> Any know how we might do this? > > Mr. Genender you totally read this email completely neglected to mention > you found a solution to this problem in the persistence code you wrote! :) > > I just happened across this wile reworking it to not generate each time: > > <snip> > // Create a filter to intercept events > PersistenceFilter xmlFilter = new PersistenceFilter(xmlReader); > > // Be sure the filter has the JAXB content handler set (or > it wont > // work) > xmlFilter.setContentHandler(uh); > SAXSource source = new SAXSource(xmlFilter, new > InputSource(persistenceDescriptor)); > [...] > // Inject the proper namespace > class PersistenceFilter extends XMLFilterImpl { > > public PersistenceFilter(XMLReader arg0) { > super(arg0); > } > > @Override > public void startElement(String arg0, String arg1, String arg2, > Attributes arg3) throws SAXException { > super.startElement("http://java.sun.com/xml/ns/persistence", > arg1, arg2, arg3); > } > } > </snip> > > This is totally going to work for our ejb-jar.xml parsing too. > > I'm a happy man. > > -David
