Package org.eclipse.xsd

Examples of org.eclipse.xsd.XSDElementDeclaration


    public void validateValues(String elementText, int totalDigits, double minExc, double minInc,
        double maxInc, double maxExc) throws Exception {
        XSDecimalBinding strat = new XSDecimalBinding();

        XSDElementDeclaration declaration = makeDeclaration(totalDigits, new BigDecimal(minExc),
                new BigDecimal(minInc), new BigDecimal(maxInc), new BigDecimal(maxExc));

        ElementInstance element = new ElementImpl(declaration);
        element.setText(elementText);
View Full Code Here


        String name = qName.getLocalPart();
        if (schemaRegistry.get(name) != null) {
            // we found a custom schema element
            // let's treat it as if we've found a placemark
            SchemaIndex schemaIndex = parser.getSchemaIndex();
            XSDElementDeclaration element = schemaIndex.getElementDeclaration(KML.Placemark);
            if (element != null) {
                return createElementHandler(element, parent, parser);
            }
        }
        return super.createElementHandler(qName, parent, parser);
View Full Code Here

     */
    public static SimpleFeatureType parse(final Configuration wfsConfiguration,
            final QName featureName, final URL schemaLocation, final CoordinateReferenceSystem crs,
            final Map<QName, Class<?>> mappedBindings)
            throws IOException {
        XSDElementDeclaration elementDecl = parseFeatureType(featureName, schemaLocation);

        Map bindings = wfsConfiguration.setupBindings();
        if(mappedBindings != null) {
            bindings.putAll(mappedBindings);
        }
View Full Code Here

            schemaIndex = Schemas.findSchemas(configuration);
        } catch (RuntimeException e) {
            throw new DataSourceException("Error parsing feature type for " + featureTypeName, e);
        }

        XSDElementDeclaration elementDeclaration;
        elementDeclaration = schemaIndex.getElementDeclaration(featureTypeName);
        schemaIndex.destroy();
        if (elementDeclaration == null) {
            throw new DataSourceException("No XSDElementDeclaration found for " + featureTypeName);
        }
View Full Code Here

            final QName featureName, final URL schemaLocation,
            final CoordinateReferenceSystem crs,
            final Map<String, String> mappedURIs,
            final Map<QName, Class<?>> mappedBindings,
            final boolean ignoreMissingElementDeclaration) throws IOException {
        XSDElementDeclaration elementDecl = parseFeatureType(featureName,
                schemaLocation, mappedURIs, ignoreMissingElementDeclaration);

        Map bindings = wfsConfiguration.setupBindings();
        if(mappedBindings != null) {
            bindings.putAll(mappedBindings);
View Full Code Here

            schemaIndex = Schemas.findSchemas(configuration);
        } catch (RuntimeException e) {
            throw new DataSourceException("Error parsing feature type for " + featureTypeName, e);
        }

        XSDElementDeclaration elementDeclaration;
        elementDeclaration = schemaIndex.getElementDeclaration(featureTypeName);
        schemaIndex.destroy();
        if (elementDeclaration == null && !ignoreMissingElementDeclaration) {
            throw new DataSourceException("No XSDElementDeclaration found for " + featureTypeName);
        }
View Full Code Here

        if (generateElements) {
            List elements = schema.getElementDeclarations();

            for (Iterator e = elements.iterator(); e.hasNext();) {
                XSDElementDeclaration element = (XSDElementDeclaration) e.next();
                generate(element, schema);

                if (target(element, schema)) {
                  components.add(element);
                }
View Full Code Here

    //get anonymous types
    List anonymous = new ArrayList();
   
    //add any anonymous types of global elements + attributes
    for ( Iterator e = schema.getElementDeclarations().iterator(); e.hasNext(); ) {
      XSDElementDeclaration element = (XSDElementDeclaration ) e.next();
      if ( element.getAnonymousTypeDefinition() != null ) {
        element.getAnonymousTypeDefinition().setName( "_" + element.getName() );
        anonymous.add( element.getAnonymousTypeDefinition() );
      }
    }
    for ( Iterator a = schema.getAttributeDeclarations().iterator(); a.hasNext(); ) {
      XSDAttributeDeclaration attribute = (XSDAttributeDeclaration) a.next();
      if ( attribute.getAnonymousTypeDefinition() != null ) {
        attribute.getAnonymousTypeDefinition().setName( "_" + attribute.getName() );
        anonymous.add( attribute.getAnonymousTypeDefinition() );
      }
    }
      //add any anonymous types foudn with type definitions
      for ( Iterator t = types.iterator(); t.hasNext(); ) {
        XSDTypeDefinition type = (XSDTypeDefinition) t.next();
        List particles = Schemas.getChildElementParticles( type, false );
        for ( Iterator p = particles.iterator(); p.hasNext(); ) {
          XSDParticle particle = (XSDParticle) p.next();
          XSDElementDeclaration element = (XSDElementDeclaration) particle.getContent();
         
          //ignore element references, caught in teh above loop
          if ( element.isElementDeclarationReference() )
            continue;
         
          if ( element.getAnonymousTypeDefinition() != null ) {
            element.getAnonymousTypeDefinition().setName( type.getName() + "_" + element.getName() );
            anonymous.add( element.getAnonymousTypeDefinition() );
          }
        }
      }
     
      types.addAll( anonymous );
View Full Code Here

    ArrayList properties = new ArrayList();
    if (followComplexTypes) {
      List children = Schemas.getChildElementParticles(xsdType, false);
      for (Iterator itr = children.iterator(); itr.hasNext();) {
          XSDParticle particle = (XSDParticle) itr.next();
        XSDElementDeclaration element = (XSDElementDeclaration) particle.getContent();
        if (element.isElementDeclarationReference()) {
            element = element.getResolvedElementDeclaration();
        }
       
        XSDTypeDefinition childType = element.getTypeDefinition();
        if (childType == null) {
            childType = findGlobalElementXSDType(element);
        }
       
        AttributeType gtType = null;
        if (childType != null ) {
                gtType = createType(childType, depth+1);
        }
        else {
            //set to xs:anyType
            gtType = xsAnyType();
        }
            assert gtType != null;
           
            int minOccurs = particle.getMinOccurs();
            int maxOccurs = particle.getMaxOccurs();
            if (maxOccurs == -1) {
                maxOccurs = Integer.MAX_VALUE;
            }
            boolean isNillable = element.isNillable();
           
            //TODO: default value
            AttributeDescriptor ad = factory.createAttributeDescriptor(
              gtType, name(element),minOccurs, maxOccurs, isNillable, null
            );
View Full Code Here

        throw new IllegalStateException("Could not find imported type: " + name);
    }
   
    protected final XSDTypeDefinition findGlobalElementXSDType(XSDElementDeclaration element) {
        for (Iterator i = schema.getElementDeclarations().iterator(); i.hasNext();) {
            XSDElementDeclaration e = (XSDElementDeclaration) i.next();
            if (element.getName().equals( e.getName() ) && (element.getTargetNamespace() == null ||
                element.getTargetNamespace().equals( e.getTargetNamespace() ) ) ) {
                return e.getType();
            }
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.xsd.XSDElementDeclaration

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.