Hitachi

uCosminexus Application Server XML Processor User Guide


3.1 Shift_JIS Switch Function

The Shift_JIS switch function changes the character encoding applied by Cosminexus XML Processor to SJIS (x-sjis-jdk1.1.7) or MS932 (x-sjis-cp932) when the encoding attribute in the XML document specifies Shift_JIS. The following table lists the correspondence between the encoding specifications for an XML document and the applicable character encodings.

Table 3‒1: Correspondence between the encoding specifications for an XML document and the applicable character encodings

Specified XML document encoding

Shift_JIS switch function setting

Applicable character encoding

Shift_JIS

Not specified

SJIS (default)

SJIS

SJIS

MS932

MS932

Windows-31J

--

MS932

Legend:

--: Cannot be specified

The Shift_JIS switch function is specified by setting a certain property to the instance of the XML parser or XSLT transformer. For details about how to set properties, see 4.5 How to use the properties of the Shift_JIS switch function.

The encoding specification using the Shift_JIS switch function is applied to the following items. The encoding cannot be applied to other items.

Care is required in the following cases:

  1. When the InputSource object is specified as the InputSource for DOM and SAX parsers:

    The Shift_JIS switch function is disabled if encoding other than Shift_JIS is specified for the InputSource object. In addition, when Reader is specified for the InputSource object, the Shift_JIS switch function is also disabled and the encoding being used by the Reader is applied.

  2. When the StreamSource object is specified as the input source for the XSLT or XSLTC transformer:

    When Reader is specified for the StreamSource object, the Shift_JIS switch function is disabled and the encoding being used by the Reader is applied.

  3. When the DOMSource object is specified as the input source for the XSLT or XSLTC transformer:

    The XML document has already undergone character code conversion when the DOMSource was generated. The Shift_JIS switch function is therefore disabled.

    To enable the Shift_JIS switch function, you need to specify the Shift_JIS switch function in advance so the parser is used for generating the DOM node for the DOMSource.

  4. When the SAXSource object is specified as the input source for the XSLT or XSLTC transformer:

    If the InputSource object is specified for the SAXSource object, caution must be exercised for case 1 above. If the XMLReader object is specified for the SAXSource object, the Shift_JIS switch function specified in XMLReader is valid.

  5. The JAXB does not support the Shift_JIS switch functionality when the Node, Source, or Result that is created either by the DOM parser or SAX parser where the Shift_JIS switch functionality is specified, is passed as an argument of the APIs of JAXB.

  6. StAX does not support the Shift_JIS switch functionality. Therefore, for input and output of XSLT or the XSLTC transformer, if anyone of the following is used, the operation will not be guaranteed:

    • StAXSource

    • StAXResult