Thanks Michael, I'm curious for my own factory designs. I like the classpath .jar search approach as you describe it as otherwise it is contrived to have to modify the source code of the Factory class each time a new source is implemented.
I would guess that the DOMImplementationRegistry caches some kind of reference to DOM implementation provider (e.g. Xerces-J) the first time it is asked, so that subsequent requests down incur the time overhead of repeating the same search. Thanks, Rob Michael Glavassevich wrote: > > > Hi Rob, > > Rob Davis-5 <[EMAIL PROTECTED]> wrote on 07/16/2008 12:43:15 PM: > >> There is a method addSource on the DOMImplementationRegistry to add a > source >> i.e. register but I have searched the Xerces code and its not used. >> http://java.sun.com/j2se/1.5. >> 0/docs/api/org/w3c/dom/bootstrap/DOMImplementationRegistry.html >> >> When I build Xerces-J and DOM W3C interface libraries together it just > seems >> automatic that Xerces-J is used. But how? > > DOMImplementationRegistry.newInstance() [1] will search the jars on the > classpath for a file called " > META-INF/services/org.w3c.dom.DOMImplementationSourceList" and will find > it > in xercesImpl.jar. An instance of the class listed in this file will be > added to the registry. If xercesImpl.jar were missing this file it would > still add "org.apache.xerces.dom.DOMXSImplementationSourceImpl" to the > registry because it is hard coded as the fallback implementation if none > was found while searching the classpath. > >> -- >> View this message in context: http://www.nabble.com/How-does-Xerces- >> J-register-with-the-W3C-DOMImplementationRegistry-factory-- >> tp18491710p18491710.html >> Sent from the Xerces - J - Users mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] > > Thanks. > > [1] > http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/bootstrap/DOMImplementationRegistry.html#newInstance() > > > Michael Glavassevich > XML Parser Development > IBM Toronto Lab > E-mail: [EMAIL PROTECTED] > E-mail: [EMAIL PROTECTED] > -- View this message in context: http://www.nabble.com/How-does-Xerces-J-register-with-the-W3C-DOMImplementationRegistry-factory--tp18491710p18506983.html Sent from the Xerces - J - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]