|
|
|
[
Permlink
| « Hide
]
Werner Guttmann - 14/Dec/07 04:04 AM
Raffaele can you please create a separate issue for the second problem ? We'd like to keep things as much separated and self-contained as possible. Or let's first have a discussion about this problem on the mailing lists.
In addition, when posting an issue, please have a look at http://castor.org/how-to-submit-an-xml-bug.html
Excuse Me.
I hope that this file is what you want. Thank's I downloaded the castor source code and I found that the problem is in class
org.exolab.castor.builder.SourceGenerator the method invoked by the main of SourceGeneratorMain public final void generateSource( FileReader reader = new FileReader(schemaFile); try {
InputSource source = new InputSource(reader);
source.setEncoding("UTF-8"); // added by Raffaele Fabbri
source.setSystemId(toURIRepresentation(schemaFile.getAbsolutePath()));
generateSource(source, packageName);
} finally { This is an specific solution that solves our situation. It would be better Thank's very much. Raffaele Fabbri The previus solution run only if the pattern is in the root xsd
If the pattern is defined in an include file it doesn't work. I try to find the problem but I need some help I expect there is more than one location in the source generator that needs to set a charset. The general solution would be to allow providing a charset in the configuration file, and in the absence of one being provided, either not set a charset or set a default charset.
Hmm, are you sure that the xsd is a valid UTF-8 file? It looks like it may be ISO-8859-1 or something else.
Raffaele, try marking the XSD with
<?xml version="1.0" encoding="ISO-8851"?> or some other appropriate character set. When I load your XSD in a text editor, I don't see the proper characters. If I cut-and-paste from a browser into the xsd file and re-save it, and then run everything, it works for me. When the input XSD is read in, the encoding specified in the <?xml statement is used to figure out the encoding. I can try but the xsd I use is not mine. It is a specific delivered by Italian Ministero Interni and I can't change the encoding.
Default Eclipse settings don't use a correct encoding to open the xsd file. I add a file type in Windows->Preferences->General->Content Types->Text->XML: File Associations *.xsd, Default encoding UTF-8 and with these settings Amateras or default editor loads correctly the file. Question: if the encoding is wrong why if I change encoding as I explained with a minimal XDS schema it works fine? Sorry for my bad english but I'm italian If I change character set with ISO-8859-1my editor tell me: "Some Characters cnnot be mapped using "ISO-8859-1" character encoding. Either change the encodinga or remove the character which are not supported by the "ISO-8859-1" character encoding.
I send another sample like prova.xsd but with the type definitions in a separated file named tipi.xsd
I am still looking into this. You're right – I looked further and this file is not ISO-8859-1.
So what is the current understanding of this issue ? It is a genuine bug ?
I think it is a genuinie bug but at this time I'am not be able to find the right fix. Can somebody help me?
Thank's in advance I still need to do some research to understand more fully the interaction of locales and input streams and parsers, but I am still looking into this.
If you add the following line
source.setEncoding("UTF-8"); to both places in the source file that make "new InputSource()", does that help the import problem? If I do this, the CTF master test suite runs successfully. I add the line in all places in the source file "SourceGernerator.java" but when I try to run this utility with the sample that include tipi.xsd the generated regular expression is wrong.
Please send me your modified source? Thanks in advance |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||