Forwarding to list.
--
Dave Kuhlman
http://www.davekuhlman.org
--- Begin Message ---
On Fri, Aug 19, 2016 at 04:14:26PM -0500, Matt Wynn wrote:
> Hey there Dave,
>
> First and foremost: Thank you, thank you, thank you for building this!
> I have a new gig and my first job is turning a stupidly massive
> federal database, published only in poorly-documented XML, into a
> Django app. If I can get this going, it will have saved me from hours
> of drudgery.
>
> In addition to just being useful, you did a heckuva job documenting
> this. Your walkthroughs are understandable and your tutorials are on
> point. Killer work.
>
> I'm almost embarrassed to ask this, but I am running into a problem I
> wonder if you can diagnose right off the bat. I'm running
> gends_run_gen_django.py and pointing to a local copy of
> http://www.accessdata.fda.gov/spl/schema/PORP_MT050032UV.xsd.
>
> When I do that, I get the following:
>
> *** error ***
> usage: gends_extract_simple_types.py [-h] [-v] [-f] [-o OUTFILENAME]
> infilename
> gends_extract_simple_types.py: error: too few arguments
> *** error ***
>
>
> I don't see what arguments could possibly be getting left out. Any
> idea what might be happening, or how to solve it?
Matt,
Try running gends_run_gen_django.py with the --verbose option. That
causes it to print out the command lines that it is executing (via
POpen) and might give you a clue.
The following generated files models.py and forms.py for me:
$ ./gends_run_gen_django.py --verbose people.xsd
where people.xsd is attached to this email. (It's also in the
generateDS.py distribution, I believe, but that version has one line
that you'd have to comment out.)
>
> Any ideas would be greatly appreciated. Thanks again for making this,
> and hope you have a great weekend.
Glad you are finding it useful. A few suggestions:
- Make sure to try running the generated module on several XML
instance documents to ensure that the generated code can both
parse and export it.
- Keep in mind that you will need to feed the data into get get it
out of the model/DB. generateDS can generate your (Django) model,
but does not automatically populate it.
I tried to process
http://www.accessdata.fda.gov/spl/schema/PORP_MT050032UV.xsd
after downloading it. But, kept failing because of missing files.
After downloading 20 ~ 30 .xsd files, I gave up. So, I can't really
say what happens when you try to process that one.
Hope this helps. If you still have problems, you might send me the
entire set of .xsd files so that I could test against that.
Dave
--
Dave Kuhlman
http://www.davekuhlman.org
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="people" type="peopleType">
<xs:annotation><xs:documentation>
A list of people.
</xs:documentation></xs:annotation>
</xs:element>
<xs:complexType name="peopleType">
<xs:sequence>
<xs:element name="comments" type="commentsType"
maxOccurs="unbounded"/>
<xs:element name="person" maxOccurs="unbounded" type="personType"/>
<xs:element name="specialperson" maxOccurs="unbounded"
type="specialperson"/>
<xs:group ref="programmerGroup" />
</xs:sequence>
</xs:complexType>
<xs:group name="programmerGroup">
<xs:sequence>
<xs:element name="programmer" maxOccurs="unbounded"
type="programmerType"/>
<xs:element name="python-programmer" maxOccurs="unbounded"
type="python-programmerType"/>
<xs:element name="java-programmer" maxOccurs="unbounded"
type="java-programmerType"/>
</xs:sequence>
</xs:group>
<xs:element name="comments" type="commentsType">
</xs:element>
<xs:complexType name="commentsType" mixed="true">
<xs:sequence>
<!--
<xs:element name="emp" type="xs:string" />
-->
<xs:element name="emp" type="xs:string" maxOccurs="unbounded"/>
<xs:element name="bold" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="person" type="personType">
<xs:annotation><xs:documentation>
A generic person. This is the base for a number of different
kinds of people. They are each an extension of this base
type of person.
</xs:documentation></xs:annotation>
</xs:element>
<xs:complexType name="personType" mixed="0">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="interest" type="xs:string" maxOccurs="unbounded"
/>
<xs:element name="category" type="xs:integer" minOccurs="0" />
<xs:element name="hot.agent" type="hot.agent" />
<xs:element name="agent" type="agentType" maxOccurs="unbounded" />
<xs:element name="promoter" type="boosterType"
maxOccurs="unbounded" />
<xs:element name="description" type="xs:string"/>
<xs:element name="range" type="RangeType"/>
<!-- Check use of python keyword as element name. -->
<xs:element name="with" type="boosterType" />
</xs:sequence>
<xs:attribute name="value" type="xs:ID" />
<xs:attribute name="id" type="xs:integer" />
<xs:attribute name="ratio" type="xs:float" />
<xs:attributeGroup ref="favorites" />
</xs:complexType>
<xs:complexType name="specialperson">
<xs:complexContent>
<xs:extension base="personType">
<xs:sequence>
<!--
<xs:element name="musicalinstrument" type="xs:string" />
-->
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!--
<xs:element name="description-a" type="xs:string"
substitutionGroup="description" />
-->
<xs:element name="programmer" type="programmerType">
<xs:annotation><xs:documentation>
A programmer type of person. Programmers are very special
but also a little shy.
</xs:documentation></xs:annotation>
</xs:element>
<xs:complexType name="programmerType" mixed="0">
<xs:complexContent>
<xs:extension base="personType">
<xs:sequence>
<!--
<xs:element name="description" type="xs:string"/>
-->
<xs:element name="email" type="xs:string"/>
<xs:element name="elposint" type="xs:positiveInteger"/>
<xs:element name="elnonposint"
type="xs:nonPositiveInteger"/>
<xs:element name="elnegint" type="xs:negativeInteger"/>
<xs:element name="elnonnegint"
type="xs:nonNegativeInteger"/>
<xs:element name="eldate" type="xs:date"/>
<xs:element name="eldatetime" type="xs:dateTime"/>
<xs:element name="eldatetime1" type="xs:dateTime"/>
<xs:element name="eltoken" type="xs:token"/>
<xs:element name="elshort" type="xs:short"/>
<xs:element name="ellong" type="xs:long"/>
<xs:element name="elparam" type="paramType"/>
<xs:element name="elarraytypes" type="ArrayTypes"/>
</xs:sequence>
<xs:attribute name="language" type="xs:string" />
<xs:attribute name="area"/>
<xs:attribute name="attrposint" type="xs:positiveInteger"/>
<xs:attribute name="attrnonposint"
type="xs:nonPositiveInteger"/>
<xs:attribute name="attrnegint" type="xs:negativeInteger"/>
<xs:attribute name="attrnonnegint"
type="xs:nonNegativeInteger"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="param" type="paramType">
<xs:annotation>
<xs:documentation>Finding flow attribute unneccesary in practice. A
unnamed parameter is unbound/skipped.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="paramType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:ID" />
<xs:attribute name="name" type="xs:NCName" />
<xs:attribute name="sid" type="xs:NCName" />
<xs:attribute name="flow" type="FlowType" />
<xs:attribute name="semantic" type="xs:token" />
<xs:attribute name="type" type="xs:NMTOKEN" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="ArrayTypes">
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="float" />
<xs:enumeration value="int" />
<xs:enumeration value="Name" />
<xs:enumeration value="token" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="FlowType">
<xs:restriction base="xs:integer">
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="RangeType">
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="9"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="python-programmer" type="python-programmerType">
<xs:annotation><xs:documentation>
A Python programmer type of person. Programmers are very special
and Python programmers are especially wonderful kinds
of people.
</xs:documentation></xs:annotation>
</xs:element>
<xs:complexType mixed="0" name="python-programmerType">
<xs:complexContent>
<xs:extension base="programmerType">
<xs:sequence>
<xs:element name="favorite-editor" type="xs:string"/>
<xs:element name="flowvalue" type="FlowType"/>
<xs:element name="drcs" type="xs:string"/>
</xs:sequence>
<xs:attribute name="nick-name"/>
<xs:attribute name="drcs" type="xs:string" />
<xs:attribute name="gui_developer" type="xs:boolean"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="java-programmer" type="java-programmerType">
<xs:annotation><xs:documentation>
A Java programmer type of person. Programmers are very special
and Java programmers are nice also, but not as especially wonderful
as Python programmers, of course.
</xs:documentation></xs:annotation>
</xs:element>
<xs:complexType mixed="0" name="java-programmerType">
<xs:complexContent>
<xs:extension base="programmerType">
<xs:sequence>
<xs:element name="favorite-editor" type="xs:string"/>
<xs:element name="datetime1" type="xs:gYear"/>
<xs:element name="datetime2" type="xs:gYearMonth"/>
<xs:element name="datetime3" type="xs:gMonth"/>
<xs:element name="datetime4" type="xs:gMonthDay"/>
<xs:element name="datetime5" type="xs:gDay"/>
</xs:sequence>
<xs:attribute name="nick-name"/>
<xs:attribute name="status"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="agent" type="agentType">
</xs:element>
<xs:complexType name="agentType">
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="priority" type="xs:float" minOccurs="0" />
<xs:element name="info" type="infoType"/>
<xs:element ref="vehicle" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:element name="special-agent" type="special-agentType"
substitutionGroup="agent">
</xs:element>
<xs:complexType name="special-agentType">
<xs:annotation><xs:documentation>
This is a good kind of agent for testing the generation
of Python bindings for an XML schema.
</xs:documentation></xs:annotation>
<xs:complexContent>
<xs:extension base="agentType">
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="priority" type="xs:float"/>
<xs:element name="info" type="infoType"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="weird-agent" type="weird-agentType"
substitutionGroup="agent">
</xs:element>
<xs:complexType name="weird-agentType">
<xs:annotation><xs:documentation>
This is a good kind of agent for testing the generation
of Python bindings for an XML schema.
</xs:documentation></xs:annotation>
<xs:complexContent>
<xs:extension base="agentType">
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="priority" type="xs:float"/>
<xs:element name="info" type="infoType"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="booster" type="boosterType">
</xs:element>
<xs:complexType name="boosterType">
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="other-name" type="xs:float"/>
<xs:element name="class" type="xs:float"/>
<xs:element name="other-value" type="xs:float"
maxOccurs="unbounded" />
<xs:element name="type" type="xs:float" maxOccurs="unbounded" />
<xs:element name="client-handler" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="fullname" type="xs:string"/>
<xs:element name="refid" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="member-id" type="xs:string" />
</xs:complexType>
<!-- Test for element with attributes but no children.
Should use valueOf.
-->
<xs:element name="info" type="infoType">
</xs:element>
<xs:complexType name="infoType">
<xs:sequence>
</xs:sequence>
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="type" type="xs:integer" />
<xs:attribute name="rating" type="xs:float" />
</xs:complexType>
<xs:attributeGroup name="favorites">
<xs:attribute name="fruit" />
<xs:attribute name="vegetable" />
</xs:attributeGroup>
<xs:element name="vehicle" type="vehicleType"/>
<xs:complexType name="vehicleType" abstract="true">
<xs:sequence>
<xs:element name="wheelcount" type="xs:integer" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="automobile">
<xs:complexContent>
<xs:extension base="vehicleType">
<xs:sequence>
<xs:element name="drivername" type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!--
<xs:include namespace="http://www.generateds.com/people-part1"/>
-->
<xs:complexType name="hot.agent">
<xs:sequence>
<xs:element name="firstname" type="xs:string"
default="empty\name"/>
<xs:element name="lastname" type="xs:string"
default="no 'last' name"/>
<xs:element name="priority" type="xs:float"/>
<xs:element name="startDate" type="xs:date"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
</xs:schema>
--- End Message ---
------------------------------------------------------------------------------
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users