[Yanel-dev] XMLHelper added

Guillaume Déflache guillaume.deflache at wyona.com
Fri Oct 10 13:51:52 CEST 2008


Alec Bickerton schrieb:
> Guillaume Déflache wrote:
>   
>> Can someone explain to me what the use case for isFragment is? ...or
>> even write a unit test! :)
>>     
>
> isFragment is simply to indicate if the XML declaration should be included.
>   

Fine, but in what case(s) would you not want it?


>> I would rather throw a NPE right here with the same comment than getting
>> it in a maybe distance place!
>> BTW shouldn't we always rethrow exceptions as runtime ones in helper
>> classes? Do we otherwise have an exception handling policy?
>>     
>
> I'm open to it but I feel a library is better to be explicit about the
> exception that it throws. Just throwing a raw exception is not that helpful.
>   

I do agree on raw exceptions, I said "with the same comment". Anyway 
we'll see how it looks in the unit tests then.


> Another point relates to code sytle, I personally find code like this
> awkward to follow when its shown on a single line.
>
> javax.xml.transform.TransformerFactory.newInstance().newTransformer().transform(new
> javax.xml.transform.dom.DOMSource(doc), new
> javax.xml.transform.stream.StreamResult(out) );
>   

Not using the fully qualified names may help here too! ;)


More information about the Yanel-development mailing list