Thanks for looking into this. Let me know if there is anything I can do on
my side. I will continue to dig into the generateDS code to get a better
understanding myself

//Olof

On Wed, Oct 25, 2017 at 12:14 AM, Dave Kuhlman <dkuhl...@davekuhlman.org>
wrote:

> Olof,
>
> Perhaps I have a clue on this one.  What follows is my attempt to
> find the cause of the problem.  Tomorrow I'll *try* to find a fix.
> But, this problem might be due to the fundamental approach that
> generateDS.py is using, and so it might not be easily fixable.
>
> generateDS.py is generating this:
>
>         elif nodeName_ == 'addressBlock':
>                 obj_ = bankedBlockType.factory()
>
> but it should generate this:
>
>         elif nodeName_ == 'addressBlock':
>                 obj_ = addressBlockType.factory()
>
>
> The conflict -- addressBlock -- Seems to be defined as both:
>     - addressBlockType
>     - bankedBlockType
>
> Or, at least generateDS.py thinks it is.  In other words,
> generateDS.py seems to be, incorrectly,  overlaying the definition
> addressBlockType with the definition bankedBlockType.
>
> Let me try to trace this error.  Here is an attempt to show the order
> of definitions in memoryMap.xsd.
>
>     <xs:complexType name="memoryMapType">
>         <xs:group ref="ipxact:memoryMap" minOccurs="0"
> maxOccurs="unbounded"/>
>             <xs:group name="memoryMap">
>                 <xs:element ref="ipxact:addressBlock"/>
>                     <xs:element name="addressBlock"
> type="ipxact:addressBlockType">
>                 <xs:element ref="ipxact:bank"/>
>                     <xs:element name="bank" type="ipxact:addressBankType">
>                         <xs:complexType name="addressBankType">
>                             <xs:group name="bankBase">
>                                 <xs:element name="addressBlock"
> type="ipxact:bankedBlockType">
>                                     <xs:complexType name="bankedBlockType">
>
> In other words:
>
> 1. xs:complexType memoryMapType includes the definitions from group
>    memoryMap.
>
> 2. xs:group memoryMap contains:
>
>    2.1. addressBlock defined as addressBlockType *and*
>
>    2.2. bank defined as addressBankType, which contains xs:group
>         bankBase, which defines addressBlock as bankedBlockType
>
> I don't know exactly why this is happening, i.e. why the correct
> definition of addressBlock is being replaced by the incorrect one.
> That's a problem for tomorrow.
>
> One of the lines you removed was the reference to bankBase in the
> definition of addressBankType, which explains why that eliminated
> the error.
>
> More on this later.
>
> Dave
>
> On Mon, Oct 23, 2017 at 12:01:19AM +0200, Olof Kindgren wrote:
> > Hi,
> >
> > I have an issue where an element seems to be mapped to the wrong type.
> I'm
> > not sure if this is an issue with the upstream xsl or with generateDS,
> > since both are pretty complex. After some digging however, I'm leaning
> > towards an error with generateDS.
> >
> > The xsl sources I'm using are available here
> > http://www.accellera.org/XMLSchema/IPXACT/1685-2014/ The issue I'm
> looking
> > at in particular can be found in memoryMap.xsl. In that file, there's a
> > type called MemoryMapType with a child element called addressBlock
> >
> > If I'm using the original sources I will get something like this in the
> > generated MemoryMapType class
> >
> >         elif nodeName_ == 'addressBlock':
> >             obj_ = bankedBlockType.factory()
> >             obj_.build(child_)
> >             self.addressBlock.append(obj_)
> >             obj_.original_tagname_ = 'addressBlock'
> >         elif nodeName_ == 'bank':
> >             obj_ = localBankedBankType.factory()
> >             obj_.build(child_)
> >             self.bank.append(obj_)
> >             obj_.original_tagname_ = 'bank'
> >
> > This doesn't work with my XML files as they expect and addressBlockType
> > instead of bankedBlockType.
> >
> > If I remove a frew lines in memoryMap.xsd as in the diff below, I get the
> > result I expect
> >
> > diff --git a/2014/memoryMap.xsd b/2014/memoryMap.xsd
> > index bd72631..1caefd7 100644
> > --- a/2014/memoryMap.xsd
> > +++ b/2014/memoryMap.xsd
> > @@ -117,7 +117,6 @@
> >                                 </xs:complexType>
> >                         </xs:element>
> >                         <xs:group ref="ipxact:addressSpecifier"/>
> > -                       <xs:group ref="ipxact:bankBase"/>
> >                 </xs:sequence>
> >                 <xs:attribute name="bankAlignment"
> > type="ipxact:bankAlignmentType" use="required">
> >                         <xs:annotation>
> > @@ -140,7 +139,6 @@
> >                                 </xs:complexType>
> >                         </xs:element>
> >                         <xs:group ref="ipxact:addressSpecifier"/>
> > -                       <xs:group ref="ipxact:localBankBase"/>
> >                 </xs:sequence>
> >                 <xs:attribute name="bankAlignment"
> > type="ipxact:bankAlignmentType" use="required">
> >                         <xs:annotation>
> > @@ -206,7 +204,6 @@
> >                                         </xs:sequence>
> >                                 </xs:complexType>
> >                         </xs:element>
> > -                       <xs:group ref="ipxact:bankBase"/>
> >                 </xs:sequence>
> >                 <xs:attribute name="bankAlignment"
> > type="ipxact:bankAlignmentType" use="required"/>
> >                 <xs:attributeGroup ref="ipxact:id.att"/>
> > @@ -224,7 +221,6 @@
> >                                         </xs:sequence>
> >                                 </xs:complexType>
> >                         </xs:element>
> > -                       <xs:group ref="ipxact:localBankBase"/>
> >                 </xs:sequence>
> >                 <xs:attribute name="bankAlignment"
> > type="ipxact:bankAlignmentType" use="required"/>
> >                 <xs:attributeGroup ref="ipxact:id.att"/>
> >
> >
> >         elif nodeName_ == 'addressBlock':
> >             obj_ = addressBlockType.factory()
> >             obj_.build(child_)
> >             self.addressBlock.append(obj_)
> >             obj_.original_tagname_ = 'addressBlock'
> >         elif nodeName_ == 'bank':
> >             obj_ = addressBankType.factory()
> >             obj_.build(child_)
> >             self.bank.append(obj_)
> >             obj_.original_tagname_ = 'bank'
> >
> > Could this be an issue with the type resolving in generateDS, or is it an
> > upstream error? I'm sorry that I haven't got a better isolated testcase.
> > Still trying to figure things out
> >
> > //Olof
>
> > ------------------------------------------------------------
> ------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
> > _______________________________________________
> > generateds-users mailing list
> > generateds-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/generateds-users
>
>
> --
>
> Dave Kuhlman
> http://www.davekuhlman.org
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to