No announcement yet.

ending whitespaces are lost in db fields

  • Filter
  • Time
  • Show
Clear All
new posts

  • ending whitespaces are lost in db fields


    I'm living a hard situation:

    I'm using a DB with has some fields with whitespaces at the start and the end. Ex: ' Mr. Me '. When I try to get the content of the field using MIRH variables, I got the content trimmed Ex: 'Mr. Me'.

    Looking at the MessageBrowser, I can see the text with all the whitespaces (<pacName> Mr. Me </pacName>), but accesing msg[&#039;pacName&#039;] in the transformer, ending wihtespaces are lost.

    I&#039;ve tried with the toString(), text(), getValueOf(), toXMLString() methods, and with XML.ignoreWhitespace property, and with all of them I lost my loved whitespaces.

    Any idea?

  • #2
    Re: ending whitespaces are lost in db fields

    Alberto -

    Try using the preprocessor and wrapping the message in a CDATA tag - it might preserve the whitespace then.

    Chris Lang


    • #3
      Re: ending whitespaces are lost in db fields

      No way.

      I&#039;ve added the CDATA section, but at transformer the whitespace are lost.

      The things are worst: I&#039;m unable of sending any ending withe space out of the transformer: As soon as the messages gets out, all of the spaces are trimmed.


      • #4
        Re: ending whitespaces are lost in db fields

        I&#039;ve solved (part) of it:

        msg = new XML(message);
        tmp = new XML(template);
        ignoreWhitespace allows than the input XML can have ending white spaces.
        prettyPrinting allows than output XML can have ending white spaces

        Only trailing blanks are kept if they are encoded into an ER7 message. This is done by validation rules of HAPI (using DefaultValidation).

        HL7 protocol doesn&#039;t allow starting blanks:

        ...String data is left justified with trailing blanks optional. Any displayable (printable) ACSII characters (hexadecimal values between 20 and 7E, inclusive, or ASCII decimal values between 32 and 126), except the defined delimiter character..