Hi Luca;

I am CCing the geotools-user list (as others in in a better spot to help you 
than me).
- One place where I would start would be with the test cases - which show what 
the code actually does right now.
- And with the recent email on geoserver-devel from Andrea (as he was wrestling 
with this topic - and show where the trouble spots are).

I note that the team working most XSD at the moment is app-schema team; and 
since they don't have to produce an XSD I doubt this area of the code that has 
been used much in the real world yet.

So while it may be your first experience, are are in good company (nobody has 
much experience here).

Jody

On 03/04/2011, at 5:03 AM, Luca Paolino UNISA wrote:

Hello Jody,
My name is Luca Paolino and I am an italian java developer working with web 
service based on geotools and XSD. This is my first experience on this topic 
and I heve some problems.
I have a problem with encoding and I hope you have ten minutes for helping me. 
May be you can solve my problem in ten minutes, but I am working on it by a 
week.
I have an XSD complex type but when I deploy it in my web service I can encode 
all but the New Table collection.
This is the encoded call.

<?xml version="1.0" encoding="UTF-8"?>
<gss:PostDiff fromVersion="-1" service="GSS" toVersion="-1"
    typeName="sf:restricted" version="1.0.0"
    xmlns:sf="http://www.openplans.org/spearfish";
    xmlns:gss="http://geoserver.org/gss";
    xmlns:ogc="http://www.opengis.net/ogc";
    xmlns:gml="http://www.opengis.net/gml";
    xmlns:xlink="http://www.w3.org/1999/xlink";
    xmlns:ows="http://www.opengis.net/ows"; 
xmlns:wfs="http://www.opengis.net/wfs";>
    <gss:Changes releaseAction="ALL" service="WFS" version="1.1.0"/>
    <gss:NewTable/>
</gss:PostDiff>

This is the XSD file.

   <xsd:element name="PostDiff" type="gss:PostDiffType" />
   <xsd:complexType name="PostDiffType">
      <xsd:complexContent>
         <xsd:extension base="wfs:BaseRequestType">
            <xsd:sequence>
               <xsd:element name="Changes" type="wfs:TransactionType" />
               <xsd:element name="NewTable" type="gss:NewTableElement" 
minOccurs="0" maxOccurs="unbounded" />
            </xsd:sequence>
            <xsd:attribute name="typeName" type="xsd:QName"
               use="required" />
            <xsd:attribute name="fromVersion" type="xsd:int"
               use="required" />
            <xsd:attribute name="toVersion" type="xsd:int"
               use="required" />
         </xsd:extension>
      </xsd:complexContent>
   </xsd:complexType>



   <xsd:element name="NewTableElement" type="gss:NewTableType" />
   <xsd:complexType name="NewTableType">
           <!--     <xsd:element name="typeName" type="xsd:QName"/>  -->
               <xsd:attribute name="tableName" type="xsd:int" use="required" />
               <xsd:attribute name="guid" type="xsd:int" use="required"/>
  </xsd:complexType>

This is the bean.

package org.geoserver.gss;

import java.util.ArrayList;
import java.util.List;

import javax.xml.namespace.QName;

import org.eclipse.emf.ecore.util.EcoreUtil;
import org.geoserver.gss.CentralRevisionsType.LayerRevision;

import net.opengis.wfs.TransactionType;

public class PostDiffType extends GSSRequest {

    QName typeName;

    long fromVersion;

    long toVersion;

    TransactionType transaction;


    List<NewTableType> newTables = new ArrayList<NewTableType>();

    public List<NewTableType> getNewTables() {
        return newTables;
    }


    /**
     * The layer to be
     *
     * @return
     */
    public QName getTypeName() {
        return typeName;
    }

    public void setTypeName(QName typeName) {
        this.typeName = typeName;
    }

    public long getFromVersion() {
        return fromVersion;
    }

    public void setFromVersion(long fromVersion) {
        this.fromVersion = fromVersion;
    }




    public long getToVersion() {
        return toVersion;
    }

    public void setToVersion(long toVersion) {
        this.toVersion = toVersion;
    }

    public TransactionType getTransaction() {
        return transaction;
    }

    public void setTransaction(TransactionType transaction) {
        this.transaction = transaction;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + (int) (fromVersion ^ (fromVersion >>> 32));
        result = prime * result + (int) (toVersion ^ (toVersion >>> 32));
        result = prime * result + ((transaction == null) ? 0 : 
transaction.hashCode());
        result = prime * result + ((typeName == null) ? 0 : 
typeName.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        PostDiffType other = (PostDiffType) obj;
        if (fromVersion != other.fromVersion)
            return false;
        if (toVersion != other.toVersion)
            return false;
        if (transaction == null) {
            if (other.transaction != null)
                return false;
        } else if (!EcoreUtil.equals(transaction, other.transaction))
            return false;
        if (typeName == null) {
            if (other.typeName != null)
                return false;
        } else if (!typeName.equals(other.typeName))
            return false;
        return true;
    }

}





--
Dr. Luca Paolino PhD
Via Ponte don Melillo
Università di Salerno
84084, Fisciano(SA) - Italy

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to