Package org.geotools.xml

Examples of org.geotools.xml.Encoder.encode()


        features.add( sb.buildFeature("2"));
       
        Encoder encoder = new Encoder(new KMLConfiguration());
        encoder.setIndenting(true);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        encoder.encode(features, KML.kml, out );
        System.out.println( new String( out.toByteArray() ));
       
        DocumentBuilder db =
            DocumentBuilderFactory.newInstance().newDocumentBuilder();
        Document d = db.parse( new ByteArrayInputStream( out.toByteArray() ) );
View Full Code Here


        SimpleFeature f = sb.buildFeature("kml");
       
        Encoder encoder = new Encoder(new KMLConfiguration());
        encoder.setIndenting(true);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        encoder.encode(f, KML.kml, out );
       
        DocumentBuilder db =
            DocumentBuilderFactory.newInstance().newDocumentBuilder();
        Document d = db.parse( new ByteArrayInputStream( out.toByteArray() ) );
        assertEquals( "kml:kml", d.getDocumentElement().getNodeName() );
View Full Code Here

        Encoder encoder = new Encoder(config);
        encoder.setIndenting(true);

        // http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd
        ExecuteType request = createExecuteType();
        encoder.encode(request, WPS.Execute, outputStream);
        // System.out.println(outputStream.toString());
    }

    @SuppressWarnings("unchecked")
    private ExecuteType createExecuteType()
View Full Code Here

    private void testEncodeCalendar(Calendar cal, QName qname, String expected) throws Exception {
        Encoder encoder = new Encoder(new TestConfiguration());
        ByteArrayOutputStream out = new ByteArrayOutputStream();

        encoder.encode(cal, qname, out);
       
        Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder()
                .parse(new ByteArrayInputStream(out.toByteArray()));
       
        String encodedValue = dom.getDocumentElement().getTextContent();
View Full Code Here

        ByteArrayOutputStream out = new ByteArrayOutputStream();

        final Encoder encoder = prepareEncoder(request);
        final QName opName = getOperationName(request.getOperation());

        encoder.encode(requestObject, opName, out);

        requestTrace("Encoded ", request.getOperation(), " request: ", out);

        System.err.println(out.toString());
       
View Full Code Here

        // do not write the xml declaration
        encoder.setOmitXMLDeclaration(true);
        encoder.setEncoding(Charset.forName("UTF-8"));

        OutputStream out = new ByteArrayOutputStream();
        encoder.encode(filter, OGC.Filter, out);
        String encoded = out.toString();
        encoded = encoded.replaceAll("\n", "");
        return encoded;
    }
View Full Code Here

    org.geotools.sld.v1_1.SLDConfiguration configuration = new org.geotools.sld.v1_1.SLDConfiguration();
    Encoder encoder = new org.geotools.xml.Encoder(configuration);

    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    try {
      encoder.encode(style,
          org.geotools.sld.bindings.SLD.FEATURETYPESTYLE,
          outputStream);
      String document = outputStream.toString("UTF-8");

      text.setText(document);
View Full Code Here

    org.geotools.sld.v1_1.SLDConfiguration configuration = new org.geotools.sld.v1_1.SLDConfiguration();
    Encoder encoder = new org.geotools.xml.Encoder(configuration);

    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    try {
      encoder.encode(style,
          org.geotools.sld.bindings.SLD.STYLEDLAYERDESCRIPTOR,
          outputStream);
      String document = outputStream.toString("UTF-8");

      display(document, SLD_1_1);
View Full Code Here

            FeatureCollectionType featureCollectionType = WfsFactory.eINSTANCE
                    .createFeatureCollectionType();
            featureCollectionType.getFeature().add(collection);

            e.encode(featureCollectionType, org.geotools.wfs.WFS.FeatureCollection, out);
        }
        if (version == Version.WFS1_1) {
            Encoder e = new Encoder(new org.geotools.wfs.v1_1.WFSConfiguration());
            e.getNamespaces().declarePrefix(prefix, namespace);
            e.setIndenting(true);
View Full Code Here

            FeatureCollectionType featureCollectionType = WfsFactory.eINSTANCE
                    .createFeatureCollectionType();
            featureCollectionType.getFeature().add(collection);

            e.encode(featureCollectionType, org.geotools.wfs.WFS.FeatureCollection, out);
        }
    }

    private void encodeLegacyGML2(OutputStream out, SimpleFeatureCollection collection)
            throws IOException {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.