> On Jul 21, 2015, at 12:09 PM, Alex Aycinena <[email protected]> wrote: > > 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.
Alex, Good catch. The problem was the definition of GNC_FEATURES: “/features/“. The slashes created the extra frames. I pushed a change removing them, which should fix the problem for features. I’m also working up a change to ignore leading and trailing slashes in keys. I should have recognized that problem earlier, as it made a difference in some of the existing test error messages, but I ascribed those to reordering without noticing the extra frames. I’ll get that fixed up and pushed as soon as I can. Regards, John Ralls _______________________________________________ gnucash-devel mailing list [email protected] https://lists.gnucash.org/mailman/listinfo/gnucash-devel
