View previous topic :: View next topic |
Author |
Message |
Gefflix
Joined: 27 Nov 2008 Posts: 18
|
Posted: Fri Dec 05, 2008 2:13 pm Post subject: ShareitSalesXML Import Definition |
|
|
Hi!
My import sales function from Inbox doesn't work, because my license generator creates more than one line of license information:
The generator creates something like that:
Code: | Licensed to: Thomas Smith
License Key: xxx-xxx-xxx-xxx-xxx |
How can I tweak the import definition, that it's only using the key after the string "License Key: " in the second line?
cheers
Stefan |
|
Back to top |
|
|
Gefflix
Joined: 27 Nov 2008 Posts: 18
|
Posted: Fri Dec 05, 2008 4:32 pm Post subject: |
|
|
I played around with some xpath queries but I somehow cannot get the key out of it.
Anyone out there with knowledge in xpath?
This is what I've got so far:
Code: | <LicenseKeyTag>PurchaseItemKey/Key[substring-after(.,'License Key: ')]</LicenseKeyTag>
<LicenseKeyDelimiter>
</LicenseKeyDelimiter>
|
|
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Dec 05, 2008 9:51 pm Post subject: |
|
|
License Tracker can only import XML or CSV format files (CSV files get converted to XML during the import process). From previous posts I gather that you are writing your own generator - so probably changing it to write XML would be the simplest solution. _________________ Infralution Support |
|
Back to top |
|
|
Gefflix
Joined: 27 Nov 2008 Posts: 18
|
Posted: Fri Dec 05, 2008 10:10 pm Post subject: |
|
|
Yes, I use my own generator and have some license information encoded in my key. So my user needs to know more than just the key.
As I mentioned before my generator output is:
Code: |
Some Info Here: blablabla
Some Info There: blablabla
Here is the Key: xxx-xxx-xxx-xxx |
I think usually the xml just looks like this:
Code: |
...
<PurchaseItemKey>
<Key>xxx-xxx-xxx-xxx</Key>
</PurchaseItemKey>
</PurchaseItem>
...
|
Now, shareit sends me the output from my own generator as XML email attachment:
Code: |
...
<PurchaseItemKey>
<Key>Some Info Here: blablabla
Some Info There: blablabla
Here is the Key: xxx-xxx-xxx-xxx</Key>
</PurchaseItemKey>
</PurchaseItem>
...
|
Of course the import doesn't work, because of all the extra information. Any idea, how I can strip out only the key? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Dec 05, 2008 10:33 pm Post subject: |
|
|
Because the additional information you are including in the key element is content (not XML) I don't think there is any way you will be able extract it using XPath. I'm guessing that ShareIt is automatically including the key text you generate in the overall purchase XML - is that right?
What if you format the text your generator creates as XML ie your generator creates:
Code: | <SomeInfo>blablabla</SomeInfo>
<LicenseKey>xxx-xxx-xxx-xxx</LicenseKey> |
Does Shareit then embed this in the generated XML ie
Code: | ...
<PurchaseItemKey>
<Key>
<SomeInfo>blablabla</SomeInfo>
<LicenseKey>xxx-xxx-xxx-xxx</LicenseKey>
</Key>
</PurchaseItemKey>
</PurchaseItem>
... |
Then you could use XPath. The only other approaches I can see are:
1. Write a small program to pre-process the XML prior to importing into License Tracker.
2. Purchase License Tracker source code and modify the License Tracker key import to handle this. _________________ Infralution Support |
|
Back to top |
|
|
Gefflix
Joined: 27 Nov 2008 Posts: 18
|
Posted: Fri Dec 05, 2008 10:53 pm Post subject: |
|
|
My keygenerator can - of course - output anything I want, including XML. My concern here is my customer. I want to give him the exact license information to enter (the form to enter the license key and extra information looks exactly the same). When I give my customer XML, I'm afraid there will be a lot of confusion.
It would be very unfortunate if the License Tracker is unable to handle this and would make it useless for custom licenses.
I did some research (I'm not an XPath expert) but this user has similar problems:
http://stackoverflow.com/questions/333249/how-to-apply-the-xpath-function-substring-after
His findings don't work in my case because I try to use a string function where License Tracker expects a node-set. Converting it to a node set:
Code: | <LicenseKeyTag>node-set(substring-after(PurchaseItemKey/Key,'Key: '))</LicenseKeyTag> |
raises the following error:
Code: | Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function. |
Any idea what prefix I need to use? |
|
Back to top |
|
|
Gefflix
Joined: 27 Nov 2008 Posts: 18
|
Posted: Sat Dec 06, 2008 7:37 am Post subject: |
|
|
I was able to sort it out - on the shareit side.
Still couldn't find a method to grab the key using some XPath but I was able to change my keygen, so that the XML copy of my order only has the key. The customer still gets the full story....
thanks anyway...
cheers |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Sun Dec 07, 2008 1:02 am Post subject: |
|
|
Thanks for letting us know. If you can post details of how you did this it might be helpful for other customers interfacing with ShareIt in this way. _________________ Infralution Support |
|
Back to top |
|
|
Gefflix
Joined: 27 Nov 2008 Posts: 18
|
Posted: Sun Dec 07, 2008 9:21 am Post subject: |
|
|
Sure.
I just can speak about the shareit integration. Their interface allows you to create two keys, one for the customer for their email notification. Their I put all the license information for the customer and one "CCKey" which is emailed with the XML. This can be a different output and should be - for perfect License Integration - only the license key.
The downside is, all the extra license information is lost and not in the license tracker, but in my case it's easy to recreate all extra stuff using the purchase data.
cheers |
|
Back to top |
|
|
|