Wednesday, May 9, 2012

Converting XML Schema to Relax NG

Needed to convert W3 XML Schema for web.xml files to Relax NG so that I can edit those files in emacs with XML element expansion and syntax highlighting provided by nxml mode. I found a lot of references on the Internet for Sun's XSD to RNG converter. However, most links pointing to Sun website were broken. Finally, I found that RNG converter is a part of the Kohsuke Kawaguchi's MSV project. After installing, I downloaded web-app_2_4.xsd, j2ee_1_4.xsd, jsp_2_0.xsd from Sun's XML Schemas for J2EE and converted the first one for use with nxml.

One little quirk was to add in the RNC schema a definition for xsi:schemaLocation attribute to the definition of element web-app

namespace xsi = ""
element web-app {
attribute xsi:schemaLocation { "" },
2012 update: Since Oracle bought Sun, the MSV RNG Convertor is even harder to find. I found the download link at nightly Also, in j2ee_1_4.xsd, you will need to uncomment the following statement:
xsd:import namespace="" schemalocation=""
Download the result from Google Docs: web-app_2_4.rnc

Tuesday, May 1, 2012

Undo Google Chrome "never translate a page" setting

In Google Chrome Translate Bar, I accidentally configured the browser to never translate a foreign site I was browsing. I wanted to undo the setting, but apparently there is no UI to undo. Neither there is a UI to edit the list of sites blacklisted from translating. I had to find Google Chrome Preferences file, which in Linux is ~/.config/google-chrome/Default/Preferences. The Preferences file is apparently in JSON format. Somewhere near the bottom of the file, I found these two lines:

"translate_language_blacklist": [ "ru" ],
"translate_site_blacklist": [ "" ],
The "translate_language_blacklist" apparently lists all languages you configured never to translate. The "translate_site_blacklist" lists all the sites you never wanted to be translated. Just delete the whole line or just the site you want to be removed from the list.