[Geoserver-users] No top level element found in schemas

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&lt;/entry&gt;
    <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&quot;
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation="http://www.geotools.org/app-schema
AppSchemaDataAccess.xsd">
    <namespaces>
        <Namespace>
            <prefix>ct</prefix>
            <uri>http://www.geoserver.org/ct&lt;/uri&gt;
        </Namespace>
        <Namespace>
            <prefix>xlink</prefix>
            <uri>http://www.w3.org/1999/xlink&lt;/uri&gt;
        </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&lt;/value&gt;
        </Parameter>
      </parameters>
        </DataStore>
    </sourceDataStores>
    <targetTypes>
        <FeatureType>
            <schemaUri>http://localhost/ct/service.xsd&lt;/schemaUri&gt;
        </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&quot;
  xmlns:wfs="http://www.opengis.net/wfs&quot;
  xmlns:ct="http://geoserver.org/ct&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xmlns:gml="http://www.opengis.net/gml&quot;
  attributeFormDefault="unqualified"
  elementFormDefault="qualified"
  targetNamespace="http://geoserver.org/ct&quot;&gt;
  <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 :frowning:
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

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&lt;/entry&gt;
     <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&quot;
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation="http://www.geotools.org/app-schema
AppSchemaDataAccess.xsd">
     <namespaces>
         <Namespace>
             <prefix>ct</prefix>
             <uri>http://www.geoserver.org/ct&lt;/uri&gt;
         </Namespace>
         <Namespace>
             <prefix>xlink</prefix>
             <uri>http://www.w3.org/1999/xlink&lt;/uri&gt;
         </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&lt;/value&gt;
        </Parameter>
      </parameters>
         </DataStore>
     </sourceDataStores>
     <targetTypes>
         <FeatureType>
             <schemaUri>http://localhost/ct/service.xsd&lt;/schemaUri&gt;
         </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&quot;
  xmlns:wfs="http://www.opengis.net/wfs&quot;
  xmlns:ct="http://geoserver.org/ct&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xmlns:gml="http://www.opengis.net/gml&quot;
  attributeFormDefault="unqualified"
  elementFormDefault="qualified"
  targetNamespace="http://geoserver.org/ct&quot;&gt;
  <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 :frowning:
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 <ben@anonymised.com>
Director
Transient Software Limited <http://transient.nz/&gt;
New Zealand

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:



datastore
service_v
ct:service


Id

id

true


Code

code

true



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
lange@anonymised.com

---------- Původní e-mail ----------

Od: Ben Caradoc-Davies ben@anonymised.com

Komu: lange lange@anonymised.com, 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
ct:service must be a GML element that is
a GML feature type, a subtype of gml:AbstractFeatureType, for example,
defined with XML schema .
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:

ct_service_datastore
ct_service
Service
true

ct_workspace


http://geoserver.org/ct
app-schema
file:workspaces/ct/ct_service/ct_service.xml

<__default>false</__default>

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”>


ct
http://www.geoserver.org/ct


xlink
http://www.w3.org/1999/xlink




datastore


dbtype
postgisng


schema
public


database
ctTest


host
localhost


port
5432


user
ct


passwd
ct


Expose primary keys
true


Connection timeout
20


namespace
http://geoserver.org/ct






http://localhost/ct/service.xsd




datastore
service
ct:service



ct:Id


id




ct:Code


code





</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:

service_featuretype
service
service

ct_namespace

ct_service features ct_service EPSG:3067 43547.78932226647 764796.7155847414 6523158.091198515 7795461.187543589 EPSG:3067 15.053785270822843 33.993537468175056 58.60745650071967 70.26415661214813 EPSG:4326 FORCE_DECLARED true ct_service_datastore 0 0 false false false

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 :frowning:
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:

Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users


Ben Caradoc-Davies ben@anonymised.com
Director
Transient Software Limited http://transient.nz/
New Zealand

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:



datastore
service_v
ct:service


Id

id

true


Code

code

