Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: global type 'simpleType:EinheitZielgroesseType' declared more than once #46

Closed
tschuettenberg opened this issue Dec 4, 2017 · 16 comments
Assignees

Comments

@tschuettenberg
Copy link

Hi there, first of all, this is realy great stuff you're doing here!

I'm trying to use the GMLAS toolbox / driver on the german specific wastewater data format "ISYBAU Austauschformate Abwasser (XML)" - see here - and it works realy quite well.
But I came across some questions when reading ISYBAU files and I know this one relates only to the specific ISYBAU.xsd (and therefore might be off topic for you) but maybe you can give me a clue anyway.

When reading ISYBAU files (with 'metadaten.xsd' reference added to the header) the following error is shown:
RuntimeError: C:/Users/TS/Downloads/isybau2qgep-master/1302_ISYBAU_XML_Beispieldaten\../1302_ISYBAU_XML_Schema\.\1302-referenzlisten.xsd:7056:48 global type 'simpleType:EinheitZielgroesseType' declared more than once or also declared as complexType

Unfortunately I don't understand this supposed multiple declaration, the types in 1302-referenzlisten.xsd are refernced form the other XSDs, but to me these are no declarations.
This is from 1302-hydraulikdaten.xsd where EinheitZielgroesseType is mentioned (line 12):

<xsd:complexType name="ZielgroesseType">
	<xsd:sequence>
		<xsd:element name="Zielgroessenkennung">
			<xsd:simpleType>
				<xsd:restriction base="xsd:string">
					<xsd:maxLength value="5"/>
				</xsd:restriction>
			</xsd:simpleType>
		</xsd:element>
		<xsd:element name="HydObjektTyp" type="HydraulikObjektTypType"/>
		<xsd:element name="ArtZielgroesse" type="ArtZielgroesseType"/>
		<xsd:element name="EinheitZielgroesse" type="EinheitZielgroesseType"/>
		<xsd:element name="WertZielgroesse">
			<xsd:simpleType>
				<xsd:restriction base="xsd:decimal">
					<xsd:totalDigits value="9"/>
					<xsd:fractionDigits value="3"/>
					<xsd:maxExclusive value="1000000"/>
				</xsd:restriction>
			</xsd:simpleType>
		</xsd:element>
	</xsd:sequence>
</xsd:complexType>

Probably my xml knowledge is insufficient, but I'm also not able to reproduce this error with e.g. xmlspy.
But maybe the GMLAS driver is (too) picky on this??

The failure with OGR (OSGeo4W Shell) is unspecific, by the way. ERROR 3: Cannot open...

A workaround to make the opening/reading with GMLAS run is to comment the include of 'referenzlisten.xsd' out: 1302-metadaten.xsd, line 10
<!-- <xsd:include schemaLocation=".\1302-referenzlisten.xsd"/> -->

@sgrellet
Copy link
Member

sgrellet commented Dec 5, 2017

Hi,

Thanks. Could you upload the file(s) that cause the error so that we can take a look ?
Thanks

kwrobot pushed a commit to aashish24/gdal-svn that referenced this issue Dec 5, 2017
kwrobot pushed a commit to aashish24/gdal-svn that referenced this issue Dec 5, 2017
rouault added a commit to OSGeo/gdal that referenced this issue Dec 5, 2017
@rouault
Copy link
Collaborator

rouault commented Dec 5, 2017

