Si, I just read over this description... I hadn't had a chance to review the email asking about this from yesterday. Doing an XML escape on the input doesn't seem to be a good idea. What if you are going from one type of flat file to another? Getting to the root of this: how are you generating the XML output based on what the datafile tool reads? However you are doing that, it seems this should be done when writing the XML, not when reading the input file. Without having verified it, my guess is that this will break certain usage of the DataFile, in fact all usage except XML output (which isn't what the tool was originally meant for, though I couldn't say if it is used more that way now or not). -David [hidden email] wrote: > Author: sichen > Date: Wed Jul 12 16:02:52 2006 > New Revision: 421453 > > URL: http://svn.apache.org/viewvc?rev=421453&view=rev > Log: > XML escape the DataFile String input, otherwise the entity-engine-xml output will have " characters that are not XML escaped ("), breaking the system > > Modified: > incubator/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java > > Modified: incubator/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java > URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java?rev=421453&r1=421452&r2=421453&view=diff > ============================================================================== > --- incubator/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java (original) > +++ incubator/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java Wed Jul 12 16:02:52 2006 > @@ -36,6 +36,8 @@ > import java.util.StringTokenizer; > import java.util.NoSuchElementException; > > +import org.ofbiz.base.util.UtilFormatOut; > + > /** > * Record > * > @@ -261,7 +263,7 @@ > set(name, new Double(number)); > } // standard types > else if (fieldType.equals("java.lang.String") || fieldType.equals("String")) > - set(name, value); > + set(name, UtilFormatOut.encodeXmlValue(value)); > else if (fieldType.equals("NullTerminatedString")) { > int terminate = value.indexOf(0x0); > set(name, terminate>0?value.substring(0,terminate):value); > > smime.p7s (4K) Download Attachment |
Hi David,
We've reverted it out of the SVN for now. It looked like a bug to me so I thought it'd be safe to commit, but thanks for letting me know. Si On Jul 12, 2006, at 4:16 PM, David E. Jones wrote: > > Si, > > I just read over this description... I hadn't had a chance to > review the email asking about this from yesterday. > > Doing an XML escape on the input doesn't seem to be a good idea. > What if you are going from one type of flat file to another? > > Getting to the root of this: how are you generating the XML output > based on what the datafile tool reads? However you are doing that, > it seems this should be done when writing the XML, not when reading > the input file. > > Without having verified it, my guess is that this will break > certain usage of the DataFile, in fact all usage except XML output > (which isn't what the tool was originally meant for, though I > couldn't say if it is used more that way now or not). > > -David > > > [hidden email] wrote: >> Author: sichen >> Date: Wed Jul 12 16:02:52 2006 >> New Revision: 421453 >> URL: http://svn.apache.org/viewvc?rev=421453&view=rev >> Log: >> XML escape the DataFile String input, otherwise the entity-engine- >> xml output will have " characters that are not XML escaped >> ("), breaking the system >> Modified: >> incubator/ofbiz/trunk/framework/datafile/src/org/ofbiz/ >> datafile/Record.java >> Modified: incubator/ofbiz/trunk/framework/datafile/src/org/ofbiz/ >> datafile/Record.java >> URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/ >> datafile/src/org/ofbiz/datafile/Record.java? >> rev=421453&r1=421452&r2=421453&view=diff >> ===================================================================== >> ========= >> --- incubator/ofbiz/trunk/framework/datafile/src/org/ofbiz/ >> datafile/Record.java (original) >> +++ incubator/ofbiz/trunk/framework/datafile/src/org/ofbiz/ >> datafile/Record.java Wed Jul 12 16:02:52 2006 >> @@ -36,6 +36,8 @@ >> import java.util.StringTokenizer; >> import java.util.NoSuchElementException; >> +import org.ofbiz.base.util.UtilFormatOut; >> + >> /** >> * Record >> * >> @@ -261,7 +263,7 @@ >> set(name, new Double(number)); >> } // standard types >> else if (fieldType.equals("java.lang.String") || >> fieldType.equals("String")) >> - set(name, value); >> + set(name, UtilFormatOut.encodeXmlValue(value)); >> else if (fieldType.equals("NullTerminatedString")) { >> int terminate = value.indexOf(0x0); >> set(name, terminate>0?value.substring >> (0,terminate):value); |
Free forum by Nabble | Edit this page |