ISO-TC211 / schemas

Official ISO/TC 211 XML Schemas (input to schemas.isotc211.org)
6 stars 8 forks source link

Validation against xml schema error #4

Closed teo89 closed 5 years ago

teo89 commented 5 years ago

Hello, I used the "fromISO19139.xsl" to convert an old xml file with root element the gmd:MD_Metadata to mdb:MD_Metadata. As a next step I tried to validate the converted xml file against the mdb.xsd file with Oxygen and with java code but the following error occurred in both cases. "Cannot find the declaration of element 'mdb:MD_Metadata'" I tried also to validate the https://standards.iso.org/iso/19115/-3/mdb/1.0/mdb_valid.xml but the same error occurred. Any ideas why the converted xml file is not vaild?

PeterParslow commented 5 years ago

My guess: nothing in your set up has any reference to the schema location for the mdb.xsd?

For the file at https://standards.iso.org/iso/19115/-3/mdb/1.0/mdb_valid.xml to validate, either "mdb.xsd" has to be "in the same folder" (as it is if you validate it online), OR something in your Oxygen set up has to know where to find an XSD for the http://standards.iso.org/iso/19115/-3/mdb/1.0 namespace - this is generally done using an OASIS XML Catalog

Or to put it another way: a) in your file, what is set as the schema location? b) are you saving mdb_valid.xml locally & then trying to validate it?

See https://isotc.iso.org/livelink/livelink/fetch/-8849088/8849106/8849115/19197615/ISO_TC_211_XMG_0012.pdf for details of how to do this in various parsers (including Oxygen) - but note the advice is now five years old.

teo89 commented 5 years ago

I am using the online schema "https://standards.iso.org/iso/19115/-3/mdb/1.0/mdb.xsd" and I am getting org.xml.sax.SAXParseException; systemId: http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19136_Schemas/gml.xsd; lineNumber: 1; columnNumber: 1; Premature end of file.

Also if I use the "http://schemas.isotc211.org/19115/-3/mdb/1.0/mdb.xsd" I am getting the error

Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '301 Moved Permanently'.

But if I changed the url to "https://schemas.isotc211.org/19115/-3/mdb/1.0/mdb.xsd" I have the following issue: Invalid content was found starting with element 'mrs:MD_ReferenceSystem'. One of '{"http://standards.iso.org/iso/19115/-3/mcc/1.0":Abstract_ReferenceSystem}' is expected.

Why the implementation of the abstract class cannot be a valid element?

I am sorry for my questions but I really cannot understand fully the structure of the new implementation.

any ideas?

ronaldtse commented 5 years ago

@teo89 for schemas.isotc211.org schemas, please use the HTTPS link.

smrgeoinfo commented 5 years ago

Try using this for the schema location: <xsl:attribute name="xsi:schemaLocation" select="'http://standards.iso.org/iso/19115/-3/mds/1.0 https://schemas.isotc211.org/19115/-3/mds/1.0/mds.xsd'"/>

the mdb.xsd schema is just the base required elements for valid MD_Metadata, to get mrs and other namespace components, you need to use mds, which corresponds more closely to the 19115 gmd namespace.

teo89 commented 5 years ago

@smrgeoinfo Thank you very much. My assumption was that I need to use the mdb.xsd schema but the validation against mds.xsd schema worked. One extra question, I am trying to find where the gmd:updateScopeDescription element went. I see that the xsl converter changes the gmd:updateScopeDescription to mmi:updateScopeDescription which is not valid because the mmi does not have this element. Thank you

smrgeoinfo commented 5 years ago

looks like it should map to mmi:maintenanceScope with type mcc:MD_Scope, which has ScopeCode, Extent and ScopeDescription sub elements. That's a problem in the fromISO19139 transform, can you create a new issue for that?