Feature KVPs

Alex Aycinena alex.aycinena at gmail.com
Tue Jul 21 15:09:48 EDT 2015


John,

I was wondering if you could help me figure out a problem I've noted in
saving Feature KVPs.

In the work I'm doing, I'm setting a feature related to the use of
book-currency. This is the way it is currently saved (along with another
feature) in the xml file:

<book:slots>
  <slot>
    <slot:key></slot:key>
    <slot:value type="frame">
      <slot>
        <slot:key>features</slot:key>
        <slot:value type="frame">
          <slot>
            <slot:key></slot:key>
            <slot:value type="frame">
              <slot>
                <slot:key>Number Field Source</slot:key>
                <slot:value type="string">User specifies source of 'num'
field'; either transaction number or split action (requires at least
GnuCash 2.5.0)</slot:value>
              </slot>
              <slot>
                <slot:key>Use a Book-Currency</slot:key>
                <slot:value type="string">User specifies a 'book-currency';
costs of other currencies/commodities tracked in terms of book-currency
(requires at least GnuCash 2.7.0)</slot:value>
              </slot>
            </slot:value>
          </slot>
        </slot:value>
      </slot>
    </slot:value>
  </slot>
  <slot>
    <slot:key>options</slot:key>
    etc.

There seems to be some unnecessary frames and slots inserted in there for
some reason. It should look like this:

<book:slots>
  <slot>
    <slot:key>features</slot:key>
    <slot:value type="frame">
      <slot>
        <slot:key>Number Field Source</slot:key>
        <slot:value type="string">User specifies source of 'num' field';
either transaction number or split action (requires at least GnuCash
2.5.0)</slot:value>
      </slot>
      <slot>
        <slot:key>Use a Book-Currency</slot:key>
        <slot:value type="string">User specifies a 'book-currency'; costs
of other currencies/commodities tracked in terms of book-currency (requires
at least GnuCash 2.7.0)</slot:value>
      </slot>
    </slot:value>
  </slot>
  <slot>
    <slot:key>options</slot:key>
    etc.

I've looked at the code for qof_book_set_feature in qofbook.cpp and for
set_path in kvp_frame.cpp but it is not clear to me what it's doing wrong.

Do you agree that there is something wrong here? If so, any ideas for a
fix? By the way, the code for qof_book_set_option generates xml output that
looks correct.

I noticed in another e-mail that you said you are out of town this week.
This issue isn't affecting my work so no hurry in responding.

Have a good trip.

Regards,

Alex


More information about the gnucash-devel mailing list