Link to home
Start Free TrialLog in
Avatar of chima
chima

asked on

Space assigning or printing error

Hello,
I have this line of code: closingRootElement =("</"+rootElement.substring(1,rootElement.length())+">");
and when I print it; pw.print(closingRootElement);
pw is; PrintWriter pw = new PrintWriter(new FileWriter(tempFile));

What I get is:</CorrelationEngineParameters >   There is a space between the s and >, i.e., "s >".
I can not figure out from where this space is coming from.
Any thoughts, suggestions?
ASKER CERTIFIED SOLUTION
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chima
chima

ASKER

Dame your good!  Had to add a -1 to the parser;
rootElement = (line.trim().substring(line.trim().indexOf('<'), (line.trim().indexOf("xmlns=")-1)));      
<<<<<
Grading Comments:
Dame your good! Had to add a -1 to the parser;
rootElement = (line.trim().substring(line.trim().indexOf('<'), (line.trim().indexOf("xmlns=")-1)));
>>>>>

You got it.  Since there is a space before the xmlns attribute in the tag. :)

Glad to help.