Hitachi

uCosminexus Application Server XML Processor User Guide


4.5.2 How to Use the Shift_JIS Switch Function for the SAX Parser

This subsection describes the flow of basic coding that uses the Shift_JIS switch function in the SAX parser. The follow shows an example of the coding:

[Figure]

The following describes the coding example. Each item number corresponds to the number in the comments in the coding example.

  1. Create SAXParserFactory.

    Use the static method newInstance() of javax.xml.parsers.SAXParserFactory to create the factory.

  2. Create SAXParser.

    Use newSAXParser() to create the SAX parser.

  3. Obtain the XMLReader.

    Use getXMLReader() to obtain the XMLReader.

  4. Switch Shift_JIS to MS932.

    In the setProperty method for the SAX parser setting, specify the first argument to the setting key http://cosminexus.com/xml/properties/shift_jis_map and the second argument to MS932.