GNUCASH w/ ShopSite
Neil Williams
linux at codehelp.co.uk
Tue Jun 21 07:33:54 EDT 2005
Now that I've had a chance to look at this more closely, it's not good news.
> Another is to find a
> program that can make sense of the .qif or .xml files that ShopSite
> allows you to generate and download (containing customer and order
> info).
Rather than doing it this way, what about this snippet of help from the
website?
Order API: Write your own CGI script and have ShopSite run it when a
transaction is complete, such as to connect to a custom payment processor or
warehouse/inventory tracking system.
http://www.shopsite.com/product_benefits_designers.html
The problem with your original idea is that ShopSite is proprietary and the
Orders CGI API isn't public, although their chosen XML is:
http://www.shopsite.com/help/7.1/en-GB/sc/pro/orders.download.format.xml.html
However, there are big problems here. The DTD is not even valid! Plus the
format is incredibly expansive and bloated. It is not suitable for QSF
imports or XSL translations into QSF. It doesn't even qualify as XML, it's
just a text file that uses angle brackets.
order2.xml:107: validity error : Redefinition of element Total
<!ELEMENT Total (#PCDATA)>
^
order2.xml:110: validity error : Redefinition of element Total
<!ELEMENT Total (#PCDATA)>
^
order2.xml:111: validity error : Redefinition of element Description
<!ELEMENT Description (#PCDATA)>
^
order2.xml:114: validity error : Redefinition of element Name
<!ELEMENT Name (#PCDATA)>
^
order2.xml:116: validity error : Redefinition of element Total
<!ELEMENT Total (#PCDATA)>
^
order2.xml:138: validity error : Redefinition of element Company
<!ELEMENT Company (#PCDATA)>
Even trying to parse something like this is prone to problems because the
overlapping elements cannot be distinguished via the DTD.
e.g.
<ShippingTotal>
<Total>100</Total>
<Description>foo</Description>
</ShippingTotal>
<Surcharge>
<Total>5</Total>
<Description>bar</Description>
</Surcharge>
The total surcharge has to be different to the shippingtotal-total.
Those either need to be made into attributes, namespaced or modified. I would
have done it as:
<shipping total="100">foo</shipping>
<surcharge total="5">bar</surcharge>
(using a default shopsite: namespace)
The above uses the content of the tag as the description because the
description tag is redundant. A 50% reduction in characters for no loss of
data.
It's OK to have attributes on different tags with the same names, it is NOT OK
to have completely different tags with the same names. A tag is meant to
describe the content, that's how XML works. Similarly in HTML, <p> cannot
mean one thing in <div> and another in <blockquote> - CSS may render them
differently, but the tag means the same thing in both cases.
So there's no point in proceeding with attempting to map this to QSF. You MUST
have valid XML at the start or the whole import is a waste of effort. It's
going to be harder to use ShopSiteOrders than to use CSV!
Sadly, I've come to expect such errors in what is supposed to be XML but that
does not mean I can work around them.
QSF is public, it has a valid and public Schema and it shouldn't take too much
effort to write your own script (which therefore doesn't need to be
distributed or use the existing DTD) to output suitable XML that GnuCash can
import directly (once that's complete).
Unfortunately, it looks like you need a licence to see the Orders API for a
CGI script so I cannot help you create the script, only judge it's output.
Make sure your output does validate against the schema or GnuCash will simply
refuse to import it.
http://code.neil.williamsleesmill.me.uk/qsf.html
use xmllint --schema <XSLFile> <XMLfile>
--
Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-user/attachments/20050621/b8d98396/attachment.bin
More information about the gnucash-user
mailing list