Hi, Question 1: will gnucash-1.6 read the data files with the namespaces?
Question 2: does this include all the business data types (I suspect we need an additional plugin API for the namespaces)? If so, then I'll apply this... -derek Matthew Vanecek <[EMAIL PROTECTED]> writes: > In the file backend, there exists a write_namespace_decl() function that > is #ifdef-ed out, as well as some calls to it that place the appropriate > declarations in the tag. I've taken the liberty of enabling that > function, and of modifying the write_namespace_decl() calls to include > (hopefully) all the namespaces that can exist in the file. I also > modified the file version check to look at "<gnc-v2" instead of > "<gnc-v2>". > > The benefits of this move may not be immediately visible to all. First > off, the change allows the file to work either with or without the > decls, although saving the file will of course include the decls. > > Now, the benefit comes when the file is parsed by an XSLT parser. The > two XSLT parsers on Linux that I've tried are Saxon and Xalan, and both > fail due to the namespaces not being declared. Given the availability > of XSLT parsers, coupled with the desire to export the XML file to > different formats, it seems only natural to include the namespace > declarations within the top element below root. > > What are the benefits of XSLT? Well, let me tell you...XSLT provides an > easy and rapid way to successfully transform a well-formed XML document > into a variety of other formats without programatically changing Gnucash > (other than the namespace decls, of course ;) I was mucking about with > a question by someone to see if there was a way to get a list of > Customers out of the file. Well, with XSLT, there is. I'm able to pull > a list of customers by name with no effort on my part--simply run the > file and stylesheet through the parser, and voila! you have your list. > In my case (with my one customer), I set up HTML as the output style and > got this (yes, it's raw html). > > <html xmlns:cust="http://www.gnucash.org/xml/cust" > xmlns:gnc="http://www.gnucash.org/xml/gnc"> > <head> > <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> > <title>Finances File</title> > </head> > <body> > <h1>Customers</h1> > <p>My Widgets</p> > </body> > </html> > > The point is, much could be done with XSLT to provide the hotly desired > export capabilities without affecting the internals of Gnucash one > single solitary bit. Heck, someone could write a stylesheet that > transforms the Gnucash file to an OO spreadsheet, or worse, to an Excel > spreadsheet (the doc spec is only what, 100 pages? =P)!! but it depends > on having the well-formed XML (which, for the XSLT parser means the > namespaces are declared *shrug*). > > Anyhow, the attached patch accomplishes the namespace part. It would > make life easier/safer for XSLT writers, because then they wouldn't have > to edit the Gnucash XML file by hand to add the declarations... > > The attached patch is against HEAD, but it applied cleanly (with an > offset) to 1.8.x CVS, too. > > Thanks, > -- > Matthew Vanecek > perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);' > ******************************************************************************** > For 93 million miles, there is nothing between the sun and my shadow except me. > I'm always getting in the way of something... > > > _______________________________________________ > gnucash-devel mailing list > [EMAIL PROTECTED] > http://www.gnucash.org/cgi-bin/mailman/listinfo/gnucash-devel -- Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory Member, MIT Student Information Processing Board (SIPB) URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH [EMAIL PROTECTED] PGP key available _______________________________________________ gnucash-devel mailing list [EMAIL PROTECTED] http://www.gnucash.org/cgi-bin/mailman/listinfo/gnucash-devel