Results 1 to 2 of 2
  1. #1
    k0k33 is offline Member
    Join Date
    Oct 2009
    Posts
    2
    Rep Power
    0

    Default Changing the Locale language for the XML validation

    Hi, all!
    the problem is like this:
    I have to validate an XML message, using

    javax.xml.validation.Schema;
    javax.xml.validation.SchemaFactory;
    javax.xml.validation.Validator;

    But after validation, I get the error message in the Locale default language. I don't want to change the JVM language. Is there any way to change the language just for the validation process, without re-setting the defaultLocale?

    Thanks for the replies!

  2. #2
    k0k33 is offline Member
    Join Date
    Oct 2009
    Posts
    2
    Rep Power
    0

    Default

    After almost 14 days, I came to the solution - if you want to change the Locale language of the validation output, there is no simple way to set it, using the javax.xml.validation library. So, if you really need to validate your XML messages this way, I bid to you good luck in changing the .class files. My solution was rather different - i didn't need to validate the messages that way, so I chose a different way - I used the org.apache.xerces SAXparser, which has a settable Locale. But mind you, that if you set your locale to any english speaking language(Canadian, US, UK,...) your Locale will remain the same as your default one. So, if you want to get the output in english, you ned to set the parser locale to Locale.ROOT. That will return in english!

    Hope anyone finds this useful in the future!

Similar Threads

  1. Replies: 5
    Last Post: 08-25-2009, 10:41 AM
  2. Locale with SimpleDateFormat
    By swati.jyoti in forum New To Java
    Replies: 4
    Last Post: 07-02-2009, 03:34 PM
  3. Locale example
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-29-2008, 10:04 AM
  4. How ro change the locale of JVM
    By ravi.ks007@hotmail.com in forum Advanced Java
    Replies: 2
    Last Post: 12-26-2007, 07:17 AM
  5. Locale
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-16-2007, 03:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •