-1

I'm developing a GIS application with java. I am using Spring RESTController and GeoTools. In client side(I use Openlayers 2.13.1), user modifies a feature of wfs layer and want to update it in server side. After modifying, user send the request as follow:

<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
    <wfs:Update typeName="feature:itsme" xmlns:feature="http://iran.me">
        <wfs:Property>
            <wfs:Name>the_geom</wfs:Name>
            <wfs:Value>
                <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
                    <gml:pos>49.02405689339376 34.858924130844805</gml:pos>
                </gml:Point>
            </wfs:Value>
        </wfs:Property>
        <wfs:Property>
            <wfs:Name>name</wfs:Name>
            <wfs:Value>Salam Bar Hossein</wfs:Value>
        </wfs:Property>
        <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
            <ogc:FeatureId fid="point.3"/>
        </ogc:Filter>
    </wfs:Update>
</wfs:Transaction>

In server side I want to parse this request and modify the record of table(I use postgis).

How do I parse xml?
How do I modify the record of table?

cнŝdk
  • 31,391
  • 7
  • 56
  • 78
Morteza Malvandi
  • 1,656
  • 7
  • 30
  • 73

1 Answers1

0

How do I parse xml?

There are plenty xml-parsers for java available. SAX-based, DOM-based...

How do I modify the record of table?

Well, that depends.

  • Do you use hibernate, or a framework that uses hibernate? There are spatial solutions for it, just look at this link for example.

  • Do you use raw SQL-processing? Then you will have to build a SQL-querystring ("INSERT INTO ...") on your server, and pump your data into your database. You have to take care of proper SQL-escapting to prevent injections.

Community
  • 1
  • 1
Mathias Vonende
  • 1,400
  • 1
  • 18
  • 28
  • I use hibernate and hibernate-spatial, but I nead my features be GeoTools Objects. How can I merge **Hibernate-spatial** with **GeoTools** – Morteza Malvandi May 04 '15 at 09:37