John Crossman wrote:

I am using JiBX strictly for the unmarshaling of XML. The XML is created
by custom code elsewhere in the system. My concern is that of special
characters getting into the XML and thus causing failures in the JiBX
unmarshaling.  Couple questions:

- Must the XML be constrained to a certain character set (e.g., only
ISO-8859-1 characters) in order to insure a successful JiBX read off
disk?

You do need to use a particular character encoding (though this can be any encoding you want). ISO-8859-1 has a limited character set. UTF-8 may be a better choice, since it allows all Unicode characters to be encoded.

- Is there any validation I can do at the time the XML is created which
will guarantee that JiBX will have no problems in unmarshaling the XML?
(One option: unmarshal the data just after it's been written to disk.)


Unmarshalling the data right after it's written is probably the safest alternative if you need to be absolutely secure in knowing that the data is good. You could also make it a little simpler by just running the documents through a parse step, in order to make sure there are no errors in the encoding (create an XMLPull parser instance, then just loop until parser.next() == XmlPullParser.END_DOCUMENT - see org.jibx.extras.DocumentComparator for a more complex version of this that actually compares two documents). Just parsing isn't going to verify that the structure matches what you're expecting, though, only the character encoding.

 - Dennis



-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to