Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the current URL for JAXB Bindings XML Schema?

Tags:

java

xml

jaxb

xjc

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?

like image 835
lpacheco Avatar asked May 15 '15 13:05

lpacheco


People also ask

What is JAXB binding file?

JAXB stands for Java Architecture for XML Binding.

What is XJB file in JAXB?

xjb extension to resolve any conflicts in the WSDL or schema. For example if two elements have the same name and you want to distinguish between them you can rename one by specifying it the bindings file.

Is XJC a JAXB?

7.1. The JAXB-2 Maven plugin uses the JDK-supplied tool XJC, a JAXB Binding compiler tool that generates Java classes from XSD (XML Schema Definition). By default, this plugin locates XSD files in src/main/xsd.

How use XJC command line?

Open a command prompt. Run the JAXB schema compiler, xjc command from the directory where the schema file is located. The xjc schema compiler tool is located in the app_server_root \bin\ directory. Use the generated JAXB objects within a Java application to manipulate XML content through the generated JAXB classes.


1 Answers

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 https://www.oracle.com/webfolder/technetwork/jsc/xml/ns/jaxb/bindingschema_2_0.xsd">

</jaxb:bindings>
like image 165
Seb T Avatar answered Sep 22 '22 02:09

Seb T