Package org.geotools.xml

Examples of org.geotools.xml.Encoder


        NamedLayer nl = sf.createNamedLayer();
        nl.setName("");
        nl.styles().add((Style) obj);
        sld.setStyledLayers(new StyledLayer[] { nl });

        Encoder e = new Encoder(sldConfiguration);
        e.encode(sld, element, handler);
    }
View Full Code Here


        return p.parse( input );
    }

    @Override
    public void encode(Object obj, ContentHandler handler) throws Exception {
        Encoder e = new Encoder( xml );
        e.encode( obj, element, handler );
    }
View Full Code Here

        return p.parse(input);
    }

    @Override
    public void encode(Object obj, ContentHandler handler) throws Exception {
        Encoder e = new Encoder(xml);
        e.encode(obj, element, handler);
    }
View Full Code Here

            ActionType action = (ActionType) response.getTransactionResults().getAction().iterator()
                                                     .next();
            throw new WFSException(action.getMessage(), action.getCode(), action.getLocator());
        }

        Encoder encoder = new Encoder(configuration, configuration.schema());
        encoder.setEncoding(Charset.forName( getInfo().getGeoServer().getSettings().getCharset()) );

        TransactionType req = (TransactionType)operation.getParameters()[0];
       
        encoder.setSchemaLocation(org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
                buildSchemaURL(req.getBaseUrl(), "wfs/1.1.0/wfs.xsd"));
        encoder.encode(response, org.geoserver.wfs.xml.v1_1_0.WFS.TRANSACTIONRESPONSE, output);
      
    }
View Full Code Here

    }

    public void write(Object value, OutputStream output, Operation operation)
            throws IOException, ServiceException {
   
        Encoder encoder = new Encoder( new GMLConfiguration() );
        encoder.setEncoding(Charset.forName( getInfo().getGeoServer().getSettings().getCharset() ));
       
        if ( value instanceof Point ) {
            encoder.encode( value, GML.Point, output );
        }
        else if ( value instanceof MultiPoint ) {
            encoder.encode( value, GML.MultiPoint, output );
        }
        else if ( value instanceof LineString ) {
            encoder.encode( value, GML.LineString, output );
        }
        else if ( value instanceof MultiLineString ) {
            encoder.encode( value, GML.MultiLineString, output );
        }
        else if ( value instanceof Polygon ) {
            encoder.encode( value, GML.Polygon, output );
        }
        else if ( value instanceof MultiPolygon ) {
            encoder.encode( value, GML.MultiPolygon, output );
        }
        else {
            throw new WFSException( "Cannot encode geometry of type: " + value.getClass() );
        }
     }
View Full Code Here

        return count;
    }

    protected void encode(FeatureCollectionResponse hits, OutputStream output, WFSInfo wfs)
        throws IOException {
        Encoder encoder = new Encoder(configuration, configuration.schema());
        encoder.setEncoding(Charset.forName( wfs.getGeoServer().getSettings().getCharset()) );
        encoder.setSchemaLocation(org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
            ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/1.1.0/wfs.xsd"));

        encoder.encode(hits.getAdaptee(), org.geoserver.wfs.xml.v1_1_0.WFS.FEATURECOLLECTION, output);
    }
View Full Code Here

    @Override
    public void write(Object value, OutputStream output, Operation operation) throws IOException,
            ServiceException {

        Encoder encoder = new Encoder(new WFSConfiguration());
        encoder.setEncoding(Charset.forName( getInfo().getGeoServer().getSettings().getCharset()) );
        encoder.setOmitXMLDeclaration(Dispatcher.REQUEST.get().isSOAP());

        String baseURL = (String) EMFUtils.get((EObject)operation.getParameters()[0], "baseUrl");
       
        encoder.setSchemaLocation(WFS.NAMESPACE, buildSchemaURL(baseURL, "wfs/2.0/wfs.xsd"));
        encode(encoder, value, output, operation);
    }
View Full Code Here

                //TODO: back up the old file in case there is an error during encoding
            }
           
            BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(f));
            try {
                Encoder e = new Encoder(new WFSConfiguration());
                e.setRootElementType(WFS.StoredQueryDescriptionType);
                e.encode(query.getQuery(), WFS.StoredQueryDescription, new BufferedOutputStream(bout));
                bout.flush();
            }
            finally {
                bout.close();
            }
View Full Code Here

        //create the encoder
        ApplicationSchemaXSD xsd = new ApplicationSchemaXSD( null, catalog, gft.getBaseUrl(),
            org.geotools.wfs.v1_0.WFS.getInstance(), featureTypes );
        Configuration configuration = new ApplicationSchemaConfiguration( xsd, new org.geotools.wfs.v1_0.WFSConfiguration() );
       
        Encoder encoder = new Encoder(configuration);
        //encoder.setEncoding(wfs.getCharSet());
       
       encoder.setSchemaLocation(org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
               buildSchemaURL(gft.getBaseUrl(), "wfs/1.0.0/WFS-basic.xsd"));

        //declare application schema namespaces
        Map<String, String> params = params("service", "WFS", "version", "1.0.0", "request", "DescribeFeatureType");
        for (Iterator i = ns2metas.entrySet().iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();

            NamespaceInfo ns = (NamespaceInfo) entry.getKey();
            String namespaceURI = ns.getURI();
           
            Collection metas = (Collection) entry.getValue();

            StringBuffer typeNames = new StringBuffer();

            for (Iterator m = metas.iterator(); m.hasNext();) {
                FeatureTypeInfo meta = (FeatureTypeInfo) m.next();
                typeNames.append(meta.getPrefixedName());

                if (m.hasNext()) {
                    typeNames.append(",");
                }
            }

            //set the schema location
            params.put("typeName", typeNames.toString());
            encoder.setSchemaLocation(namespaceURI,
                    buildURL(gft.getBaseUrl(), "wfs", params, URLType.RESOURCE));
        }

        encoder.encode(results.getAdaptee(), org.geotools.wfs.v1_0.WFS.FeatureCollection, output);
    }
View Full Code Here

   
    @Override
    protected void encode(FeatureCollectionResponse hits, OutputStream output, WFSInfo wfs)
            throws IOException {
        hits.setNumberOfFeatures(BigInteger.valueOf(0));
        Encoder e = new Encoder(new WFSConfiguration());
        e.setEncoding(Charset.forName( wfs.getGeoServer().getSettings().getCharset()) );
        e.setSchemaLocation(WFS.NAMESPACE,
            ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/2.0/wfs.xsd"));
       
        e.encode(hits.getAdaptee(), WFS.FeatureCollection, output);
    }
View Full Code Here

TOP

Related Classes of org.geotools.xml.Encoder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.