Given the intitial XML (BPEL) file:
If you use the MOXy JAXB implementation you can do the following:
Your domain objects:
package example;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Process {
}
Use that package annotation @XmlSchema
@javax.xml.bind.annotation.XmlSchema(
namespace = "http://www.example.org",
xmlns = {
@javax.xml.bind.annotation.XmlNs(prefix = "xsd", namespaceURI = "http://www.w3.org/2001/XMLSchema"),
},
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package example;
To use MOXy JAXB you need to add a jaxb.properties file in with your model classes with the following entry:
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
This will produce the XML:
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://www.example.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>