jyt109 / protobuf-java-format

Automatically exported from code.google.com/p/protobuf-java-format
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

XMLFormat loses significant spaces in element text #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create any protobuf where a String that consists only of spaces is valid
2. Transform it to xml using this tool
3. The field will be incorrect in the XML

What is the expected output? What do you see instead?

I see the first characters of the closing tag - I expect to see the spaces.
What version of the product are you using? On what operating system?
1.1, Java 1.6.0_18, Windows 7 

Please provide any additional information below.

Elements are allowed to have significant spaces in their text.  The method 
nextToken(), however, will eliminate any spaces following a valid token - 
including the closing bracket of an opening element tag.  So, if I have 
something like this:
  <AnElementWithSpaces> </AnElementWithSpaces>
The tokenizer will correctly recognize the closing bracket of 
<AnElementWithSpaces>, but will remove the following (significant) spaces.
The software should remove insignificant spaces and retain the others.  A 
quick look at the code suggests that the only time this is necessary is in 
the mergeField() method, where it first consumes the opening bracket and 
then consumes the identifier.  Consuming the identifier should not delete 
the significant spaces.

amoffetATgmailDOTcom

Original issue reported on code.google.com by amoffet@gmail.com on 4 Mar 2010 at 7:38

GoogleCodeExporter commented 9 years ago
This appears to be fixed in the code provided for item 10.

Original comment by amoffet@gmail.com on 11 Mar 2010 at 6:37

GoogleCodeExporter commented 9 years ago
I was incorrect.  This is still a problem.

Original comment by amoffet@gmail.com on 11 Mar 2010 at 11:04

GoogleCodeExporter commented 9 years ago

Original comment by eliran.bivas on 3 May 2011 at 1:36