[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] xml style?

On 08/19/2011 01:25 PM, Eric Blake wrote:
When writing an attribute in xml, which style is preferred?

<element attr='single'/>
<element attr="double"/>

We are currently rather split-brain in libvirt, among three general
areas: test programs under tests/*data/*, documentation under
docs/*.html.in, and RNG schemas under docs/schemas/*. In all cases, both
styles are present, but in different proportions:

$ git grep '="' tests/*data |wc
48 163 4276
$ git grep "='" tests/*data |wc
5994 21336 526402

$ git grep '="' docs/schemas/ |wc
1522 4599 103050
$ git grep "='" docs/schemas/ |wc
566 1699 33005

$ git grep '="' docs/*.in |wc
1288 6436 114146
$ git grep "='" docs/*.in |wc
611 2242 42950

Is it worth a cleanup patch that settles on one particular style, or
even a syntax check that forces style compliance?

One other point - our XML formatting code in src/conf/*_conf.c tends to favor attr='single', if only because it's less typing to write C-style strings to output "''" than it is to do "\"\"".

Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]