axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject cvs commit: ws-axis/c/src/soap/xsd/constraints WhiteSpace.cpp WhiteSpace.hpp
Date Tue, 25 Jan 2005 16:42:00 GMT
dicka       2005/01/25 08:42:00

  Modified:    c/src/soap/xsd/constraints WhiteSpace.cpp WhiteSpace.hpp
  Log:
  WhiteSpace doesn't strip leading and trailing space when collapsing string.
  
  Submitted by: Adrian Dick
  
  Revision  Changes    Path
  1.4       +40 -2     ws-axis/c/src/soap/xsd/constraints/WhiteSpace.cpp
  
  Index: WhiteSpace.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/constraints/WhiteSpace.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WhiteSpace.cpp	24 Jan 2005 15:41:25 -0000	1.3
  +++ WhiteSpace.cpp	25 Jan 2005 16:42:00 -0000	1.4
  @@ -124,7 +124,14 @@
   
           AxisString replacedValue = replaceWhiteSpace(value);
   
  -        /* Find space character and returns the first any of chars find
  +        /*
  +         * Strip leading and trailing space
  +         */
  +        AxisString leadingStripped = stripLeadingWhiteSpace(replacedValue);
  +        replacedValue = stripTrailingWhiteSpace(leadingStripped);
  +
  +        /*
  +         * Find space character and returns the first any of chars find
            * position
            */ 
           unsigned int nPos = replacedValue.find_first_of (' ');
  @@ -170,8 +177,39 @@
           }
   
           return m_strReturnVal;
  +    }
  +    
  +    const AxisString& WhiteSpace::stripLeadingWhiteSpace(AxisString& value)
  +    {
  +        while (value.size() > 0)
  +        {
  +            if ( isspace (value.at(0)))
  +            {
  +                value.erase(0, 1);
  +            }
  +            else
  +            {
  +                break;
  +            }
  +        }
   
  -        
  +		return value;
       }
  +
  +	const AxisString& WhiteSpace::stripTrailingWhiteSpace(AxisString& value)
  +	{
  +		while (value.size() > 0)
  +		{
  +            if ( isspace (value.at( value.size() - 1)))
  +            {
  +                value.erase(value.size() - 1, 1);
  +            }
  +            else
  +            {
  +                break;
  +            }
  +		}
  +        return value;
  +	}
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.5       +4 -0      ws-axis/c/src/soap/xsd/constraints/WhiteSpace.hpp
  
  Index: WhiteSpace.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/constraints/WhiteSpace.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- WhiteSpace.hpp	24 Jan 2005 15:41:25 -0000	1.4
  +++ WhiteSpace.hpp	25 Jan 2005 16:42:00 -0000	1.5
  @@ -59,6 +59,10 @@
   
       const AxisString& collapseWhiteSpace(AxisString& value);
   
  +    const AxisString& stripLeadingWhiteSpace(AxisString& value);
  +    
  +    const AxisString& stripTrailingWhiteSpace(AxisString& value);
  +
       enum
       {
           TAB_CHARACTER = '\t',
  
  
  

Mime
View raw message