Examples of AttributeGroupDecl


Examples of org.exolab.castor.xml.schema.AttributeGroupDecl

          if (_redefineSchema.getSchemaLocation() == "") {
            String err = "In a <redefine>, only annotations can be defined when no -schemaLocation- is specified.";
            error(err);
          }
         
          AttributeGroupDecl group = null;
          group = (AttributeGroupDecl)(((AttributeGroupUnmarshaller)_unmarshaller).getAttributeGroup());
         
          String structureName = group.getName();
          if (structureName == null) {
            String err = "When redefining an AttributeGroup, the group must have a name.\n";
            error(err);
          }
         
          //1-- the attributeGroup must exist in the imported schema
          AttributeGroup original = _importedSchema.getAttributeGroup(structureName);
          if (original == null) {
            String err = "When redefining an AttributeGroup, the AttributeGroup must be present in the imported XML schema.\n"
              +"AttributeGroup: "+structureName+" is not defined in XML Schema:" + _importedSchema.getSchemaLocation();
            error(err);
          }
         
          //-- todo: add code to check the Derivation Valid (Restriction, Complex) constraint.
          group.setRedefined();
        _redefineSchema.addAttributeGroup(group);
       
      }
      //-- <complexType>
      else if (name.equals(SchemaNames.COMPLEX_TYPE)) {
        if (_redefineSchema.getSchemaLocation() == "") {
          String err = "In a <redefine>, only annotations can be defined when no -schemaLocation- is specified.";
          error(err);
        }
        ComplexType complexType = null;
        complexType = ((ComplexTypeUnmarshaller)_unmarshaller).getComplexType();
        //-- Checks that the complexType exists in the imported schema
        String structureName = complexType.getName();
        if (structureName == null) {
          String err = "When redefining a complexType, the complexType must have a name.\n";
          error(err);
        }
       
        //1-- the complexType must exist in the imported schema
        ComplexType original = _importedSchema.getComplexType(structureName);
        if (original == null) {
            String err = "When redefining a complexType, the complexType must be present in the imported XML schema.\n"
                       +"ComplexType: "+structureName+" is not defined in XML Schema:" + _importedSchema.getSchemaLocation();
            error(err);
        }
       
        //2-- the base type must be itself
        XMLType baseType = complexType.getBaseType();
        //--just check the names since a top level complexType can only be defined once.
        if (baseType == null || !baseType.getName().equals(structureName)) {
          String err = "When redefining a complexType, the complexType must use itself as the base type definition.\n"
            +"ComplexType: "+structureName+" uses:" + baseType+ " as its base type.";
          error(err);
        }
       
        complexType.setRedefined();
        _redefineSchema.addComplexType(complexType);
            getResolver().addResolvable(complexType.getReferenceId(), complexType);
      }
      //-- <simpleType>
      else if (name.equals(SchemaNames.SIMPLE_TYPE)) {
        if (_redefineSchema.getSchemaLocation() == "") {
          String err = "In a <redefine>, only annotations can be defined when no -schemaLocation- is specified.";
          error(err);
        }
       
        SimpleType simpleType = null;
        simpleType = ((SimpleTypeUnmarshaller)_unmarshaller).getSimpleType();
            //-- Checks that the simpleType exists in the imported schema
        String structureName = simpleType.getName();
        if (structureName == null) {
          String err = "When redefining a simpleType, the simpleType must have a name.\n";
          error(err);
        }
       
        //1-- the simpleType must exist in the imported schema
        SimpleType original = _importedSchema.getSimpleType(structureName,_schema.getTargetNamespace() );
        if (original == null) {
          String err = "When redefining a simpleType, the simpleType must be present in the imported XML schema.\n"
            +"SimpleType: "+structureName+" is not defined in XML Schema:" + _importedSchema.getSchemaLocation();
          error(err);
        }
       
        //2-- the base type must be itself
        XMLType baseType = simpleType.getBaseType();
        //--just check the names since a top level complexType can only be defined once.
        if (!baseType.getName().equals(structureName)) {
          String err = "When redefining a simpleType, the simpleType must use itself as the base type definition.\n"
            +"SimpleType: "+structureName+" uses:" + baseType.getName() + " as its base type.";
          error(err);
       
       
        simpleType.setRedefined();
        _redefineSchema.addSimpleType(simpleType);
        getResolver().addResolvable(simpleType.getReferenceId(), simpleType);
      }
      //--<group>
      else if (name.equals(SchemaNames.GROUP)) {
        if (_redefineSchema.getSchemaLocation() == "") {
          String err = "In a <redefine>, only annotations can be defined when no -schemaLocation- is specified.";
          error(err);
        }
       
        ModelGroup group = null;
        group = (((ModelGroupUnmarshaller)_unmarshaller).getGroup());
       
        String structureName = group.getName();
        if (structureName == null) {
          String err = "When redefining a group, the group must have a name.\n";
          error(err);
        }
       
        //1-- the group must exist in the imported schema
        Group original = _importedSchema.getModelGroup(structureName);
        if (original == null) {
          String err = "When redefining a group, the group must be present in the imported XML schema.\n"
            +"Group: "+structureName+" is not defined in XML Schema:" + _importedSchema.getSchemaLocation();
          error(err);
        }
       
        //-- code needs to be added to check the Particle Valid (Restriction) constraint
        //--TBD
       
        group.setRedefined();
        _redefineSchema.addGroup(group);
      } else {
        String err = "In a <redefine>, only complexTypes|simpleTypes|groups or attributeGroups can be redefined.";
      error(err)
      }
View Full Code Here

Examples of org.exolab.castor.xml.schema.AttributeGroupDecl

        //-- process annotations
        processAnnotated(attGroup, schemaPrefix);

        if (!isReference) {
            AttributeGroupDecl group = (AttributeGroupDecl)attGroup;
            Enumeration enumeration = group.getLocalAttributes();
            while (enumeration.hasMoreElements()) {
                processAttribute((AttributeDecl)enumeration.nextElement(),
                    schemaPrefix);
            }
            enumeration = group.getLocalAttributeGroupReferences();
            while (enumeration.hasMoreElements()) {
                processAttributeGroup((AttributeGroup)enumeration.nextElement(),
                    schemaPrefix);
            }
           
            if (group.getAnyAttribute() != null) {
                processWildcard(group.getAnyAttribute(), schemaPrefix);
            }
        }

        _handler.endElement(ELEM_ATTRIBUTE_GROUP);
View Full Code Here

Examples of org.exolab.castor.xml.schema.AttributeGroupDecl

            processGroup(group, schemaPrefix);
          }
        //--process AttributeGroups
          enumeration = schema.enumerateAttributeGroups();
          while (enumeration.hasMoreElements()) {
            AttributeGroupDecl attGroup = (AttributeGroupDecl)enumeration.nextElement();
            processAttributeGroup(attGroup, schemaPrefix);
          }
      }
      _handler.endElement(ELEMENT_NAME);
    } //-- processImport
View Full Code Here

Examples of org.exolab.castor.xml.schema.AttributeGroupDecl

                    "valid value.";
                throw new SchemaException(err);
            }
        }
        else {
            AttributeGroupDecl attDecl = new AttributeGroupDecl(schema);
            _attributeGroup = attDecl;

            //-- handle attributes
            attDecl.setName(atts.getValue(SchemaNames.NAME_ATTR));
            attDecl.setId(atts.getValue(SchemaNames.ID_ATTR));
        }



    } //-- AttributeGroupUnmarshaller
View Full Code Here

Examples of org.exolab.castor.xml.schema.AttributeGroupDecl

                    "valid value.";
                throw new SchemaException(err);
            }
        }
        else {
            AttributeGroupDecl attDecl = new AttributeGroupDecl(schema);
            _attributeGroup = attDecl;

            //-- handle attributes
            attDecl.setName(atts.getValue(SchemaNames.NAME_ATTR));
            attDecl.setId(atts.getValue(SchemaNames.ID_ATTR));
        }



    } //-- AttributeGroupUnmarshaller
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.