After generating the python class, I tried to use the export function: export(sys.stdout, 0)
And I get this: <gen-ds-sample:GenDsSample> <gen-ds-sample:username>test</gen-ds-sample:username> <gen-ds-sample:first-name>first-name</gen-ds-sample:first-name> </gen-ds-sample:GenDsSample> running that through xmllint --load-trace --schema gen-ds-sample.xsd sample.xml Loaded URL="gen-ds-sample.xsd" ID="(null)" Loaded URL="sample.xml" ID="(null)" sample.xml:1: namespace error : Namespace prefix gen-ds-sample on GenDsSample is not defined <gen-ds-sample:GenDsSample> ^ sample.xml:2: namespace error : Namespace prefix gen-ds-sample on username is not defined <gen-ds-sample:username>test</gen-ds-sample:username> ^ sample.xml:3: namespace error : Namespace prefix gen-ds-sample on first-name is not defined <gen-ds-sample:first-name>first-name</gen-ds-sample:first-name> ^ <?xml version="1.0"?> <GenDsSample> <username>test</username> <first-name>first-name</first-name> </GenDsSample> sample.xml:1: element GenDsSample: Schemas validity error : Element 'GenDsSample': No matching global declaration available for the validation root. sample.xml fails to validate The first error is that the namespace prefix is not define. I can define it using namespacedef_='xmlns:gen-ds-sample="urn:com:gends:test:gen-ds-sample"' This is defined in the XSD already. It seems like generateDS should be able to retrieve this. After I add that to the export function, i get this: <gen-ds-sample:GenDsSample xmlns:gen-ds-sample="urn:com:gends:test:gen-ds-sample"> <gen-ds-sample:username>test</gen-ds-sample:username> <gen-ds-sample:first-name>first-name</gen-ds-sample:first-name> </gen-ds-sample:GenDsSample> Then I run that through xmllint and I get this: Loaded URL="gen-ds-sample.xsd" ID="(null)" Loaded URL="sample2.xml" ID="(null)" <?xml version="1.0"?> <gen-ds-sample:GenDsSample xmlns:gen-ds-sample="urn:com:gends:test:gen-ds-sample"> <gen-ds-sample:username>test</gen-ds-sample:username> <gen-ds-sample:first-name>first-name</gen-ds-sample:first-name> </gen-ds-sample:GenDsSample> sample2.xml:1: element GenDsSample: Schemas validity error : Element '{urn:com:gends:test:gen-ds-sample}GenDsSample': No matching global declaration available for the validation root. sample2.xml fails to validate I see in the generated class that the export function has name_='GenDsSample". I can also change this in the export function to set name_="gen-ds-sample" and all will be fine. shouldn't generateDS be able to figure this out too? When I run this in the debugger, I see that root.children has this: list: [<XschemaElement name: "GenDsSample" type: "GenDsSample">, <XschemaElement name: "gen-ds-sample" type: "GenDsSample">] The second item in the list has the correct name, but it's not used as far as I can see because of this code in generateClasses() if not element.isExplicitDefine(): logging.debug("Not an explicit define, returning.") if element.isComplex() and element.getName() != element.getType(): MappingTypes[element.getName()] = element.getType() return I have attached the files I used. Thanks, George
gen-ds-sample.xsd
Description: Binary data
sampleTest.py
Description: Binary data
------------------------------------------------------------------------------ Get your SQL database under version control now! Version control is standard for application code, but databases havent caught up. So what steps can you take to put your SQL databases under version control? Why should you start doing it? Read more to find out. http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________ generateds-users mailing list generateds-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/generateds-users