8
votes

I'm trying to automate the generation of Java classes from XML DTD using xjc. The generated Java classes must be serializable. The articles that help with that add a pointer to a bindings file that uses the schema at http://java.sun.com/xml/ns/jaxb for the JAXB namespace, but that URL doesn't work anymore.

The URL http://java.sun.com/xml/ns/jaxb redirects to http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/jaxb/index.html which in turn says that http://java.sun.com/xml/ns/jaxb is the latest URL but links to http://www.oracle.com/xml/ns/jaxb/ that also redirects to http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/jaxb/index.html.

A bit confusing.

I've found tutorials at Oracle updated in 2014 that still use that URL, and I didn't find any other. Does anyone have a more up to date info?

1
XML namespaces has nothing to do with HTTP servers. It is unspoken convention use HTTP URL as distributed unique names. - gavenkoa

1 Answers

10
votes

This works for me:

<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:jaxb='http://java.sun.com/xml/ns/jaxb' version='2.1'
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/jaxb/bindingschema_2_0.xsd">

</jaxb:bindings>