Forum Discussion

Desmond_Cassidy's avatar
Desmond_Cassidy
Contributor
17 years ago

Interpreting Spaces as against null in String input

Hi,
  I have a requirement to pass spaces in a SoapUI request string. The server code needs to distinguish between a null value and a trimmed string which is empty; logic being that a null indicates no change to the DB stored value whilst an empty string would indicate that the DB value should in fact be cleared (or nullified).
  Now if I put spaces into the Form in the SoapUI request then it gets converted (or translated to XML) as a null. In fact the value in XML looks like
  xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

The easiest way around this is to put XXX in the string and then in the XML replace this by spaces...then execute the request.

Now from the 'big picture' I can 'see' why it was developed in such a way as spaces are indeed not visible so this may be deemed as causing more problems than it solves.

ANy suggestion for a workaround so that my Test Cases run whilst interpreting spaces as just that. One suggestion of an enhancement (if indeed spaces are possible to be input from the 'form screen') might be to 'lightly highlight' text as it is entered into the text box thus spaces would get highlighted and a difference would be seen against an intended null value to be passed.

Regards,

Desmond.