Hi,
at a first look your schema and the feature type mapping looks alright.
Did you create an workspace in GeoServer that matches your target schema ?
In your case it should be something like:
Name: ct
Namespace URI: http://geoserver.org/ct
Anyway, the error you are having shouldn't be related to the workspace
existence.
You upgraded your schema to make it a GML valid one but app-schema may still
look at a cached version of the previous one, make sure to clean app-schema
cache.
The cached schemas are normally stored in a directory named app-schema-cache:
http://docs.geoserver.org/latest/en/user/data/app-schema/app-schema-resolution.html
If none of the things above fix your issue try to share with us the full
mappings file and
schema as attached documents.
Regards,
Nuno Oliveira
On 09/25/2017 12:19 PM, Lange wrote:
Hi, thanks for reply ...
i changed schema:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
targetNamespace="http://geoserver.org/ct"
xmlns:ct="http://geoserver.org/ct"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:gml="http://www.opengis.net/gml"
attributeFormDefault="unqualified"
elementFormDefault="qualified"
version="1.0">
<xs:import namespace="http://www.opengis.net/gml"
schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/feature.xsd" />
<xs:element name="service" type="ct:ServiceType"
substitutionGroup="gml:_Feature" />
<xs:complexType name="ServiceType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="Id" type="xs:string" />
<xs:element name="Code" type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
and also mapping:
...
<typeMappings>
<FeatureTypeMapping>
<sourceDataStore>datastore</sourceDataStore>
<sourceType>service_v</sourceType>
<targetElement>ct:service</targetElement>
<attributeMappings>
<AttributeMapping>
<targetAttribute>Id</targetAttribute>
<sourceExpression>
<OCQL>id</OCQL>
</sourceExpression>
<encodeIfEmpty>true</encodeIfEmpty>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>Code</targetAttribute>
<sourceExpression>
<OCQL>code</OCQL>
</sourceExpression>
<encodeIfEmpty>true</encodeIfEmpty>
</AttributeMapping>
</attributeMappings>
</FeatureTypeMapping>
</typeMappings>
where service_v is db view:
create view service_v as
select id::text, code from service;
But result is the same:
There was an error trying to connect to store ct_service. Do you want to save
it anyway?
Original exception error:
java.util.NoSuchElementException: No top level element found in schemas:
{http://www.geoserver.org/ct}service
Thanks for any other idea,
--
Lange
la...@email.cz
---------- Původní e-mail ----------
Od: Ben Caradoc-Davies <b...@transient.nz>
Komu: lange <la...@email.cz>, geoserver-users@lists.sourceforge.net
Datum: 22. 9. 2017 22:09:22
Předmět: Re: [Geoserver-users] No top level element found in schemas
lange,
your top-level feature type specified in
<targetElement>ct:service</targetElement> must be a GML element that is
a GML feature type, a subtype of gml:AbstractFeatureType, for example,
defined with XML schema <extension base="gml:AbstractFeatureType">.
ct:service defined in you schema below is not a GML feature type.
Also, idExpression sets the gml:id attribute, not the content of a
targetAttribute. In your mapping you should be using sourceExpression.
Kind regards,
Ben.
On 22/09/17 21:46, lange wrote:
> Since there was problem with my previous post, i'm posting it once again
..
> Sorry for duplicity ...
>
> Hi, im quite new in GeoServer world, but anyway ..
> Im trying to create some working example of new store of type Application
> Schema DataAccess
>
> I have data in postgre database, for this example i just have a simple
> table: service(id uuid, name text)
>
> Then i have datastore.xml:
> <dataStore>
> <id>ct_service_datastore</id>
> <name>ct_service</name>
> <description>Service</description>
> <enabled>true</enabled>
> <workspace>
> <id>ct_workspace</id>
> </workspace>
> <connectionParameters>
> <entry key="namespace">http://geoserver.org/ct</entry>
> <entry key="dbtype">app-schema</entry>
> <entry key="url">file:workspaces/ct/ct_service/ct_service.xml</entry>
> </connectionParameters>
> <__default>false</__default>
> </dataStore>
>
> and ct_service.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <as:AppSchemaDataAccess
> xmlns:as="http://www.geotools.org/app-schema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.geotools.org/app-schema
> AppSchemaDataAccess.xsd">
> <namespaces>
> <Namespace>
> <prefix>ct</prefix>
> <uri>http://www.geoserver.org/ct</uri>
> </Namespace>
> <Namespace>
> <prefix>xlink</prefix>
> <uri>http://www.w3.org/1999/xlink</uri>
> </Namespace>
> </namespaces>
> <sourceDataStores>
> <DataStore>
> <id>datastore</id>
> <parameters>
> <Parameter>
> <name>dbtype</name>
> <value>postgisng</value>
> </Parameter>
> <Parameter>
> <name>schema</name>
> <value>public</value>
> </Parameter>
> <Parameter>
> <name>database</name>
> <value>ctTest</value>
> </Parameter>
> <Parameter>
> <name>host</name>
> <value>localhost</value>
> </Parameter>
> <Parameter>
> <name>port</name>
> <value>5432</value>
> </Parameter>
> <Parameter>
> <name>user</name>
> <value>ct</value>
> </Parameter>
> <Parameter>
> <name>passwd</name>
> <value>ct</value>
> </Parameter>
> <Parameter>
> <name>Expose primary keys</name>
> <value>true</value>
> </Parameter>
> <Parameter>
> <name>Connection timeout</name>
> <value>20</value>
> </Parameter>
> <Parameter>
> <name>namespace</name>
> <value>http://geoserver.org/ct</value>
> </Parameter>
> </parameters>
> </DataStore>
> </sourceDataStores>
> <targetTypes>
> <FeatureType>
> <schemaUri>http://localhost/ct/service.xsd</schemaUri>
> </FeatureType>
> </targetTypes>
> <typeMappings>
> <FeatureTypeMapping>
> <sourceDataStore>datastore</sourceDataStore>
> <sourceType>service</sourceType>
> <targetElement>ct:service</targetElement>
> <attributeMappings>
> <AttributeMapping>
> <targetAttribute>
> ct:Id
> </targetAttribute>
> <idExpression>
> <OCQL>id</OCQL>
> </idExpression>
> </AttributeMapping>
> <AttributeMapping>
> <targetAttribute>
> ct:Code
> </targetAttribute>
> <idExpression>
> <OCQL>code</OCQL>
> </idExpression>
> </AttributeMapping>
> </attributeMappings>
> </FeatureTypeMapping>
> </typeMappings>
> </as:AppSchemaDataAccess>
>
> and service.xsd:
> <?xml version="1.0" encoding="utf-8"?>
> <xs:schema
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:wfs="http://www.opengis.net/wfs"
> xmlns:ct="http://geoserver.org/ct"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:gml="http://www.opengis.net/gml"
> attributeFormDefault="unqualified"
> elementFormDefault="qualified"
> targetNamespace="http://geoserver.org/ct">
> <xs:element name="service" type="ct:serviceType"/>
> <xs:complexType name="serviceType">
> <xs:sequence>
> <xs:element name="Id" type="xs:string" />
> <xs:element name="Code" type="xs:string" />
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
>
> and featuretype.xml:
> <featureType>
> <id>service_featuretype</id>
> <name>service</name>
> <nativeName>service</nativeName>
> <namespace>
> <id>ct_namespace</id>
> </namespace>
> <title>ct_service</title>
> <keywords>
> <string>features</string>
> <string>ct_service</string>
> </keywords>
> <srs>EPSG:3067</srs>
> <nativeBoundingBox>
> <minx>43547.78932226647</minx>
> <maxx>764796.7155847414</maxx>
> <miny>6523158.091198515</miny>
> <maxy>7795461.187543589</maxy>
> <crs class="projected">EPSG:3067</crs>
> </nativeBoundingBox>
> <latLonBoundingBox>
> <minx>15.053785270822843</minx>
> <maxx>33.993537468175056</maxx>
> <miny>58.60745650071967</miny>
> <maxy>70.26415661214813</maxy>
> <crs>EPSG:4326</crs>
> </latLonBoundingBox>
> <projectionPolicy>FORCE_DECLARED</projectionPolicy>
> <enabled>true</enabled>
> <store class="dataStore">
> <id>ct_service_datastore</id>
> </store>
> <maxFeatures>0</maxFeatures>
> <numDecimals>0</numDecimals>
> <overridingServiceSRS>false</overridingServiceSRS>
> <skipNumberMatched>false</skipNumberMatched>
> <circularArcPresent>false</circularArcPresent>
> </featureType>
>
> But when i open store in GeoServer and try to save, i get error:
> Edit Vector Data Source
> There was an error trying to connect to store ct_service. Do you want to
> save it anyway?
> Original exception error:
> java.util.NoSuchElementException: No top level element found in schemas:
> {http://www.geoserver.org/ct}service
>
>
> I googled some advices, but was not able to fix this issue :-(
> Could someone check the files and help me, please?
>
> Thanks a lot for any clue,
> Lge
>
>
>
> --
> Sent from:
http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html
>
>
------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting to
this list:
> - Earning your support instead of buying it, but Ian Turton:
http://www.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines:
http://geoserver.org/comm/userlist-guidelines.html
>
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
--
Ben Caradoc-Davies <b...@transient.nz>
Director
Transient Software Limited <http://transient.nz/>
New Zealand
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list
Please make sure you read the following two resources before posting to this
list:
- Earning your support instead of buying it, but Ian Turton:
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines:
http://geoserver.org/comm/userlist-guidelines.html
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V
for more information.
==
Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer
GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i
file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo
è consentito esclusivamente al destinatario del messaggio, per le finalità
indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne
il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di
procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro
sistema. Conservare il messaggio stesso, divulgarlo anche in parte,
distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse,
costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list
Please make sure you read the following two resources before posting to this
list:
- Earning your support instead of buying it, but Ian Turton:
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines:
http://geoserver.org/comm/userlist-guidelines.html
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users