Oleg,

I don't think that `generateDS.py` handles that case.

And, yes, since they are in two separate namespaces, the are
different (qualified) names.  `generateDS.py` should be able to
handle that, but it does not.

The only thing that I can suggest is that you look into the use of
these two options for running `generateDS.py`:

    --one-file-per-xsd       Create a python module for each XSD processed.
    --output-directory="XXX" Used in conjunction with --one-file-per-xsd.
                             The directory where the modules will be created.

Although, that approach adds difficulties of its own.

You can look at the following in the `tests` directory for an
example of its use:

        generateds/tests/oneper00.xsd
        generateds/tests/oneper01.xsd
        generateds/tests/oneper02.xsd
        generateds/tests/oneper03.xsd
        generateds/tests/OnePer/oneperType00_1One.py
        generateds/tests/OnePer/oneperType00_2One.py
        generateds/tests/OnePer/oneperType01_1One.py
        generateds/tests/OnePer/oneperType01_2One.py
        generateds/tests/OnePer/oneperType02_1One.py
        generateds/tests/OnePer/oneperType02_2One.py
        generateds/tests/OnePer/oneperType03_1One.py
        generateds/tests/OnePer/oneperType03_2One.py

Dave

On Fri, Feb 22, 2019 at 05:20:06PM +0100, Oleg Broytman wrote:
> Having problems when the same name is used in two different namespaces:
> 
> File root.xsd:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/";
>            xmlns:xs="http://www.w3.org/2001/XMLSchema";
>            targetNamespace="http://schemas.xmlsoap.org/soap/envelope/";
>            elementFormDefault="qualified"
>            attributeFormDefault="qualified"
>            version="v001">
>   <xs:import namespace="http://xsd.example/v001/test1"; 
> schemaLocation="test1.xsd"/>
>   <xs:import namespace="http://xsd.example/v001/test2"; 
> schemaLocation="test2.xsd"/>
> </xs:schema>
> 
> test1.xsd:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:tns="http://xsd.example/v001/test1";
>            xmlns:xs="http://www.w3.org/2001/XMLSchema";
>            targetNamespace="http://xsd.example/v001/test1";
>            elementFormDefault="qualified"
>            attributeFormDefault="qualified"
>            version="v001">
>   <xs:complexType name="LifecycleDataType">
>     <xs:sequence>
>       <xs:element name="LifecycleID" type="xs:string"/>
>     </xs:sequence>
>   </xs:complexType>
> </xs:schema>
> 
> test2.xsd:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:tns="http://xsd.example/v001/test2";
>            xmlns:xs="http://www.w3.org/2001/XMLSchema";
>            xmlns:test1="http://xsd.example/v001/test1";
>            targetNamespace="http://xsd.example/v001/test2";
>            elementFormDefault="qualified"
>            attributeFormDefault="qualified"
>            version="v001">
>   <xs:complexType name="LifecycleDataType">
>     <xs:complexContent>
>       <xs:extension base="test1:LifecycleDataType">
>         <xs:sequence minOccurs="0">
>           <xs:element name="LifecycleName" type="xs:string"/>
>         </xs:sequence>
>       </xs:extension>
>     </xs:complexContent>
>   </xs:complexType>
> </xs:schema>
> 
> $ generateDS -o test.py root.xsd
> ...
>   File "/home/phd/.virtualenvs/ufod2py/bin/generateDS.py", line 1378, in 
> collectElementNames
>     parent.collectElementNames(elementNames, count)
>   File "/home/phd/.virtualenvs/ufod2py/bin/generateDS.py", line 1378, in 
> collectElementNames
>     parent.collectElementNames(elementNames, count)
>   File "/home/phd/.virtualenvs/ufod2py/bin/generateDS.py", line 1378, in 
> collectElementNames
>     parent.collectElementNames(elementNames, count)
>   File "/home/phd/.virtualenvs/ufod2py/bin/generateDS.py", line 1377, in 
> collectElementNames
>     raise RuntimeError(msg)
> RuntimeError: Extension/restriction recursion detected.  Suggest you check 
> definitions of types LifecycleDataType and LifecycleDataType.
> 
> These are two different LifecycleDataType, no? One is
> test1:LifecycleDataType, the other is test2:LifecycleDataType.
> 
> Oleg.
> -- 
>     Oleg Broytman            https://phdru.name/            p...@phdru.name
>            Programmers don't die, they just GOSUB without RETURN.
> 
> 
> _______________________________________________
> generateds-users mailing list
> generateds-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/generateds-users

-- 

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