> 
> -----Original Message-----
> From: WWW [mailto:[EMAIL PROTECTED] On Behalf Of Jochen Wiedmann
> Sent: Monday, August 25, 2003 5:35 AM
> To: Ias
> Cc: [EMAIL PROTECTED]
> 
> Quoting Ias <[EMAIL PROTECTED]>:
> 
> > > I would like to question this one. IMO it were better to 
> mimic the 
> > > JAXB behaviour, at least by default. I also do not 
> understand, why 
> > > the change in the XMLWriter is required: The current 
> behaviour is to 
> > > write any non-US-Ascii character as "&#ddd;". This should always 
> > > work. (Correct me, if I'm wrong.)
> > >
> > At this moment, we need to ensure some points: first of all, Sun's 
> > JAXB RI does "as-it-is" marshalling based on UTF-8. The reason has 
> > something to do with the previous version of MarshallTest. For 
> > example, DateFormat generates a locale-depedent string, 
> which a Java 
> > runtime doesn't identify with its "&#ddd"-converted string 
> even though 
> > they are equivalent in terms of character codes.
> 
> My opinion is, that the current JaxMe behaviour to use
> 
>     DateFormat.getDateTimeInstance()
> 
> is wrong. According to
> 
>     http://www.w3.org/TR/xmlschema-2/#dateTime
> 
> one has to need an XML schema specific instance of 
> DateFormat, which doesn't depend on the Locale. After 
> changing that (and of course the MarshallerTest
> accordingly) everything should work with any locale.
> 
> 
> > Another issue on this matter is also quite important. &#ddd 
> style is 
> > definitely no problem across various platforms and regions, but 
> > readability for localized forks becomes drastically diminished. I 
> > guess Sun implements its marshaller in such a way for the sake of 
> > accessibility of marshalled XML documents.
> 
> Agreed. However, I wonder whether the already existing and 
> standard parameter "jaxb.encoding" cannot be used to achieve 
> the same goal?
> 
jaxb.encoding is assigned for specifying the output encoding to which all
the characters in the marshalled XML document should conform. The rule
implies how a character maps to octet(s) in a stream rather than whether it
must convert to a code point based notation. 
 
> In the (not yet activated) XMLWriter14 the decision whether 
> to use &#ddd; looks roughly like the following:
> 
>     if (isEncodableChar(c)) {
>       write(c);
>     } else {
>       write("&#" + ((int) c) + ";");
>     }
> 
> IMO your goal would be met by using this algorithm. It would 
> be immediately possible to replace the XMLWriter with 
> XMLWriter14, if a JRE 1.4 is available.
> The question remains what to do with elder versions.
>
I also saw the XMLWriter for J2SE 1.4. Detecting whether a character can be
encoded by the given charset by CharsetEncoder is efficient, but converting
it to "&#ddd" in case of inencodability is a little questionable because
CharsetEncoder has its own mechanism for those "unmappable character"s. (See
CharsetEncoder in Java API doc for more details.) I'm not sure how JAXB spec
describes this situation well, and probably we need to ensure what is the
right behavior for a JAXB implementation by all means. If you don't mind,
I'll ask JAXB spec lead about this issue.

> 
> > In addition, I think it would be good for JaxMe 2 to have some 
> > property-based configurability architecture for XMLWriter. For 
> > instance, if you like to use your own XMLWriter, it will be done by
> > 
> > marshaller.setProperty("jaxme.marshaller.xmlwriter", 
> "ias.XMLWriter");
> > 
> > This strategy also allows users to choose their preferred 
> marshalling 
> > way among "as-it-is", "&#ddd", and the other feasible ones.
> 
> I find this kind of customization to be much more desirable. 
> In particular because it fits very well with the choice of 
> XMLWriter14, if possible.
>
Yes, that's what I have hoped as well.  
> 
> Btw, it is extremely welcome that you care for these things. 
> It is definitely something that we in the latin countries 
> underestimate.
> 
Okay, It would be my great pleasure to help non-Lation developers and users
through Java. I'll submit some codes soon for those matters.

Thanks,

Ias.
> 
> Regards,
> 
> Jochen
> 
> 


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
Jaxme-jaxb-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxme-jaxb-dev

Reply via email to