Ejemplo n.º 1
0
    private void createClasses(Schema schema, SGStateInfo sInfo) {

        Enumeration structures = schema.getElementDecls();

        //-- handle all top-level element declarations
        while (structures.hasMoreElements())
            createClasses((ElementDecl)structures.nextElement(), sInfo);

        //-- handle all top-level complextypes
        structures = schema.getComplexTypes();
        while (structures.hasMoreElements())
            processComplexType((ComplexType)structures.nextElement(), sInfo);

        //-- handle all top-level simpletypes
        structures = schema.getSimpleTypes();
        while (structures.hasMoreElements())
            processSimpleType((SimpleType)structures.nextElement(), sInfo);

        //-- handle all top-level groups
        structures = schema.getModelGroups();
        while (structures.hasMoreElements())
            createClasses((ModelGroup)structures.nextElement(), sInfo);


    } //-- createClasses
Ejemplo n.º 2
0
    /**
     * Processes the attribute declarations for the given complex type
     * @param complexType the ComplexType containing the attribute
     * declarations to process.
     * @param sInfo the current source generator state information
    **/
    private void processAttributes(ComplexType complexType, SGStateInfo sInfo) {

        if (complexType == null) return;

        Enumeration enum = complexType.getAttributeDecls();
        while (enum.hasMoreElements()) {
            AttributeDecl attribute = (AttributeDecl)enum.nextElement();
            processSimpleType(attribute.getSimpleType(), sInfo);
        }

    } //-- processAttributes
Ejemplo n.º 3
0
    private void createClasses(ElementDecl elementDecl, SGStateInfo sInfo) {

		//-- when mapping schema types, only interested in producing classes
		//-- for elements with anonymous complex types
		if (SourceGenerator.mappingSchemaType2Java())
			if (elementDecl.isReference() ||
				(elementDecl.getType()!=null &&
				 elementDecl.getType().getName()!=null))
				return;

		if (sInfo.verbose()) {
		    System.out.print("Creating classes for element: ");
		    System.out.println(elementDecl.getName());
		}
        //-- create classes for sub-elements if necessary
        XMLType xmlType = elementDecl.getType();

        //-- No type definition
        if (xmlType == null) {
            System.out.print("Type not found for element: ");
            System.out.println(elementDecl.getName());
            return;
        }
        //-- ComplexType
        else if (xmlType.isComplexType()) {

			JClass[] classes = sourceFactory.createSourceCode(elementDecl,
                                                        sInfo);

            processComplexType((ComplexType)xmlType, sInfo);

            for (int i = 0; i < classes.length; i++)
                 processJClass(classes[i], sInfo);

        }
        //-- SimpleType
        else {
            processSimpleType((SimpleType)xmlType, sInfo);
        }

    }  //-- createClasses