You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Si Chen <si...@opensourcestrategies.com> on 2006/07/11 19:30:58 UTC

Re: Patch for DataFile (WAS: Does DataFile xml-escape quotes?)

David, Jacopo -

Can you take a look at this patch?  I think we've fixed a small bug  
in the DataFile tool, but since you're more familiar with it, I'd  
like your opinion before we commit it.

Si



On Jul 10, 2006, at 12:29 PM, Leon Torres wrote:

> Hey, I managed to fix this issue with this very simple patch.  I  
> don't know what else is going  on, so can someone review it?  I  
> suspect if the output can be something other than xml, then this  
> needs to be a little more sophisticated.
>
> - Leon
>
>
>
> Leon Torres wrote:
>> I tried using the DataFile tool to import some CSV with Strings  
>> that contain quote characters (")  such as, 6" x 6" Napkin.  The  
>> resulting xml didn't replace these with &quot; so I get a  
>> malformed entity-engine-xml.
>> How do I do that?
>> I looked at the source code and it doesn't seem to do any escaping  
>> in Record.setString().
>> - Leon
> Index: framework/datafile/src/org/ofbiz/datafile/Record.java
> ===================================================================
> --- framework/datafile/src/org/ofbiz/datafile/Record.java	(revision  
> 1431)
> +++ framework/datafile/src/org/ofbiz/datafile/Record.java	(working  
> copy)
> @@ -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);


Re: Patch for DataFile (WAS: Does DataFile xml-escape quotes?)

Posted by Jacques Le Roux <ja...@les7arts.com>.
A long outstanding issue :o)
Could this be a correct patch ?
https://issues.apache.org/jira/browse/OFBIZ-2168

Jacques

From: "Jacques Le Roux" <ja...@les7arts.com>
> Thanks Scott,
> 
> I will have a deeper look
> 
> Jacques
> 
> from: "Scott Gray" <le...@gmail.com>
>> It does output things other than xml, looks to me like that fix
>> belongs in DataFile2EntityXml.java but I don't know much about this
>> stuff.
>> 
>> Regards
>> Scott
>> 
>> 2008/10/21 jacques.le.roux <ja...@les7arts.com>:
>>>
>>> Hi,
>>>
>>> Is there a reason why we did not commit this patch (found by chance) ? If
>>> not I will commit the small changes
>>>
>>> Jacques
>>>
>>>
>>> Si Chen-2 wrote:
>>>>
>>>> David, Jacopo -
>>>>
>>>> Can you take a look at this patch?  I think we've fixed a small bug
>>>> in the DataFile tool, but since you're more familiar with it, I'd
>>>> like your opinion before we commit it.
>>>>
>>>> Si
>>>>
>>>>
>>>>
>>>> On Jul 10, 2006, at 12:29 PM, Leon Torres wrote:
>>>>
>>>>> Hey, I managed to fix this issue with this very simple patch.  I
>>>>> don't know what else is going  on, so can someone review it?  I
>>>>> suspect if the output can be something other than xml, then this
>>>>> needs to be a little more sophisticated.
>>>>>
>>>>> - Leon
>>>>>
>>>>>
>>>>>
>>>>> Leon Torres wrote:
>>>>>> I tried using the DataFile tool to import some CSV with Strings
>>>>>> that contain quote characters (")  such as, 6" x 6" Napkin.  The
>>>>>> resulting xml didn't replace these with &quot; so I get a
>>>>>> malformed entity-engine-xml.
>>>>>> How do I do that?
>>>>>> I looked at the source code and it doesn't seem to do any escaping
>>>>>> in Record.setString().
>>>>>> - Leon
>>>>> Index: framework/datafile/src/org/ofbiz/datafile/Record.java
>>>>> ===================================================================
>>>>> --- framework/datafile/src/org/ofbiz/datafile/Record.java    (revision
>>>>> 1431)
>>>>> +++ framework/datafile/src/org/ofbiz/datafile/Record.java    (working
>>>>> copy)
>>>>> @@ -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);
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context: http://www.nabble.com/Does-DataFile-xml-escape-quotes--tp5257307p20086144.html
>>> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
>>>
>>>
>>
>


Re: Patch for DataFile (WAS: Does DataFile xml-escape quotes?)

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks Scott,

I will have a deeper look

Jacques