I'm unable to reproduce the issue on Linux (Ubuntu 16.04). I have had to do a few above adjustments, but they are unrelated to the issue you get. Here's what I get (with above fixes, and reverting your commmenting out of <xsd:include schemaLocation=".\1302-referenzlisten.xsd"/>. Note: I had to remove the comment in the middle of the element in the XML file itself, since this is invalid XML

$ ogrinfo GMLAS:isybau/ISYBAU_XML-2013-Stammdaten_Sanierung_Abnahme.xml -oo XSD=isybau/1302-metadaten.xsd -oo remove_unused_layers=yes
INFO: Open of `GMLAS:isybau/ISYBAU_XML-2013-Stammdaten_Sanierung_Abnahme.xml'
      using driver `GMLAS' successful.
1: identifikation (None)
2: identifikation_datenkollektive_kennungen_kollektiv (None)
3: identifikation_datenkollektive_stammdatenkollektiv (None)
4: identifikatio_datenkollekti_stammdatenkoll_auftraege_auftrag (None)
5: identifikati_datenkollekti_stammdatenkol_abwassertechnanlage (None)
6: ident_daten_stamm_abwasanlag_knote_bauwe_behan_anlage_anlage (None)
7: identi_datenk_stammd_abwassanlage_geomet_geomet_knoten_punkt (None)
8: identi_datenk_stammd_abwassanlage_geomet_geomet_kanten_kante (None)
9: ident_daten_stammd_abwassanlage_geomet_geomet_polygo_polygon (None)
10: ident_daten_stamm_abwasanlag_geome_geome_polygo_polygo_kante (None)
11: identifi_datenkol_stammdat_abwasseranlage_sanierun_massnahme (None)
12: identifikation_datenkollektive_zustandsdatenkollektiv (None)
13: identifikatio_datenkollekti_zustandsdatenk_auftraege_auftrag (None)
14: identifika_datenkolle_zustandsda_inspiziertabwassertecanlage (None)
15: iden_date_zust_inspabwaanlag_optisinspe_rohrl_inspe_rzustand (None)
16: iden_date_zust_inspabwaanlag_optisinspe_knote_inspe_kzustand (None)
17: identi_datenko_zustand_inspiziabwasseanlage_dichthe_pruefung (None)
18: iden_date_zust_inspabwaanla_dich_prue_pruefobjek_pruefobjekt (None)

Perhaps this is a OSGeo4W specific issue. Apparently OSGeo4W uses Xerces 3.1.1 ( http://download.osgeo.org/osgeo4w/x86_64/release/xerces-c/ ), which is not the latest one. But I also tested it with it on Linux, and that works. Wondering if that might not be an issue with the Xerces build still using VS 2010 whereas GDAL is now built with VS 2015.

@tschuettenberg
Copy link
Author

So you say it ist not a matter of Xerces version, because 3.1.1 (which is part of OSGeo4W, that I use) works on Linux? But the different version of Visual Studio that xerces was build with causes this issue??
[oh dear!]

@rouault
Copy link
Collaborator

rouault commented Dec 5, 2017

So you say it ist not a matter of Xerces version, because 3.1.1 (which is part of OSGeo4W, that I use) works on Linux? But the different version of Visual Studio that xerces was build with causes this issue??
[oh dear!]

If there was an issue of incompatibilities between Visual Studio version, I would expect hard crashes, not a "clean error" as you get. So I don't know why this doesn't work on OSGeo4W

@sgrellet
Copy link
Member

sgrellet commented Dec 6, 2017

I updated my OsGeo4W setup this morning and xerces-c (3.2.0-1) was added.
With this (and doing the adjustment mentionned by Even here : #46 (comment)) I managed to open it.

C:\Users\grellets\Desktop\Tmp_GMLAS>ogrinfo GMLAS:ISYBAU_XML-2013-Stammdaten_Sanierung_Abnahme.xml -oo XSD=1302-metadaten.xsd -oo remove_unused_layers=yes
Warning 1: Unhandled type: gYearMonth
Had to open data source read-only.
INFO: Open of `GMLAS:ISYBAU_XML-2013-Stammdaten_Sanierung_Abnahme.xml'
      using driver `GMLAS' successful.
1: identifikation (None)
2: identifikation_datenkollektive_kennungen_kollektiv (None)
3: identifikation_datenkollektive_stammdatenkollektiv (None)
4: identifikatio_datenkollekti_stammdatenkoll_auftraege_auftrag (None)
5: identifikati_datenkollekti_stammdatenkol_abwassertechnanlage (None)
6: ident_daten_stamm_abwasanlag_knote_bauwe_behan_anlage_anlage (None)
7: identi_datenk_stammd_abwassanlage_geomet_geomet_knoten_punkt (None)
8: identi_datenk_stammd_abwassanlage_geomet_geomet_kanten_kante (None)
9: ident_daten_stammd_abwassanlage_geomet_geomet_polygo_polygon (None)
10: ident_daten_stamm_abwasanlag_geome_geome_polygo_polygo_kante (None)
11: identifi_datenkol_stammdat_abwasseranlage_sanierun_massnahme (None)
12: identifikation_datenkollektive_zustandsdatenkollektiv (None)
13: identifikatio_datenkollekti_zustandsdatenk_auftraege_auftrag (None)
14: identifika_datenkolle_zustandsda_inspiziertabwassertecanlage (None)
15: iden_date_zust_inspabwaanlag_optisinspe_rohrl_inspe_rzustand (None)
16: iden_date_zust_inspabwaanlag_optisinspe_knote_inspe_kzustand (None)
17: identi_datenko_zustand_inspiziabwasseanlage_dichthe_pruefung (None)
18: iden_date_zust_inspabwaanla_dich_prue_pruefobjek_pruefobjekt (None)

so, apart from the 'Unhandled type: gYearMonth' fixed by Even in gdal-svn this should be ok

@rouault
Copy link
Collaborator

rouault commented Dec 6, 2017

Thanks @jef-n for the OSGeo4W update !

@tschuettenberg
Copy link
Author

I also just updated my OSGeo4W (64bit), xerces-c xerces-c-bin xerces-c-devel 3.2.0-1 installed,
and fixed my faulty comment within the Identifikation element, but the error remains:

C:\>ogrinfo -ro GMLAS:Q:\gdm\isybau2qgep\ISYBAU_XML-2013-Stammdaten_Sanierung_Ab
nahme.xml
ERROR 1: Q:\isybau_schema\.\1302-referenzlisten.xsd:18:41 global type 'simpleTyp
e:DatenstatusType' declared more than once or also declared as complexType
ERROR 1: Q:\isybau_schema\.\1302-referenzlisten.xsd:68:42 global type 'simpleTyp
e:KollektivartType' declared more than once or also declared as complexType
ERROR 1: Q:\isybau_schema\.\1302-referenzlisten.xsd:103:43 global type 'simpleTy
pe:StammdatentypType' declared more than once or also declared as complexType
ERROR 1: Q:\isybau_schema\.\1302-referenzlisten.xsd:123:44 global type 'simpleTy
pe:ZustaendigkeitType' declared more than once or also declared as complexType
...
...
ERROR 1: Q:\isybau_schema\.\1302-referenzlisten.xsd:7056:48 global type 'simpleT
ype:EinheitZielgroesseType' declared more than once or also declared as complexT
ype
FAILURE:
Unable to open datasource `GMLAS:Q:\gdm\isybau2qgep\ISYBAU_XML-2013-Stammdaten_S
anierung_Abnahme.xml' with the following drivers.

The messages are explicit now, so I think the new xerces is actualy used. - What am I missing ?

@rouault
Copy link
Collaborator

rouault commented Dec 6, 2017

@tschuettenberg Are you sure you've attached the exact files you are testing (with the same file hieararchy) ? It seems weird that it works for @sgrellet and not for you with the same software configuration.

I could reproduce on Linux errors like the ones you get by modifying one of the xsd, e.g 1302-metadaten.xsd by modifying the <xsd:include schemaLocation=".\1302-referenzlisten.xsd"/> to something slightly different but that resolves at the end to the same file, for example <xsd:include schemaLocation="../1302-referenzlisten.xsd"/> . It might also occur if you use both relative path and absolute path in inclusion directives.

@tschuettenberg
Copy link
Author

tschuettenberg commented Dec 6, 2017

@rouault I double cross checked with the same files I provided (re-downloaded them) and I think I found the mistake:

C:\Users\grellets\Desktop\Tmp_GMLAS>ogrinfo GMLAS:ISYBAU_XML-2013-Stammdaten_Sanierung_Abnahme.xml -oo XSD=1302-metadaten.xsd

of @sgrellet worked, because this 1302-metadaten.xsd is the one I edited to skip the <xsd:include schemaLocation=".\1302-referenzlisten.xsd"/> by commenting it out (see above). The original unchanged Schema from ISYBAU is 1302-metadaten_ref.xsd (suffix by me for differentiation).

Sorry, clearly my fault, because the first one was/is also still refrerenced in ISYBAU_XML-2013-Stammdaten_Sanierung_Abnahme.xml:

<Identifikation xmlns="http://www.ofd-hannover.la/Identifikation"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xsi:schemaLocation="http://www.ofd-hannover.la/Identifikation ../1302_ISYBAU_XML_Schema/1302-metadaten.xsd">

I also tried some variants of the strange / \ relativ paths and combinations, like you mentioned, but could not find any further solution.

That means the error still occurs every time the path to an unchanged metadaten.xsd can be resolved, whether it is absolut or relative. And also no matter if it is done with -oo xsd or with my unprofessional xml edit.
(btw, the open option XSD is only available with ogr, not also in the gmlasconf.xml, right?)

@rouault
Copy link
Collaborator

rouault commented Dec 6, 2017

Are you using gdal-dev ? The fix OSGeo/gdal@e29945d might be needed

@tschuettenberg
Copy link
Author

In OSGeo4W Setup I see gdal-dev 2.3.0-40961 installed.
How can I be sure it is used?

(does it realy work on Linux with unchanged 1302-metadaten.xsd or have you been tricked as well?)

@rouault
Copy link
Collaborator

rouault commented Dec 6, 2017

You need to run the "gdal-env-dev.bat" script. It works on Linux with 1302-metadaten.xsd with <xsd:include schemaLocation=".\1302-referenzlisten.xsd"/> uncommented

@tschuettenberg
Copy link
Author

I'm sorry to cause so much trouble and I very much appreciate your help! Seems like I'm too stupid.
I ran C:\OSGeo4W64\bin\gdal-dev-env.bat from windows by clicking, in windows-cmd and in osgeo4w shell, explicitly as administrator as well as 'normal' (although I have local admin rights), but none of this had any effect on the declared more than once-error.
Also the environment variables did not show up in Windows>Settings>System>Advanced Settings>Environment variables, which I expected.
So I then added them by hand:
OSGEO4W_ROOT=C:\OSGeo4W64
GDAL_DATA=C:\OSGeo4W64\apps\gdal-dev\share\gdal
GDAL_DRIVER_PATH=C:\OSGeo4W64\apps\gdal-dev\bin\gdalplugins
PATH=C:\OSGeo4W64\apps\gdal-dev\bin; ... (in front of all the other previous values)

Still no effect: C:\Users\t.schuettenberg\Downloads\isybau>ogrinfo GMLAS:ISYBAU_XML-2013-Stammdaten_Sanierung_Abnahme.xml -oo XSD=1302-metadaten_ref.xsd results in the known error(s) - completely unedited xml and xsd files in the same directory.

@jef-n
Copy link

jef-n commented Dec 7, 2017

run them from the osgeo4w shell - only in that session gdal-dev will be enabled:

C:\Windows\System32>ogrinfo --version
GDAL 2.2.3, released 2017/11/20
C:\Windows\System32>call gdal-dev-env.bat
[...]
C:\Windows\System32>ogrinfo --version
GDAL 2.3.0dev, released 2017/99/99

@tschuettenberg
Copy link
Author

D'oh! Why couldn't I just stumble upon this??
Thanks, Jürgen, this way it works now. Thanks again to all of you!
(And I will revert the system environment variales.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants