Dave, this pull request is good on it’s own, and it does not “leave off the
explicit namespace prefix“, it passes down the namespaceprefix_ to the
other export functions in the generated model.

For example if I call the generated model:

rootObj.export( sys.stdout, 0, name_=rootTag, namespaceprefix_='ABC')

The ouput XML will have ‘ABC’ as namespace prefix instead of the original
shema’s namespace prefix, and that is how I want to “leave off the explicit
namespace prefix“, by calling:

rootObj.export( sys.stdout, 0, name_=rootTag, namespaceprefix_='')

If you don't pass the namespaceprefix_ parameter to rootObj.export(), the
default original schema namespace prefix (which is currently hard coded in
the generated model) is instantiated and you won't see any difference in
the manipulated XML.

François

Le lun. 5 nov. 2018 à 16:27, Dave Kuhlman <pullrequests-re...@bitbucket.org>
a écrit :

> Dave Kuhlman commented on pull request #37: Passing namespaceprefix_ to
> self.exportChildren instead of assigning it.
> [image: dkuhlman]
> *Dave Kuhlman* commented on pull request #37:
> Passing namespaceprefix_ to self.exportChildren instead of assigning it.
> <https://bitbucket.org/dkuhlman/generateds/pull-requests/37/passing-namespaceprefix_-to#comment-81403652>
>
> François and Edwin,
>
> You both seem to be suggesting several improvements that would clean up
> the code generated to pass namespace prefixes and their definitions to
> export functions and to pass them down to children.
>
> I'm only trying to share some information so that we do not produce
> conflicts and to possibly gain some synergy. François's comments were, by
> the way, attached to pull requests, and I don't know how to sync that with
> the generateds-users email list.
>
> François, a few comments: (1) I'll wait on your additional changes before
> I accept this pull request. (2) This morning I did a few trials to
> determine when we can leave off the explicit namespace prefix and (by
> omitting the prefix) use the default namespace. I've discovered that I do
> not understand this and do not know how to control it. So, when we do this,
> I'd recommend that we validate any exported output against its schema, for
> example with xmllint. Maybe, someday, I'll understand XML namespaces, but
> it's not likely to be soon. Sigh.
>
> Dave
> ------------------------------
>
> Message 1 from François Guimond
>
> I modified generateds.py so the export function would use the namespace_
> parameter instead of pulling the namespace systematically from the original
> xsd file. As you will see, it imply a complete rewrite of
> generateExportFn_(). My intentions where not to change style, but to be
> able to minimize breaking functionality. (I probably broke the boolean
> generation in generateExportFn_3, but I could not figure how to use the
> worker function with it) That is why I made a worker function for each
> generateExportFn_(), and I unwrapped some output code. Now this branch
> might be in early stages, but it is currently working for what I wanted it
> to do. So really this pull request is to probe your feeling about it. (I
> didn't run your tests because I didn't look for instructions, my bad...)
> ------------------------------
>
> Message 2 from François Guimond
> Dave,
>
> I made the pull request at the end of march... Last weekend, when I
> realized it didn't merge any more so I removed it.
>
> Now the patch objective was to remove all namespaces from each nodes to
> make the xml more human readable.
>
> So the generated XML currently looks like that:
>
> <mstns:Top
> xmlns:mstns="http://www.mynamespace.org/MyApi/Version_1_1;>
> mstns:FeatureKey</mstns:Feature> </mstns:Top>
>
> My objective was to have this output instead ( including all the
> child nodes ):
>
> <Top xmlns="http://www.mynamespace.org/MyApi/Version_1_1;>
> <Feature>Key</Feature> </Top>
>
> Are you interested in modifications to allow that?
>
> If yes, would it be ok to use the principle of worker functions for:
> generateExportFn_1(), generateExportFn_2, generateExportFn_3 a little like
> the initial patch?
>
> If yes, I can restore my patch to be mergable. I understand my initial
> merge request was big and my request comment not exactly confident... I
> apologize for that.
>
> Let me know if you are interested. François Guimond
> View this pull request
> <https://bitbucket.org/dkuhlman/generateds/pull-requests/37/passing-namespaceprefix_-to#comment-81403652>
> or add a comment by replying to this email.
> Unwatch this pull request
> <https://bitbucket.org/dkuhlman/generateds/pull-requests/37/unwatch/FrancoisGuimond/db52ba3c55c61bd79b783ad8455d88d1ceafceee83eda4dc190a7a0958517a13/>
> to stop receiving email updates. [image: Bitbucket]
> <https://bitbucket.org>
>
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to