true



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
lange@anonymised.com

    ---------- Původní e-mail ----------

    Od: Ben Caradoc-Davies [<ben@anonymised.com>](mailto:ben@anonymised.com)

    Komu: lange [<lange@anonymised.com>](mailto:lange@anonymised.com),
    [geoserver-users@lists.sourceforge.net](mailto: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
ct:service must be a GML element that is
a GML feature type, a subtype of gml:AbstractFeatureType, for example,
defined with XML schema .
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:

ct_service_datastore
ct_service
Service
true

ct_workspace


http://geoserver.org/ct
app-schema
file:workspaces/ct/ct_service/ct_service.xml

<__default>false</__default>

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”>


ct
http://www.geoserver.org/ct


xlink
http://www.w3.org/1999/xlink




datastore


dbtype
postgisng


schema
public


database
ctTest


host
localhost


port
5432


user
ct


passwd
ct


Expose primary keys
true


Connection timeout
20


namespace
http://geoserver.org/ct






http://localhost/ct/service.xsd




datastore
service
ct:service



ct:Id


id




ct:Code


code





</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:

service_featuretype
service
service

ct_namespace

ct_service features ct_service EPSG:3067 43547.78932226647 764796.7155847414 6523158.091198515 7795461.187543589 EPSG:3067 15.053785270822843 33.993537468175056 58.60745650071967 70.26415661214813 EPSG:4326 FORCE_DECLARED true ct_service_datastore 0 0 false false false

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 :frowning:
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:

Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users


Ben Caradoc-Davies ben@anonymised.com
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](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#/](http://www.ianturton.com/talks/foss4g.html#/)
- The GeoServer user list posting guidelines: [http://geoserver.org/comm/userlist-guidelines.html](http://geoserver.org/comm/userlist-guidelines.html)

[Geoserver-users@lists.sourceforge.net](mailto:Geoserver-users@lists.sourceforge.net)
[https://lists.sourceforge.net/lists/listinfo/geoserver-users](https://lists.sourceforge.net/lists/listinfo/geoserver-users)

-- 
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the experts! Visit [http://goo.gl/it488V](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://www.geo-solutions.it)
[http://twitter.com/geosolutions_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.

Lange,

did you remove the old app-schema-cache/localhost/ct/service.xsd to force an update? app-schema will cache schemas indefinitely and not check for an update.

Kind regards,
Ben.

On 26/09/17 00:19, Lange wrote:

Hi, thanks for reply ...
i changed schema:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema
targetNamespace="http://geoserver.org/ct&quot;
xmlns:ct="http://geoserver.org/ct&quot;
xmlns:xs="http://www.w3.org/2001/XMLSchema&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
attributeFormDefault="unqualified"
elementFormDefault="qualified"
version="1.0">
       <xs:import namespace="http://www.opengis.net/gml&quot; schemaLocation=
"http://schemas.opengis.net/gml/3.1.1/base/feature.xsd&quot; />
<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,

--
Ben Caradoc-Davies <ben@anonymised.com>
Director
Transient Software Limited <http://transient.nz/&gt;
New Zealand

Hi, thanks for reply.

i always copy schema file (service2.xsd) manually to folder d:\GeoServer\2.11.2\data_dir\app-schema-cache\localhost\ct\ … so i hope that the problem is not caused by cache.
Files are attached.

Thanks a lot,
Lange
lange@anonymised.com

---------- Původní e-mail ----------

Od: Nuno Oliveira nuno.oliveira@anonymised.com

Komu: geoserver-users@lists.sourceforge.net

Datum: 25. 9. 2017 16:07:30

Předmět: Re: [Geoserver-users] No top level element found in schemas

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:



datastore
service_v
ct:service


Id

id

true


Code

code

true



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
lange@anonymised.com

    ---------- Původní e-mail ----------

    Od: Ben Caradoc-Davies [<ben@anonymised.com.6881...>](mailto:ben@anonymised.com)

    Komu: lange [<lange@anonymised.com.>](mailto:lange@anonymised.com),
    [geoserver-users@lists.sourceforge.net](mailto: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
ct:service must be a GML element that is
a GML feature type, a subtype of gml:AbstractFeatureType, for example,
defined with XML schema .
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:

ct_service_datastore
ct_service
Service
true

ct_workspace


http://geoserver.org/ct
app-schema
file:workspaces/ct/ct_service/ct_service.xml

<__default>false</__default>

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”>


ct
http://www.geoserver.org/ct


xlink
http://www.w3.org/1999/xlink




datastore


dbtype
postgisng


schema
public


database
ctTest


host
localhost


port
5432


user
ct


passwd
ct


Expose primary keys
true


Connection timeout
20


namespace
http://geoserver.org/ct






http://localhost/ct/service.xsd




datastore
service
ct:service



ct:Id


id




ct:Code


code





</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:

service_featuretype
service
service

ct_namespace

ct_service features ct_service EPSG:3067 43547.78932226647 764796.7155847414 6523158.091198515 7795461.187543589 EPSG:3067 15.053785270822843 33.993537468175056 58.60745650071967 70.26415661214813 EPSG:4326 FORCE_DECLARED true ct_service_datastore 0 0 false false false

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 :frowning:
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:

Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users


Ben Caradoc-Davies <ben@anonymised.com1…>
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](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#/](http://www.ianturton.com/talks/foss4g.html#/)
- The GeoServer user list posting guidelines: [http://geoserver.org/comm/userlist-guidelines.html](http://geoserver.org/comm/userlist-guidelines.html)

[Geoserver-users@anonymised.comsts.sourceforge.net](mailto:Geoserver-users@lists.sourceforge.net)
[https://lists.sourceforge.net/lists/listinfo/geoserver-users](https://lists.sourceforge.net/lists/listinfo/geoserver-users)

-- 
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the experts! Visit [http://goo.gl/it488V](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://www.geo-solutions.it)
[http://twitter.com/geosolutions_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:

Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

ct_service.xml (2.87 KB)

workspace.xml (66 Bytes)

featuretype.xml (1.09 KB)

namespace.xml (107 Bytes)

datastore.xml (458 Bytes)

service2.xsd (852 Bytes)

error message.png

[Resending after SourceForge outage <https://twitter.com/sfnet_ops/status/913182760927297536&gt; SF.net Operations‏ @sfnet_ops Replying to @bencdnz Hi Ben! We had issues with power at our colocation facility. Services may be intermittently interrupted while SF storage clusters re-sync.]

Lange,

in your mapping file ct_service.xml, the ct namespace is "http://www.geoserver.org/ct&quot;, but in your datastore.xml, namespace.xml, and service2.xml, the ct namespace is "http://geoserver.org/ct&quot; with no "www.". This namespace mismatch will prevent app-schema from finding the element. Please try removing the "www." from the ct namespace in ct_service.xml.

Kind regards,
Ben.

On 27/09/17 20:53, Lange wrote:

Hi, thanks for reply.

i always copy schema file (service2.xsd) manually to folder d:\GeoServer\
2.11.2\data_dir\app-schema-cache\localhost\ct\ .. so i hope that the problem
is not caused by cache.
Files are attached.

Thanks a lot,
Lange
lange@anonymised.com

---------- Původní e-mail ----------
Od: Nuno Oliveira <nuno.oliveira@anonymised.com>
Komu: geoserver-users@lists.sourceforge.net
Datum: 25. 9. 2017 16:07:30
Předmět: Re: [Geoserver-users] No top level element found in schemas
"
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(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
(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&quot;\(http://geoserver.org/ct\)
xmlns:ct="http://geoserver.org/ct&quot;\(http://geoserver.org/ct\)
xmlns:xs="http://www.w3.org/2001/XMLSchema&quot;
(http://www.w3.org/2001/XMLSchema)
xmlns:gml="http://www.opengis.net/gml&quot;\(http://www.opengis.net/gml\)
attributeFormDefault="unqualified"
elementFormDefault="qualified"
version="1.0">
       <xs:import namespace="http://www.opengis.net/gml&quot;
(http://www.opengis.net/gml) schemaLocation="http://schemas.opengis.net/gml/
3.1.1/base/feature.xsd"
(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(http://www.geoserver.org/ct)\}service

Thanks for any other idea,

------------------------------------------------------------------------------
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 <ben@anonymised.com>
Director
Transient Software Limited <http://transient.nz/&gt;
New Zealand