On Wed, Apr 13, 2016 at 04:28:23PM -0500, Malcolm White wrote:
>    Hi Dave,
>    Thanks for all of the work that you've put into generateDS. It's been a
>    big help on a project we're running right now at Enthought.

Malcolm,

You're welcome.  Glad it's been useful.

>    I noticed that you're using the expat parser with the
>    namespaceHandling=0, and that namespaces are passed down by default
>    from parent to child. These two facts cause an issue when a complexType
>    from one namespace ("namespaceParent") extends a type from another
>    namespace ("namespaceBase"), and inherits elements from that foreign
>    namespace.Â

I did not even realize that we had this option.  Are you talking
about: xml.sax.handler.feature_namespace_prefixes?

After some searching, I found that "namespaceHandling" is in module
Lib/xml/sax/expatreader.py.  But I still do not know how I'm
supposed to set it from within generateDS.py.

Wait.  Now I believe I see.  In generateDS.py, we should do:

    parser = make_parser()
    parser.setFeature(handler.feature_namespaces, 1)

Right?

And, then we have to implement methods startElementNS and
endElementNS in the handler, as you say below.

Ah.  So, namespaceHandling in expatreader.py is connected to
xml.sax.handler.feature_namespaces in Lib/xml/sax/handler.py.  I
suppose that the connection was made purposely obscure so as to
protect the weak and the silly, like me.

>    Because the namespaces are handed down from parent to child, any
>    elements that the parent element inherits via extension will be
>    exported with the wrong namespace. That is, they will have
>    "namespaceParent", but they should have "namespaceBase". Further,
>    because namespaceHandling=0, there is not enough information to correct
>    this when generating the elements in startElement.
>    Would you be interested in a PR which adds a --use-namespace-handling
>    flag and adds a corresponding start/endElementNS method?

I don't know what "PR" stands for.  Oh, "pull request"?  Right?  I'm
only a *little* slow.

I'm definitely interested.  It sounds like a very worthwhile fix and
enhancement.

As to the "--use-namespace-handling" option, it seems like you are
describing an error in generateDS.py.  Is it possible that this
enhancement should always be used, rather than being an option?
Obviously, I need to understand it better.

I'll try to study this a bit more.  Hopefully, I'll be able to
understand what your proposal is.

Do you have any code for this?  If so, you could consider submitting
a pull request (PR ?) at https://bitbucket.org/dkuhlman/generateds.
And, if not, I'd love to hear more about your proposal.  Perhaps I
can help.

Thanks much for your work on this.

By the way, the Enthought/Canopy Python distribution sounds very
impressive and powerful.

Dave

-- 

Dave Kuhlman
http://www.davekuhlman.org

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to