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