Package org.geotools.xml.schema

Examples of org.geotools.xml.schema.Element


public class XSISimpleTypesTest extends TestCase {

    public void testParseDate() throws Exception {
        SimpleType dateBinding = XSISimpleTypes.Date.getInstance();

        Element element = null;
        Attributes attrs = null;
        Map hints = null;
        ElementValue[] value;
        Date expected;
        String sval;
View Full Code Here


    }

    public void testParseDateTime() throws Exception {
        SimpleType dateTimeBinding = XSISimpleTypes.DateTime.getInstance();

        Element element = null;
        Attributes attrs = null;
        Map hints = null;
        ElementValue[] value;
        java.util.Date expected;
        String sval;
View Full Code Here

    }

    public void testParseTime() throws Exception {
        SimpleType timeBinding = XSISimpleTypes.Time.getInstance();

        Element element = null;
        Attributes attrs = null;
        Map hints = null;
        ElementValue[] value;
        java.util.Date expected;
        String sval;
View Full Code Here

        spf.setValidating(false);
        SAXParser parser = spf.newSAXParser();
        parser.parse(f, contentHandler);

        Schema schema = contentHandler.getSchema();
        Element geomElement = schema.getElements()[0].findChildElement("GEOM");
        GeometryFactory factory=new GeometryFactory();
        LinearRing ring = factory.createLinearRing(new Coordinate[]{
                new Coordinate(0,0),
                new Coordinate(10,0),
                new Coordinate(0,10),
                new Coordinate(0,0)
            });
        Polygon polygon = factory.createPolygon(ring, new LinearRing[0]);
        polygon.setUserData("EPSG:4326");
        MultiPolygon geom = factory.createMultiPolygon(new Polygon[]{polygon});
        geom.setUserData("EPSG:4326");
        final StringWriter writer = new StringWriter();
//        DocumentWriter.writeDocument(geom, schema, writer, new HashMap());
       
        PrintHandler output=new PrintHandler(){

            public void characters(char[] arg0, int arg1, int arg2) throws IOException {
                writer.write(arg0, arg1, arg2);
            }

            public void characters(String s) throws IOException {
                writer.write(s);
            }

            public void element(URI namespaceURI, String localName, Attributes attributes) throws IOException {
            }

            public void endDocument() throws IOException {
            }

            public void endElement(URI namespaceURI, String localName) throws IOException {
                writer.write("</"+localName+">");
            }

            public Element findElement(Object value) {
                return null;
            }

            public Element findElement(String name) {
                return null;
            }

            public Schema getDocumentSchema() {
                return null;
            }

            public Object getHint(Object key) {
                return null;
            }

            public void ignorableWhitespace(char[] arg0, int arg1, int arg2) throws IOException {
            }

            public void startDocument() throws IOException {
            }

            public void startElement(URI namespaceURI, String localName, Attributes attributes) throws IOException {
                writer.write("<"+localName);
                if( attributes!=null ){
                    for( int i=0; i<attributes.getLength(); i++){
                        writer.write(" "+attributes.getLocalName(i)+"="+attributes.getValue(i));
                    }
                }
                writer.write(">");
            }
           
        };
        geomElement.getType().encode(geomElement, geom, output, new HashMap());
        String expected="<GEOM><MultiPolygon srsName=EPSG:4326><polygonMember><Polygon srsName=EPSG:4326><outerBoundaryIs><LinearRing><coordinates decimal=. cs=, ts= >0.0,0.0 10.0,0.0 0.0,10.0 0.0,0.0</coordinates></LinearRing></outerBoundaryIs></Polygon></polygonMember></MultiPolygon></GEOM>";
        assertEquals(expected, writer.toString());
    }
View Full Code Here

            SimpleFeature f = a.getFeature();
            SimpleFeatureType featureType = f.getFeatureType();
            Name name = featureType.getName();           
            Schema schema = SchemaFactory.getInstance( name.getNamespaceURI() );
            Element[] els = schema.getElements();
            Element e = null;

            if (els != null) {
                for (int i = 0; i < els.length; i++){
                  String typeName = featureType.getTypeName();
                  if (typeName.indexOf(':')>=0) {
View Full Code Here

         *      org.xml.sax.Attributes)
         */
        public Object getValue(Element element, ElementValue[] value,
            Attributes attrs, Map hints)
            throws SAXException, SAXNotSupportedException {
            Element e = value[0].getElement();

            if ((e == null) || (value == null)) {
                throw new SAXException(
                    "Internal error, ElementValues require an associated Element.");
            }
View Full Code Here

        if (elements == null) {
            return null; // not found
        }

        Element element = null;

        String ttname = typeName.substring(typeName.indexOf(":") + 1);

        for (int i = 0; (i < elements.length) && (element == null); i++) {
            // HACK -- namspace related -- should be checking ns as opposed to
View Full Code Here

         *      org.xml.sax.Attributes)
         */
        public Object getValue(Element element, ElementValue[] value,
            Attributes attrs, Map hints)
            throws SAXException, SAXNotSupportedException {
            Element e = value[0].getElement();

            if (e == null) {
                throw new SAXException(
                    "Internal error, ElementValues require an associated Element.");
            }
View Full Code Here

         *      org.xml.sax.Attributes)
         */
        public Object getValue(Element element, ElementValue[] value,
            Attributes attrs, Map hints)
            throws SAXException, SAXNotSupportedException {
            Element e = value[0].getElement();

            if (e == null) {
                throw new SAXException(
                    "Internal error, ElementValues require an associated Element.");
            }
View Full Code Here

            for (int i = 0; i < value.length; i++) {
                if ((value[i] == null) || value[i].getElement() == null) {
                    continue;
                }
   
                Element e = value[i].getElement();
                if(elems[GEOMETRY].getName().equals(e.getName()))
                    symbol.setGeometryPropertyName((String)value[i].getValue());
   
                if(elems[OPACITY].getName().equals(e.getName()))
                    symbol.setOpacity((Expression)value[i].getValue());
   
                if(elems[CHANNELSELECTION].getName().equals(e.getName()))
                    symbol.setChannelSelection((ChannelSelection)value[i].getValue());
   
                if(elems[OVERLAPBEHAVIOR].getName().equals(e.getName()))
                    symbol.setOverlap((Expression)value[i].getValue());
   
                if(elems[COLORMAP].getName().equals(e.getName()))
                    symbol.setColorMap((ColorMap)value[i].getValue());
   
                if(elems[CONTRASTENHANCEMENT].getName().equals(e.getName()))
                    symbol.setContrastEnhancement((ContrastEnhancement)value[i].getValue());
   
                if(elems[SHADEDRELIEF].getName().equals(e.getName()))
                    symbol.setShadedRelief((ShadedRelief)value[i].getValue());
   
                if(elems[IMAGEOUTLINE].getName().equals(e.getName()))
                    symbol.setImageOutline((Symbolizer)value[i].getValue());
            }
           
            return symbol;
        }
View Full Code Here

TOP

Related Classes of org.geotools.xml.schema.Element

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.