<div dir="ltr">Hi,<div><br></div><div>yes, the apiso.xsd worked -thanks a lot</div></div><br><div class="gmail_quote"><div dir="ltr">po 5. 10. 2015 v 21:47 odesílatel Tom Kralidis <<a href="mailto:tomkralidis@gmail.com">tomkralidis@gmail.com</a>> napsal:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Jachym: comments interleaved:<br>
<br>
On Sat, Oct 3, 2015 at 11:35 AM, Jachym Cepicky<br>
<<a href="mailto:jachym.cepicky@gmail.com" target="_blank">jachym.cepicky@gmail.com</a>> wrote:<br>
> hi tom,<br>
><br>
> in PyWPS-4 we will have exactly this option for Inputs - they may pass the<br>
> validation based on configuration. I think, it is good feature to have in<br>
> order to have your (meta)data records in shape.<br>
><br>
<br>
If you can file a GitHub issue<br>
(<a href="https://github.com/geopython/pycsw/issues/new" rel="noreferrer" target="_blank">https://github.com/geopython/pycsw/issues/new</a>), that would be great.<br>
<br>
> However, I would say, this problem happens *before* the record get's<br>
> validated.<br>
><br>
> What profile (namespace) are you guys using for your geospatial metadata (of<br>
> data and services)?<br>
><br>
<br>
pycsw generally leaves that up to the metadata provider.  For ISO, generally:<br>
<br>
19139 (data): <a href="http://www.isotc211.org/2005/gmd/gmd.xsd" rel="noreferrer" target="_blank">http://www.isotc211.org/2005/gmd/gmd.xsd</a><br>
19119 (services): <a href="http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd" rel="noreferrer" target="_blank">http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd</a><br>
<br>
Note that the CSW ISO Application Profile provides<br>
<a href="http://schemas.opengis.net/csw/2.0.2/profiles/apiso/1.0.0/apiso.xsd" rel="noreferrer" target="_blank">http://schemas.opengis.net/csw/2.0.2/profiles/apiso/1.0.0/apiso.xsd</a> as<br>
a convenience to support both data and services.<br>
<br>
Having said this, when I make some changes (invalid ISO dates,<br>
ordering of some elements, invalid xs:ID values), your metadata<br>
document in your example URL validates with no problem against<br>
<a href="http://schemas.opengis.net/csw/2.0.2/profiles/apiso/1.0.0/apiso.xsd" rel="noreferrer" target="_blank">http://schemas.opengis.net/csw/2.0.2/profiles/apiso/1.0.0/apiso.xsd</a><br>
<br>
Hope this helps.<br>
<br>
..Tom<br>
<br>
<br>
> Thanks<br>
><br>
> jachym<br>
><br>
> P.S. Sorry, if my questions seem odd - I'm quite new to practical usage of<br>
> this field<br>
><br>
> so 3. 10. 2015 v 14:54 odesílatel Tom Kralidis <<a href="mailto:tomkralidis@gmail.com" target="_blank">tomkralidis@gmail.com</a>><br>
> napsal:<br>
>><br>
>> Hi Jachym: looks like the metadata record itself is not valid.  CSW<br>
>> itself leaves GetRecords and GetRecordById responses relatively open<br>
>> (either the default Dublin Core + ows:BoundingBox, or anything else),<br>
>> given the various metadata formats.<br>
>><br>
>> pycsw does not perform XML validation when ingesting metadata records<br>
>> (either via CSW-T operations or via the pycsw-admin.py load_records<br>
>> command).  Rather, pycsw parses the metadata record (assuming it's a<br>
>> supported format, else throws an error) and inserts it into the<br>
>> repository.<br>
>><br>
>> Note you can use pycsw-admin.py to validate XML records before insertion<br>
>> with:<br>
>><br>
>> pycsw-admin.py -c validate_xml -x file.xml -s file.xsd<br>
>><br>
>> Or you can use the pycsw API (assuming 1.10.2) like:<br>
>><br>
>> from pycsw.admin import validate_xml<br>
>> result = validate_xml(xml_filepath, xsd_filepath)<br>
>><br>
>> Having said this, we never turned on validating parsers when ingesting<br>
>> metadata records given the reality that many / most are not XML valid.<br>
>> As enhancement, we could provide a configuration setting which turns<br>
>> on strict mode validation when ingesting metadata records into pycsw,<br>
>> like:<br>
>><br>
>> metadata_validation=off|warn|strict<br>
>><br>
>> What do folks think?<br>
>><br>
>> ..Tom<br>
>><br>
>><br>
>> On Fri, Oct 2, 2015 at 5:12 PM, Jachym Cepicky <<a href="mailto:jachym.cepicky@gmail.com" target="_blank">jachym.cepicky@gmail.com</a>><br>
>> wrote:<br>
>> > Hi all,<br>
>> ><br>
>> > I would like to validate some records from our PyCSW instance, but it<br>
>> > seems,<br>
>> > that the schemas are broken ? I test on Linux command line and python<br>
>> > lxml<br>
>> > with the same result:<br>
>> ><br>
>> > # download the metadata record<br>
>> > $ wget -O record.xml<br>
>> ><br>
>> > "<a href="http://geosense.cz/cgi-bin/csw.py?service=CSW&version=2.0.2&Request=GetRecordById&id=CZ-29002567-srv-jedinecny_nazev_sluzby&outputSchema=http://www.isotc211.org/2005/gmd&elementSetName=full" rel="noreferrer" target="_blank">http://geosense.cz/cgi-bin/csw.py?service=CSW&version=2.0.2&Request=GetRecordById&id=CZ-29002567-srv-jedinecny_nazev_sluzby&outputSchema=http://www.isotc211.org/2005/gmd&elementSetName=full</a>"<br>
>> ><br>
>> > # create local xsd schema file<br>
>> > $ cat << EOF > schema.xsd<br>
>> > <xs:schema xmlns:xs="<a href="http://www.w3.org/2001/XMLSchema" rel="noreferrer" target="_blank">http://www.w3.org/2001/XMLSchema</a>"<br>
>> > targetNamespace="<a href="http://www.isotc211.org/2005/srv" rel="noreferrer" target="_blank">http://www.isotc211.org/2005/srv</a>"<br>
>> > elementFormDefault="qualified" version="0.1"><br>
>> > <xs:include<br>
>> ><br>
>> > schemaLocation="<a href="http://schemas.opengis.net/iso/19139/20060504/srv/serviceMetadata.xsd" rel="noreferrer" target="_blank">http://schemas.opengis.net/iso/19139/20060504/srv/serviceMetadata.xsd</a>"/><br>
>> > </xs:schema><br>
>> > EOF<br>
>> ><br>
>> > # finally test the schema<br>
>> > $ xmllint --schema schema.xsd record.xml  --noout<br>
>> ><br>
>> > result:<br>
>> ><br>
>> ><br>
>> > <a href="http://schemas.opengis.net/iso/19139/20060504/gml/coordinateOperations.xsd:48" rel="noreferrer" target="_blank">http://schemas.opengis.net/iso/19139/20060504/gml/coordinateOperations.xsd:48</a>:<br>
>> > element element: Schemas parser error : Element<br>
>> > '{<a href="http://www.w3.org/2001/XMLSchema%7Delement" rel="noreferrer" target="_blank">http://www.w3.org/2001/XMLSchema}element</a>', attribute 'ref': The QName<br>
>> > value '{<a href="http://www.isotc211.org/2005/gmd%7DAbstractDQ_PositionalAccuracy" rel="noreferrer" target="_blank">http://www.isotc211.org/2005/gmd}AbstractDQ_PositionalAccuracy</a>'<br>
>> > does<br>
>> > not resolve to a(n) element declaration.<br>
>> > WXS schema schema.xsd failed to compile<br>
>> ><br>
>> > Any hint? Do I use proper version of XSD?<br>
>> ><br>
>> > Thanks for hint<br>
>> ><br>
>> > Jachym<br>
>> ><br>
</blockquote></div>