from: "Scott Gray" <le...@gmail.com>
> It does output things other than xml, looks to me like that fix
> belongs in DataFile2EntityXml.java but I don't know much about this
> stuff.
> 
> Regards
> Scott
> 
> 2008/10/21 jacques.le.roux <ja...@les7arts.com>:
>>
>> Hi,
>>
>> Is there a reason why we did not commit this patch (found by chance) ? If
>> not I will commit the small changes
>>
>> Jacques
>>
>>
>> Si Chen-2 wrote:
>>>
>>> David, Jacopo -
>>>
>>> Can you take a look at this patch?  I think we've fixed a small bug
>>> in the DataFile tool, but since you're more familiar with it, I'd
>>> like your opinion before we commit it.
>>>
>>> Si
>>>
>>>
>>>
>>> On Jul 10, 2006, at 12:29 PM, Leon Torres wrote:
>>>
>>>> Hey, I managed to fix this issue with this very simple patch.  I
>>>> don't know what else is going  on, so can someone review it?  I
>>>> suspect if the output can be something other than xml, then this
>>>> needs to be a little more sophisticated.
>>>>
>>>> - Leon
>>>>
>>>>
>>>>
>>>> Leon Torres wrote:
>>>>> I tried using the DataFile tool to import some CSV with Strings
>>>>> that contain quote characters (")  such as, 6" x 6" Napkin.  The
>>>>> resulting xml didn't replace these with &quot; so I get a
>>>>> malformed entity-engine-xml.
>>>>> How do I do that?
>>>>> I looked at the source code and it doesn't seem to do any escaping
>>>>> in Record.setString().
>>>>> - Leon
>>>> Index: framework/datafile/src/org/ofbiz/datafile/Record.java
>>>> ===================================================================
>>>> --- framework/datafile/src/org/ofbiz/datafile/Record.java    (revision
>>>> 1431)
>>>> +++ framework/datafile/src/org/ofbiz/datafile/Record.java    (working
>>>> copy)
>>>> @@ -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);
>>>
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/Does-DataFile-xml-escape-quotes--tp5257307p20086144.html
>> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
>>
>>
>

Re: Patch for DataFile (WAS: Does DataFile xml-escape quotes?)

Posted by Scott Gray <le...@gmail.com>.
It does output things other than xml, looks to me like that fix
belongs in DataFile2EntityXml.java but I don't know much about this
stuff.

Regards
Scott

2008/10/21 jacques.le.roux <ja...@les7arts.com>:
>
> Hi,
>
> Is there a reason why we did not commit this patch (found by chance) ? If
> not I will commit the small changes
>
> Jacques
>
>
> Si Chen-2 wrote:
>>
>> David, Jacopo -
>>
>> Can you take a look at this patch?  I think we've fixed a small bug
>> in the DataFile tool, but since you're more familiar with it, I'd
>> like your opinion before we commit it.
>>
>> Si
>>
>>
>>
>> On Jul 10, 2006, at 12:29 PM, Leon Torres wrote:
>>
>>> Hey, I managed to fix this issue with this very simple patch.  I
>>> don't know what else is going  on, so can someone review it?  I
>>> suspect if the output can be something other than xml, then this
>>> needs to be a little more sophisticated.
>>>
>>> - Leon
>>>
>>>
>>>
>>> Leon Torres wrote:
>>>> I tried using the DataFile tool to import some CSV with Strings
>>>> that contain quote characters (")  such as, 6" x 6" Napkin.  The
>>>> resulting xml didn't replace these with &quot; so I get a
>>>> malformed entity-engine-xml.
>>>> How do I do that?
>>>> I looked at the source code and it doesn't seem to do any escaping
>>>> in Record.setString().
>>>> - Leon
>>> Index: framework/datafile/src/org/ofbiz/datafile/Record.java
>>> ===================================================================
>>> --- framework/datafile/src/org/ofbiz/datafile/Record.java    (revision
>>> 1431)
>>> +++ framework/datafile/src/org/ofbiz/datafile/Record.java    (working
>>> copy)
>>> @@ -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);
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Does-DataFile-xml-escape-quotes--tp5257307p20086144.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
>
>

Re: Patch for DataFile (WAS: Does DataFile xml-escape quotes?)

Posted by "jacques.le.roux" <ja...@les7arts.com>.
Hi,

Is there a reason why we did not commit this patch (found by chance) ? If
not I will commit the small changes

Jacques


Si Chen-2 wrote:
> 
> David, Jacopo -
> 
> Can you take a look at this patch?  I think we've fixed a small bug  
> in the DataFile tool, but since you're more familiar with it, I'd  
> like your opinion before we commit it.
> 
> Si
> 
> 
> 
> On Jul 10, 2006, at 12:29 PM, Leon Torres wrote:
> 
>> Hey, I managed to fix this issue with this very simple patch.  I  
>> don't know what else is going  on, so can someone review it?  I  
>> suspect if the output can be something other than xml, then this  
>> needs to be a little more sophisticated.
>>
>> - Leon
>>
>>
>>
>> Leon Torres wrote:
>>> I tried using the DataFile tool to import some CSV with Strings  
>>> that contain quote characters (")  such as, 6" x 6" Napkin.  The  
>>> resulting xml didn't replace these with &quot; so I get a  
>>> malformed entity-engine-xml.
>>> How do I do that?
>>> I looked at the source code and it doesn't seem to do any escaping  
>>> in Record.setString().
>>> - Leon
>> Index: framework/datafile/src/org/ofbiz/datafile/Record.java
>> ===================================================================
>> --- framework/datafile/src/org/ofbiz/datafile/Record.java	(revision  
>> 1431)
>> +++ framework/datafile/src/org/ofbiz/datafile/Record.java	(working  
>> copy)
>> @@ -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);
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Does-DataFile-xml-escape-quotes--tp5257307p20086144.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.