Re: [Generateds-discuss] Some question about your generateDS package
Brought to you by:
dkuhlman
|
From: <Dev...@we...> - 2020-08-25 21:50:46
|
Hi Dave, If you feel to attach the code in this email instead, would you please directly include the script as text in the email or change the affix to txt? Thanks so much and sorry for the inconvenience! Devin -----Original Message----- From: Zhang, Devin [QUANTITATIVE ANALYTICS SPEC] Sent: Monday, August 24, 2020 8:08 PM To: 'Dave Kuhlman' <dku...@da...> Subject: RE: Some question about your generateDS package Hi Dave, Thanks so much for your response!!! The test02.py was removed by the bank due to policy. Would you please send it to my personal email: dev...@ya...? Sorry for any inconvenience! Devin -----Original Message----- From: Dave Kuhlman <dku...@da...> Sent: Monday, August 24, 2020 7:25 PM To: Zhang, Devin [QUANTITATIVE ANALYTICS SPEC] <Dev...@we...> Cc: gen...@li... Subject: Re: Some question about your generateDS package Devin, Good to hear from you. Here is a suggestion -- Create your own version of the `parse` function that is defined inside a module generated by `generateDS`. In your custom version, you would explicitly set `rootTag` and `rootClass` for the specific XML instance document to be parsed. I've attached a example that might give you ideas on how to do that. See my comments in that attached example. Hope this helps. Let me know how it goes and if you have more questions. Dave On Mon 24 Aug 2020 05:51:18 AM PDT, Devin.Zhang wrote: > Dear Dave, > > Sorry for my rudeness to contact you directly. > > My team is working on a project related to FpML with Python (Not > commercial use purpose). Your FpML package came on top of the Google > search. So I investigated further and found that you have this really > powerful tool generateDS to generate data object for any well defined > xml schema. I am experimenting for interest rate derivative products. > > I am very excited as it fits exactly what our project wanted. Follow > your tutorial, I easily generate the API for fpml-ird-5-11.xsd. > Everything seems normal - the created classes are consistent with FpML > documentation. However, I ran into problem when parsing the compatible > xml (a xml for a vanilla swap in version 5.11). > > The problem seems in the parse function where rootTag and rootNode > become "dataDocument" and "None". Subsequently, rootTag and rootClass > are for BondReference. Nothing on the swap are really > loaded after that. Not sure if you could give some hint on it. > Thanks so much for your help! > > > > def parse(inFileName, silence=False, print_warnings=True): > global CapturedNsmap_ > gds_collector = GdsCollector_() > parser = None > doc = parsexml_(inFileName, parser) > rootNode = doc.getroot() > rootTag, rootClass = get_root_tag(rootNode) > if rootClass is None: > rootTag = 'BondReference' > rootClass = BondReference > > > > Devin S. Zhang > > Devin S. Zhang -- Dave Kuhlman http://www.davekuhlman.org |