Problem with xsd:schema for xmlns:jaxb

已回答

I have an XSD with the following schema definition:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0">

Where http://java.sun.com/xml/ns/jaxb gave an error asking me to register it in Settings/LanguagesAndFrameworks/SchemasAndDTDs, which I did.  Then it threw the following error in the xsd:schema:

Expecting namespace 'http://java.sun.com/xml/ns/jaxb', but the target namespace of the schema document is 'null'.

Any ideas about what is the problem and how to solve it?

I am on Ultimate 2022.2.4.

 

 

 

1

You can get the schema at http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd and map it manually like this:

 

0

So you are saying that instead of referencing a URI on the web you are suggesting I download the bindingschema_2_0.xsd, put it somewhere in my filesystem, then tell IntelliJ to map it as an external schemal to that specific file. 

Seems weird, but it works and I think that is what you mean.  Is that correct?

 

0

You can also use this code:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd">

 

Then fetch the external resource for the xsd file using alt+enter menu.

0

请先登录再写评论。