On Thu, Nov 06, 2014 at 10:45:27PM +0000, George David wrote:
>    Hi Dave,
> 
>    I have attached, 2 xsd files, a valid xml file, the generated xml file,
>    the python file generated by generateDs, and a test python file I
>    created.A
> 
>    I ran the following comand to create enumList.py:
>    generateDS.py -o enumList.py enum-list.xsd
> 
>    Then I try to create an XML file using enumListTest.py:
> 
>    from enumList import EnumList
>    import sys
>    enums = EnumList()
>    enums.add_simple_type_named_enumeration("ONE")
>    enums.export(sys.stdout, 0, name_='enum-list')
> 
>    I save the output to generated.xml.
> 
>    Then I run:
> 
>    A xmllint --noout --valid --schema enum-list.xsd generated.xml
>    and get the following report:
>    generated.xml:1: validity error : Validation failed: no DTD found !
>    ns:simple-type-named-enumeration="urn:com:george:simple-type-named-enum
>    eration"A
>    validity error : Element
>    '{urn:com:george:enum-list}simple-type-named-enumeration': This element
>    is not expected. Expected is (
>    {urn:com:george:simple-type-named-enumeration}simple-type-named-enumera
>    tion ).
>    generated.xml fails to validate
> 
>    The issue is that the generated xml file has the following:
>    <enum-list:simple-type-named-enumeration>ONE</enum-list:simple-type-nam
>    ed-enumeration>
> 
>    but it should really be
> 
>    <simple-type-named-enumeration:simple-type-named-enumeration>ONE</simpl
>    e-type-named-enumeration:simple-type-named-enumeration>
> 
>    I ran the code in the debugger. XschemaElement.annotate_find_type()
>    seems to be the culprit. It decides that simple-type-named-enumeration
>    is of type xs:string, instead of a SimpleTypeNamedEnumeration.A
> 
>    Any ideas how to fix this? I'll continue to look at it in case I see
>    something obvious.

George,

Thanks for reporting this.  And, thanks for doing that preliminary
work to track it down.

I generated code from enum-list.xsd, and I believe I have been able
to re-create the same error you report.

I've been working recently on an enhancement to generateDS.py to
generate validation code for a defined simpleType.  As part of that
work, I implemented a function (find_simple_type_def) to find a
simpleType definition in the input schema.  That new code is now at
BitBucket:

    https://bitbucket.org/dkuhlman/generateds/overview

If you're right about annotate_find_type(), then perhaps using that
newer technique in find_simple_type_def could help us there, also.
The new code uses xpath, which requires Lxml, but I'm pretty sure
that generateDS.py requires that (instead of ElementTree) to run
successfully anyway.

I'll take a look.  Hope to have something to report next week.  If
you learn anything more, let me know.

Dave

[snip]

-- 

Dave Kuhlman
http://www.davekuhlman.org

------------------------------------------------------------------------------
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to