Jaxb custom binding with eclipse
-
02-07-2021 - |
Question
I have a jaxb custom bindings file in eclipse (named binding.xjb) and while it opens in the xml editor it won't provide content assist for any of the namespaces I have imported. This makes it very difficult to check the validity of the file.
The top of the file looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings version="2.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xs="http://www.w3.org/2001/XMLSchema">`
Anybody got any idea what I need to do to get content-assist working for this file?
Thanks
UPDATE: Following on from Blaises answer (below), I set:
Location: http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd KeyType: Namespace name Key http://java.sun.com/xml/ns/jaxb
and now I can see content assist in eclipse.
La solution
If you register an XML schema in the Eclipse XML catalog, then the XML editor will give you content assist when you create a corresponding root element with the appropriate namespace qualification. Below are the clicks for doing this in Eclipse Juno:
- Open Preferences Window:
Eclipse
|Preferences
- Preferences Window:
XML
|XML Catalog
|Add