Package org.geotools.xml.schema

Examples of org.geotools.xml.schema.ComplexType


        if (s.getImports() != null) {
            Schema[] ss = s.getImports();

            for( int i = 0; (ss != null) && (i < ss.length); i++ ) {
                if (!targets.contains(ss[i].getTargetNamespace())) {
                    ComplexType st = lookUpComplexType(localName, ss[i], targets);

                    if (st != null) {
                        return st;
                    }
                }
View Full Code Here


                while( it.hasNext() ) {
                    Schema s = (Schema) it.next();
                    String ns = s.getTargetNamespace().toString();
                    String prefixLookup = prefixCache != null ? (String) prefixCache.get(ns) : null;
                    if (prefix1 == null || prefixLookup == null || prefix1.equals(prefixLookup)) {
                        ComplexType ct = lookUpComplexType(localName, s, new TreeSet());
                        if (ct != null) {
                            return ct;
                        }
                    }
                }
            }
        }

        if (complexTypes != null) {
            it = complexTypes.iterator();

            while( it.hasNext() ) {
                Object o = it.next();

                if (o instanceof ComplexTypeHandler) {
                    ComplexTypeHandler sst = (ComplexTypeHandler) o;

                    if (localName.equalsIgnoreCase(sst.getName())) {
                        return sst.compress(this);
                    }
                } else {
                    ComplexType sst = (ComplexType) o;

                    if (localName.equalsIgnoreCase(sst.getName())) {
                        return sst;
                    }
                }
            }
        }
View Full Code Here

*/
public class XMLTypeHelper {

  public static Element findChildElement(Type type, String localName, URI namespaceURI) {
    if( type instanceof ComplexType ){
      ComplexType complexType=(ComplexType) type;
      ElementGrouping child = complexType.getChild();
      if( child!=null){
        Element found=child.findChildElement(localName, namespaceURI);
        if( found!=null )
          return found;
      }
      Element[] children = complexType.getChildElements();
      if( children==null || children.length==0)
        return null;
      for (int i = 0; i < children.length; i++) {
        Element element = children[i];
        if( localName.equals(element.getName()) && namespaceURI.equals(element.getNamespace()) )
          return element;
      }
      if( complexType.getParent()!=null ){
        Type parent = complexType.getParent();
        return findChildElement((ComplexType) parent, localName, namespaceURI);
      }
    }else{
      return type.findChildElement(localName);
    }
View Full Code Here

                ComplexContentHandler cch = (ComplexContentHandler) child;

                if (cch.getChild() instanceof ExtensionHandler) {
                    ExtensionHandler ext = (ExtensionHandler) cch.getChild();

                    ComplexType ct = parent.lookUpComplexType(ext.getBase());
                    dct.parent = ct;

                    // attributes
                    if (ct!=null && ct.getAttributes() != null) {
                        Attribute[] it = ct.getAttributes();

                        for (int i = 0; i < it.length; i++) {
                            attr.add(it[i]);
                        }
                    }

                    if (ext.getAttributeDeclarations() != null) {
                        Iterator it = ext.getAttributeDeclarations().iterator();

                        while (it.hasNext()) {
                            Object o = it.next();

                            if (o instanceof AttributeHandler) {
                                AttributeHandler ah = (AttributeHandler) o;
                                attr.add(ah.compress(parent));
                            } else {
                                AttributeGroupHandler agh = (AttributeGroupHandler) o;
                                AttributeGroup ag = agh.compress(parent);
                                attr.addAll(Arrays.asList(ag.getAttributes()));
                            }
                        }
                    }

                    if (ct!=null && ext.getChild() != null) {
                        logger.finest("Looked up " + ext.getBase()
                            + " and found "
                            + ((ct == null) ? null
                                            : (ct.getName() + ":::"
                            + ct.getNamespace())) + " for " + name);

                        ElementGrouping extensionBaseType = ct.getChild();
            ElementGrouping extensionChild =  ((ElementGroupingHandler)ext.getChild()).compress(parent);
                        dct.child = loadNewEG(extensionBaseType,extensionChild, parent); // note should override element def only ... not spot
                    } else {
                      if (ct != null)
                        dct.child = ct.getChild();
                    }
                } else {
                    //restriction
                    RestrictionHandler ext = (RestrictionHandler) cch.getChild();
View Full Code Here

        /**
         * @see org.geotools.xml.schema.Type#canEncode(org.geotools.xml.schema.Element,
         *      java.lang.Object, java.util.Map)
         */
        public boolean canEncode(Element element, Object value, Map hints) {
            ComplexType t = (element.getType() instanceof ComplexType)
                ? (ComplexType) element.getType() : null;

            while ((t != null) && (t != this))
                t = (t.getParent() instanceof ComplexType)
                    ? (ComplexType) t.getParent() : null;

            return ((t != null) && (value instanceof Geometry));
        }
View Full Code Here

TOP

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

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.