How to Use XML Namespaces
To declare an XML namespace at the Java package level, create a file called package-info.java in the package's directory and declare the namespace using the @XmlSchema annotation like this (no class declaration needed):
@javax.xml.bind.annotation.XmlSchema(namespace="http://example.jarfiller.com")
package com.jarfiller.example;
Alternatively, you can also declare the schema separately for each class as well as for the XML root element:
@XmlRootElement(namespace="http://example.jarfiller.com")
@XmlType(namespace="http://example.jarfiller.com")
public class MovieLibrary {
public List<Movie> collection;
}
@XmlType(namespace="http://example.jarfiller.com")
public class Movie {
public String title;
public int releaseYear;
}

