4

Can I set a jaxb provider programmatically in a JAVA SE application (not web application)?

I'm looking for other approach instead jaxb.properties file with javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory

Cœur
  • 37,241
  • 25
  • 195
  • 267
CelinHC
  • 1,857
  • 2
  • 27
  • 36

1 Answers1

6

You could do the following:

import javax.xml.bind.*;
import org.eclipse.persistence.jaxb.JAXBContextFactory;

public class Demo {

    public static void main(String[] args) throws Exception {
        JAXBContext jc = JAXBContextFactory.createContext(new Class[] {Metadata.class}, null);

}
bdoughan
  • 147,609
  • 23
  • 300
  • 400
  • Thanks, but i would like to change the default internal provider "com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl" – CelinHC Jan 17 '14 at 12:55