Closed andham closed 6 years ago
Do you mean that the input argument (i.e. "-encoding ") from the plugin to Schemagen is incorrect (i.e. always UTF-8) or does the Schemagen tool output UTF-8 irrespective of its inbound arguments?
The input argument looks right but the xsd is generated with the wrong encoding declared. I noticed this while working on something else and created this ticket just to keep track. It could be that I'm just doing something wrong.
I suspected as much.
During the course of working with the jaxb2-maven-plugin, I have found a few configuration options which simply seem to be ignored by Schemagen (despite being mentioned in its documentation).
I will investigate a little closer (i.e. debug into the Schemagen codebase) to investigate how the configuration option is treated internally. Maybe there is an undocumented way to make this happen.
However - generally, I prefer to open a ticket against the Schemagen tool in the JDK instead of making the jaxb2-maven-plugin rely on internal or undocumented features.
This seems indeed to be another bug within schemagen
- or else I am understanding its encoding
parameter incorrectly.
Running the command below, when explicitly defining the encoding to iso-8859-1:
schemagen -encoding ISO-8859-1 src/main/java/se/west/gnat/Foo.java
... yields the following XSD file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="foo">
<xs:sequence>
<xs:element name="bar" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Reading the help of schemagen, I realize that the parameter may simply be used to indicate which encoding the underlying compilation - which yields the information for the XSD file synthesis - has. If so, the parameter is rather odd, since it does not affect the encoding of the emitted XSD.
I recommend bringing this up with the JDK team.
-encoding <encoding> : specify encoding to be used for apt/javac invocation
Regardless if I don't configure an encoding or if I do specify one (ISO-8859-1 e.g.), the XSD generated by schemagen is always UTF-8.
Seen with v2.3 of the plugin on Windows 7 with Maven 3.3.3 and IBM JDK 7.