>From: Amal Khailtash
>Sent: Tue, August 24, 2010 12:57:39 PM
>

> Hi Dave,
>
> The option of having a separate name changing rule would be nice.
> I think it would be great to have an automatic way of generating
> names once a conflict is found.  The user might want to create that
> table if they know the conflicts before hand.
>

Amal -

You are right.  And, I looked into it and found that one solution
is easy to do.  So, the attached new version of generateDS.py
attempts to import a module named generateds_config.py.  If it can
do so, it uses the dictionary named NameTable in that file to
update the NameTable used to map name clashes.  I've attached a
sample (generateds_config.py).  In our case it maps "range" to
"rangeType".

Does this seem like a reasonable solution to this problem?

> I looked at the packages you provided.  They are great, especially
> the documentation makes browsing the code and documentation
> extracted from schemas very easy.  Would you be integrating this
> into generateDS.py or as another tool?
>
> I have been working on getting classes generated from Spirit
> IP-XACT working.  This set of standards are becoming more
> wide-spread in the Electronic Design Automation (EDA) and
> especially in the Electronics System Level (ESL) design.  We have a
> number of scripts and tools that we developed in-house, but I am
> trying to make some new tools based on these schemas and convince
> my colleagues to go to this standard.
>
> I encountered a few problems that I am not sure if they are from
> the schemas or how I am using your tool.  The top-level schema
> (index.sxd) points to 7 top-level elements (busDefinition,
> abstractDefinition, component, anbstractor, design, generatorChain,
> and designConfiguration).  For some reason, there is no class
> generated for abstractor, but I see the following other classes!
>
>  abstractorPortType
>  abstractorPortWireType
>  abstractorGenerators
>  abstractorBusInterfaceType
>  abstractorViewType
>  abstractorModelType
>

You are right.  It should generate a class abstractorType.  I don't
know why it does not do so.  index.xsd does an include of
abstractor.xsd, and abstractorType is a complexType in
abstractor.xsd.  I don't know why it does not generate a class
named abstractorType.  I'll look into that tomorrow.

> And also there is no class for component or componentType! 

When I generate a module from index.xsd, it generates a class
compnentType.  Perhaps the attached version of generateDS.py
will do so for you, too.

> And
> when I try to parse an xml representation of a component, it
> defaults to "libraryRefType".  I traced the code and it seems the
> following line:
>
>    rootTag, rootClass = get_root_tag(rootNode)
>
> returns None as rootClass.  Basically it did not create a component
> or componentType object!
>
> This is how I generated the top-level file and component file:
>
>  % generateDS.py -o IP_XACT_Document.py index.xsd
>  % generateDS.py -o component.py component.xsd
>
> Even if I use the component.xsd, I have the same problem.
>
> Either:
>  % python IP_XACT_Document.pyspi.xml
> Or:
>  % python component.pyspi.xml
>
> Would report:
>
>  <?xml version="1.0" ?>
>  <spirit:libraryRefType version="None" vendor="None" name="None"
>library="None">
>  </spirit:libraryRefType>
>
> I remember seeing some limitations on the xsd files, but not sure
> what the problem is for abstractor and component!
>

Yes.  I've worked on this problem several times and have never really been
able to fix it properly.  So, what I suggest you do is write your
own parse() or parseString() function.  Actually, create a new
Python file, then copy, paste, and edit the parse() function from
your generated module.  I've attached a sample: test01.py.

And, then, you can take something like test01.py and use it as the
start of one of your applications.

I generated the classes (spilib.py) with the following:

    $ ./generateDS.py -f -m -o spilib.py index.xsd

or, use the attached session file (produced with generateds_gui.py):

    $ ./generateDS.py --session=a3.session

Then, I parsed and exported spi.xml with the following:

    $ python test01.pyspi.xml

Let me know if this works for you.


> I would be happy to help and give you more feedback on anything
> related to this tool.
>

You've encouraged me to add that name mapping enhancement.  That's
the kind of help I need.  So, thanks for that.

And, thank you for sending me the XML schema and sample
XML instance documents, and thanks for explaining clearly what you
did and what it did wrong.  That made my work on this so
much easier.

- Dave

-- 


Dave Kuhlman
http://www.rexx.com/~dkuhlman


------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to