Re: svn commit: r807938 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r807938 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java

Jacques Le Roux-2-2
I'd have prefered addChildElementNameSpaceValue as name

Jacques

From: <[hidden email]>

> Author: lektran
> Date: Wed Aug 26 09:22:09 2009
> New Revision: 807938
>
> URL: http://svn.apache.org/viewvc?rev=807938&view=rev
> Log:
> Applied patch from Ashish Vijaywargiya that allows adding namespace aware child elements via UtilXml
>
> Modified:
>    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>
> Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=807938&r1=807937&r2=807938&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
> +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java Wed Aug 26 09:22:09 2009
> @@ -586,6 +586,17 @@
>         newElement.appendChild(document.createTextNode(childElementValue));
>         return newElement;
>     }
> +
> +    /** Creates a child element with the given namespace supportive name and appends it to the element child node list.
> +     *  Also creates a Text node with the given value and appends it to the new elements child node list.
> +     */
> +    public static Element addChildElementNSValue(Element element, String childElementName,
> +            String childElementValue, Document document, String nameSpaceUrl) {
> +        Element newElement = document.createElementNS(nameSpaceUrl, childElementName);
> +        newElement.appendChild(document.createTextNode(childElementValue));
> +        element.appendChild(newElement);
> +        return element;
> +    }
>
>     /** Creates a child element with the given name and appends it to the element child node list.
>      *  Also creates a CDATASection node with the given value and appends it to the new elements child node list.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r807938 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java

Ashish Vijaywargiya-5
;o) - I would wait for Scott's comment on this.
Hey Jacques please don't ask why I am smiling - its secret ;) & Scott
knows the reason of my smile.

--
Ashish


Jacques Le Roux wrote:

> I'd have prefered addChildElementNameSpaceValue as name
>
> Jacques
>
> From: <[hidden email]>
>> Author: lektran
>> Date: Wed Aug 26 09:22:09 2009
>> New Revision: 807938
>>
>> URL: http://svn.apache.org/viewvc?rev=807938&view=rev
>> Log:
>> Applied patch from Ashish Vijaywargiya that allows adding namespace
>> aware child elements via UtilXml
>>
>> Modified:
>>    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>
>> Modified:
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=807938&r1=807937&r2=807938&view=diff 
>>
>> ==============================================================================
>>
>> --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>> (original)
>> +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>> Wed Aug 26 09:22:09 2009
>> @@ -586,6 +586,17 @@
>>        
>> newElement.appendChild(document.createTextNode(childElementValue));
>>         return newElement;
>>     }
>> +
>> +    /** Creates a child element with the given namespace supportive
>> name and appends it to the element child node list.
>> +     *  Also creates a Text node with the given value and appends it
>> to the new elements child node list.
>> +     */
>> +    public static Element addChildElementNSValue(Element element,
>> String childElementName,
>> +            String childElementValue, Document document, String
>> nameSpaceUrl) {
>> +        Element newElement = document.createElementNS(nameSpaceUrl,
>> childElementName);
>> +        
>> newElement.appendChild(document.createTextNode(childElementValue));
>> +        element.appendChild(newElement);
>> +        return element;
>> +    }
>>
>>     /** Creates a child element with the given name and appends it to
>> the element child node list.
>>      *  Also creates a CDATASection node with the given value and
>> appends it to the new elements child node list.
>>
>>
>

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r807938 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java

Scott Gray-2
In reply to this post by Jacques Le Roux-2-2
That's what Ashish originally named it but I asked him to change it so  
that it better reflected the underlying jdk method name  
createElementNS.  Anyone who knows what that method does will  
immediately know what this one does.

Regards
Scott

On 26/08/2009, at 11:34 PM, Jacques Le Roux wrote:

> I'd have prefered addChildElementNameSpaceValue as name
>
> Jacques
>
> From: <[hidden email]>
>> Author: lektran
>> Date: Wed Aug 26 09:22:09 2009
>> New Revision: 807938
>>
>> URL: http://svn.apache.org/viewvc?rev=807938&view=rev
>> Log:
>> Applied patch from Ashish Vijaywargiya that allows adding namespace  
>> aware child elements via UtilXml
>>
>> Modified:
>>   ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>
>> Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/
>> UtilXml.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=807938&r1=807937&r2=807938&view=diff
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java  
>> (original)
>> +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java  
>> Wed Aug 26 09:22:09 2009
>> @@ -586,6 +586,17 @@
>>        
>> newElement.appendChild(document.createTextNode(childElementValue));
>>        return newElement;
>>    }
>> +
>> +    /** Creates a child element with the given namespace  
>> supportive name and appends it to the element child node list.
>> +     *  Also creates a Text node with the given value and appends  
>> it to the new elements child node list.
>> +     */
>> +    public static Element addChildElementNSValue(Element element,  
>> String childElementName,
>> +            String childElementValue, Document document, String  
>> nameSpaceUrl) {
>> +        Element newElement =  
>> document.createElementNS(nameSpaceUrl, childElementName);
>> +        
>> newElement.appendChild(document.createTextNode(childElementValue));
>> +        element.appendChild(newElement);
>> +        return element;
>> +    }
>>
>>    /** Creates a child element with the given name and appends it  
>> to the element child node list.
>>     *  Also creates a CDATASection node with the given value and  
>> appends it to the new elements child node list.
>>
>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r807938 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java

Scott Gray-2
In reply to this post by Ashish Vijaywargiya-5
I still prefer my choice, even if yours now has 2 votes :-p

Regards
Scott

On 26/08/2009, at 11:42 PM, Ashish Vijaywargiya wrote:

> ;o) - I would wait for Scott's comment on this.
> Hey Jacques please don't ask why I am smiling - its secret ;) &  
> Scott knows the reason of my smile.
>
> --
> Ashish
>
>
> Jacques Le Roux wrote:
>> I'd have prefered addChildElementNameSpaceValue as name
>>
>> Jacques
>>
>> From: <[hidden email]>
>>> Author: lektran
>>> Date: Wed Aug 26 09:22:09 2009
>>> New Revision: 807938
>>>
>>> URL: http://svn.apache.org/viewvc?rev=807938&view=rev
>>> Log:
>>> Applied patch from Ashish Vijaywargiya that allows adding  
>>> namespace aware child elements via UtilXml
>>>
>>> Modified:
>>>   ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>
>>> Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/
>>> UtilXml.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=807938&r1=807937&r2=807938&view=diff
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/
>>> UtilXml.java (original)
>>> +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/
>>> UtilXml.java Wed Aug 26 09:22:09 2009
>>> @@ -586,6 +586,17 @@
>>>        
>>> newElement.appendChild(document.createTextNode(childElementValue));
>>>        return newElement;
>>>    }
>>> +
>>> +    /** Creates a child element with the given namespace  
>>> supportive name and appends it to the element child node list.
>>> +     *  Also creates a Text node with the given value and appends  
>>> it to the new elements child node list.
>>> +     */
>>> +    public static Element addChildElementNSValue(Element element,  
>>> String childElementName,
>>> +            String childElementValue, Document document, String  
>>> nameSpaceUrl) {
>>> +        Element newElement =  
>>> document.createElementNS(nameSpaceUrl, childElementName);
>>> +        
>>> newElement.appendChild(document.createTextNode(childElementValue));
>>> +        element.appendChild(newElement);
>>> +        return element;
>>> +    }
>>>
>>>    /** Creates a child element with the given name and appends it  
>>> to the element child node list.
>>>     *  Also creates a CDATASection node with the given value and  
>>> appends it to the new elements child node list.
>>>
>>>
>>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r807938 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java

Jacques Le Roux-2-2
In reply to this post by Scott Gray-2
I was sure someone would answer this (I presumed the JDK name in createElementNS) but why should we make an exception here ? Most of
the time, when you begin with exceptions you don't know where it will end. BTW, have we already such exceptions in OFBiz ?

Jacques

From: "Scott Gray" <[hidden email]>

> That's what Ashish originally named it but I asked him to change it so  that it better reflected the underlying jdk method name
> createElementNS.  Anyone who knows what that method does will  immediately know what this one does.
>
> Regards
> Scott
>
> On 26/08/2009, at 11:34 PM, Jacques Le Roux wrote:
>
>> I'd have prefered addChildElementNameSpaceValue as name
>>
>> Jacques
>>
>> From: <[hidden email]>
>>> Author: lektran
>>> Date: Wed Aug 26 09:22:09 2009
>>> New Revision: 807938
>>>
>>> URL: http://svn.apache.org/viewvc?rev=807938&view=rev
>>> Log:
>>> Applied patch from Ashish Vijaywargiya that allows adding namespace  aware child elements via UtilXml
>>>
>>> Modified:
>>>   ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>
>>> Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ UtilXml.java
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=807938&r1=807937&r2=807938&view=diff
>>> = = = = = = = = = =====================================================================
>>> --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java  (original)
>>> +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java  Wed Aug 26 09:22:09 2009
>>> @@ -586,6 +586,17 @@
>>>         newElement.appendChild(document.createTextNode(childElementValue));
>>>        return newElement;
>>>    }
>>> +
>>> +    /** Creates a child element with the given namespace  supportive name and appends it to the element child node list.
>>> +     *  Also creates a Text node with the given value and appends  it to the new elements child node list.
>>> +     */
>>> +    public static Element addChildElementNSValue(Element element,  String childElementName,
>>> +            String childElementValue, Document document, String  nameSpaceUrl) {
>>> +        Element newElement =  document.createElementNS(nameSpaceUrl, childElementName);
>>> +         newElement.appendChild(document.createTextNode(childElementValue));
>>> +        element.appendChild(newElement);
>>> +        return element;
>>> +    }
>>>
>>>    /** Creates a child element with the given name and appends it  to the element child node list.
>>>     *  Also creates a CDATASection node with the given value and  appends it to the new elements child node list.
>>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r807938 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java

Scott Gray-2
What exception are you referring to? Abbreviation? Yes we have plenty  
of exceptions: SQL, XML, RSS, UOM, FTP, Info, PK, ECA, Seq, Crypto,  
Iter, Max, Ajax, Alt, init, etc.

We use verbose names in order to add clarity but in this case NS is  
more recognizable to people familiar with using Java for XML and for  
those who aren't their IDE will quickly explain the method to them  
based on the javadoc comment.

Regards
Scott

On 27/08/2009, at 4:10 AM, Jacques Le Roux wrote:

> I was sure someone would answer this (I presumed the JDK name in  
> createElementNS) but why should we make an exception here ? Most of  
> the time, when you begin with exceptions you don't know where it  
> will end. BTW, have we already such exceptions in OFBiz ?
>
> Jacques
>
> From: "Scott Gray" <[hidden email]>
>> That's what Ashish originally named it but I asked him to change it  
>> so  that it better reflected the underlying jdk method name  
>> createElementNS.  Anyone who knows what that method does will  
>> immediately know what this one does.
>>
>> Regards
>> Scott
>>
>> On 26/08/2009, at 11:34 PM, Jacques Le Roux wrote:
>>
>>> I'd have prefered addChildElementNameSpaceValue as name
>>>
>>> Jacques
>>>
>>> From: <[hidden email]>
>>>> Author: lektran
>>>> Date: Wed Aug 26 09:22:09 2009
>>>> New Revision: 807938
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=807938&view=rev
>>>> Log:
>>>> Applied patch from Ashish Vijaywargiya that allows adding  
>>>> namespace  aware child elements via UtilXml
>>>>
>>>> Modified:
>>>>  ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>
>>>> Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/  
>>>> UtilXml.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=807938&r1=807937&r2=807938&view=diff
>>>> = = = = = = = = =  
>>>> =
>>>> =
>>>> ===================================================================
>>>> --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/
>>>> UtilXml.java  (original)
>>>> +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/
>>>> UtilXml.java  Wed Aug 26 09:22:09 2009
>>>> @@ -586,6 +586,17 @@
>>>>        
>>>> newElement.appendChild(document.createTextNode(childElementValue));
>>>>       return newElement;
>>>>   }
>>>> +
>>>> +    /** Creates a child element with the given namespace  
>>>> supportive name and appends it to the element child node list.
>>>> +     *  Also creates a Text node with the given value and  
>>>> appends  it to the new elements child node list.
>>>> +     */
>>>> +    public static Element addChildElementNSValue(Element  
>>>> element,  String childElementName,
>>>> +            String childElementValue, Document document, String  
>>>> nameSpaceUrl) {
>>>> +        Element newElement =  
>>>> document.createElementNS(nameSpaceUrl, childElementName);
>>>> +          
>>>> newElement.appendChild(document.createTextNode(childElementValue));
>>>> +        element.appendChild(newElement);
>>>> +        return element;
>>>> +    }
>>>>
>>>>   /** Creates a child element with the given name and appends it  
>>>> to the element child node list.
>>>>    *  Also creates a CDATASection node with the given value and  
>>>> appends it to the new elements child node list.
>>>>
>>>
>>
>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r807938 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java

Jacques Le Roux-2-2
From: "Scott Gray" <[hidden email]>
> What exception are you referring to? Abbreviation? Yes we have plenty  of exceptions: SQL, XML, RSS, UOM, FTP, Info, PK, ECA, Seq,
> Crypto,  Iter, Max, Ajax, Alt, init, etc.

Abbreviations in Classes or methods names. I found only:
* 2 classes with SQL in names (Should be Sql), a lot for Sql
* 2 method names with XML in (should be Xml), a lot for Xml
* 1 method with info (er, this one is a bit specific, but in my opinion should be information)

OK, I stopped after PK and ECA, because yes there are a lot for PK (Pk good, PK and pk bad). A lot for Eca (but no ECA, only 2 eca
for Eeca). But I'm sure you see my point. I was all about the rules we ask contributors to respect.

> We use verbose names in order to add clarity but in this case NS is  more recognizable to people familiar with using Java for XML
> and for  those who aren't their IDE will quickly explain the method to them  based on the javadoc comment.

Ok so NS is NameSpace, another one in the long list, hopefully noted... (this is where our technical skills show ;o)

Jacques
PS : without ADSL (central nervous system extension) I try to cool down and take any possibility to do so, so excuse me for this
digression...

>
> Regards
> Scott
>
> On 27/08/2009, at 4:10 AM, Jacques Le Roux wrote:
>
>> I was sure someone would answer this (I presumed the JDK name in  createElementNS) but why should we make an exception here ?
>> Most of  the time, when you begin with exceptions you don't know where it  will end. BTW, have we already such exceptions in
>> OFBiz ?
>>
>> Jacques
>>
>> From: "Scott Gray" <[hidden email]>
>>> That's what Ashish originally named it but I asked him to change it  so  that it better reflected the underlying jdk method name
>>> createElementNS.  Anyone who knows what that method does will   immediately know what this one does.
>>>
>>> Regards
>>> Scott
>>>
>>> On 26/08/2009, at 11:34 PM, Jacques Le Roux wrote:
>>>
>>>> I'd have prefered addChildElementNameSpaceValue as name
>>>>
>>>> Jacques
>>>>
>>>> From: <[hidden email]>
>>>>> Author: lektran
>>>>> Date: Wed Aug 26 09:22:09 2009
>>>>> New Revision: 807938
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=807938&view=rev
>>>>> Log:
>>>>> Applied patch from Ashish Vijaywargiya that allows adding  namespace  aware child elements via UtilXml
>>>>>
>>>>> Modified:
>>>>>  ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>>
>>>>> Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/  UtilXml.java
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=807938&r1=807937&r2=807938&view=diff
>>>>> = = = = = = = = =  = = ===================================================================
>>>>> --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ UtilXml.java  (original)
>>>>> +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ UtilXml.java  Wed Aug 26 09:22:09 2009
>>>>> @@ -586,6 +586,17 @@
>>>>>         newElement.appendChild(document.createTextNode(childElementValue));
>>>>>       return newElement;
>>>>>   }
>>>>> +
>>>>> +    /** Creates a child element with the given namespace   supportive name and appends it to the element child node list.
>>>>> +     *  Also creates a Text node with the given value and  appends  it to the new elements child node list.
>>>>> +     */
>>>>> +    public static Element addChildElementNSValue(Element  element,  String childElementName,
>>>>> +            String childElementValue, Document document, String   nameSpaceUrl) {
>>>>> +        Element newElement =   document.createElementNS(nameSpaceUrl, childElementName);
>>>>> +          newElement.appendChild(document.createTextNode(childElementValue));
>>>>> +        element.appendChild(newElement);
>>>>> +        return element;
>>>>> +    }
>>>>>
>>>>>   /** Creates a child element with the given name and appends it   to the element child node list.
>>>>>    *  Also creates a CDATASection node with the given value and   appends it to the new elements child node list.
>>>>>
>>>>
>>>
>>
>
>