ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

XML-SAX with an UTF-8 string

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML-SAX with an UTF-8 string

    Hi everyone,

    I am trying to run XML-SAX from an UTF-8 string and cannot make it to work.
    Does anyone know how this could be achieved?

    Here the elements:

    D XMLin 65535 varying
    /free

    // Test example
    //
    HTML Code:
    <?xml version="1.0" encoding="UTF-8"?><Item name="ITEM01"></Item>
    // Here below the XML transcription in UTF-8 for test (you can use http://rishida.net/tools/conversion/ for it)

    XMLin = x'3C3F786D6C2076657273696F6E3D22312E302220656E636F 6469'
    + x'6E673D225554462D38223F3E3C4974656D206E616D653D22 4954'
    + x'454D3031223E3C2F4974656D3E0A';

    XML-SAX %Handler(MyHandler : myCommArea)
    %XML( XMLin : 'doc=string ccsid=1208');


    I tried different things but always get the xml-sax error 302 immediately (msgid RNX0351).

    Thank you for any help.
    Pascal

  • #2
    Re: XML-SAX with an UTF-8 string

    According to the ILE RPG Reference manual, the CCSID keyword specifies the CCSID that the data is to be _returned_ in. The CCSID of the input data would come from the CCSID of the variable (or file) that contains the XML.

    In 7.2 you could simply declare your alphanumeric variable as a UTF-8 variable.

    In 7.1 and older, you can either read from a file marked with CCSID 1208, or you can convert it to UCS-2 and have XML-SAX read it from a UCS-2 field.

    Comment


    • #3
      Re: XML-SAX with an UTF-8 string

      Thank you Scott,

      I misunderstood the ccsid parameter I/O process direction, that makes sense.

      Actually, doing some research on IBM doc, I found a "Limitations of the XML Parser" chapter
      (in http://publib.boulder.ibm.com/infoce...0925075199.htm)
      with the following statement:
      "The following Unicode CCSIDs are supported: 1200, 13488, 17584."

      i.e. 1208 is not specified.

      Thank you for your help.
      Pascal

      Comment

      Working...
      X