Skip to Content.
Sympa Menu

perfsonar-dev - Re: [pS-dev] IMPORTANT: new line characters and white spaces in xml causing problems

Subject: perfsonar development work

List archive

Re: [pS-dev] IMPORTANT: new line characters and white spaces in xml causing problems


Chronological Thread 
  • From: Jason Zurawski <>
  • To: Loukik Kudarimoti <>
  • Cc: Roman Lapcz <>, "" <>, , Michael Michalis <>, Tsompanidis Ilias <>, Szymon Trocha <>
  • Subject: Re: [pS-dev] IMPORTANT: new line characters and white spaces in xml causing problems
  • Date: Fri, 16 Mar 2007 15:46:46 -0400
  • Organization: Internet2

Loukik;


When any part of the service implementation is trying to compare two strings - one hardcoded within the implementation (such as eventType value) and the second one coming from the xml message (via the Message bean), even if the strings are similar except for new-line characters, the checks fail. This definitely needs to be taken care of.

Initially I thought that we could take care of this at the Message bean level (by stripping empty strings around a text). But I am not 100% sure of the outcome. I am not sure because for some strings, white spaces *between the text* are important (command line mp for example). Jason, what do you think? I found out the String.trim() method will remove leading and trailing white spaces but not sure about white lines?



.trim() will remove leading and trailing (only) 'whitespace' which means tabs, newlines, and spaces. In some objects we do not run the cleaning procedure at all (xquery statements come to mind) but it would be simple enough to turn this feature on. If anyone could think of a list of where trimming absolutely should be done let me know and I can start to fix the classes.


Cleaning any whitespace/newlines out of the middle of text element is a little more challenging (we would need to use the regex classes) but this also could also alter the meaning of what was sent (again, xpath or xquery statements).

-jason
begin:vcard
fn:Jason Zurawski
n:Zurawski;Jason
org:Internet2;Performance Architecture & Technologies
adr:Apt 14;;39 Winterhaven Drive;Newark;DE;19702;USA
email;internet:
title:Software Engineer
tel;work:1-(302)-230-1197
tel;fax:1-(302)-831-0556
tel;home:1-(302)-230-1197
tel;cell:1-(302)-230-1197
url:http://www.internet2.edu/~zurawski
version:2.1
end:vcard




Archive powered by MHonArc 2.6.16.

Top of Page