Examples of XSSimpleType


Examples of org.apache.ws.jaxme.xs.XSSimpleType

        for (int i = 0;  i < globalJavaTypes.length;  i++) {
            if (globalJavaTypes[i].getXmlType().equals(currentType.getName())) {
            return globalJavaTypes[i];
            }
        }
        XSSimpleType simpleType = currentType.getSimpleType();
        if (simpleType.isRestriction()) {
          currentType = simpleType.getRestrictedType();
        } else {
          currentType = null;
        }
    }
    return null;
View Full Code Here

Examples of org.apache.ws.jaxme.xs.XSSimpleType

    }

    JAXBJavaType javaType = findJavaType(pSchema, pType);
    SimpleTypeSGChain result;
    if (javaType == null  ||  javaType.getName() == null) {
        XSSimpleType simpleType = pType.getSimpleType();
        JavaQName runtimeType;
        if (simpleType.isAtomic()) {
          result = newGlobalAtomicTypeSG(pFactory, pSchema, pType);
            if (result == null) {
                if (!simpleType.isRestriction()) {
                    throw new SAXParseException("Atomic type must be either a builtin or a restriction of another atomic type",
                                                pType.getLocator());
                }
                TypeSG type = pSchema.getType(simpleType.getRestrictedType().getName());
                runtimeType = type.getSimpleTypeSG().getRuntimeType();
                result = newAtomicTypeRestriction(pController, pFactory, pSchema, pType);
            } else {
                SimpleTypeSG simpleTypeSG = new SimpleTypeSGImpl(result);
                simpleTypeSG.init();
              runtimeType = simpleTypeSG.getRuntimeType();
            }
            if (javaType == null) {
                JAXBJavaType[] globalJavaTypes = pSchema.getJAXBJavaTypes();
                for (int i = 0;  i < globalJavaTypes.length;  i++) {
                  if (runtimeType.equals(globalJavaTypes[i].getName())) {
                        javaType = globalJavaTypes[i];
                        break;
                    }
                }
            }
        } else if (simpleType.isList()) {
          result = new ListTypeSGImpl(pFactory, pSchema, pType, classContext, pController.getName());
        } else if (simpleType.isUnion()) {
            result = new UnionTypeSGImpl(pFactory, pSchema, pType, classContext, pController.getName());
        } else {
            throw new IllegalStateException("Simple type " + pType + " is neither of atomic, list, or union");
        }
    } else {
View Full Code Here

Examples of org.apache.ws.jaxme.xs.XSSimpleType

    }
    XSObjectFactory factory = pParent.getXSSchema().getXSObjectFactory();
    if (myComplexType.isExtension()) {
      XSType extendedType = myComplexType.getSimpleContent().getType();
      extendedType.validate();
      XSSimpleType extendedSimpleType = extendedType.getSimpleType();
 
      XSSimpleType mySimpleType;
      if (extendedSimpleType.isAtomic()) {
        mySimpleType = factory.newXSAtomicType(this, extendedType, pRestriction);
      } else if (extendedSimpleType.isList()) {
        mySimpleType = factory.newXSListType(this, extendedType, pRestriction);
      } else if (extendedSimpleType.isUnion()) {
        mySimpleType = factory.newXSUnionType(this, extendedType, pRestriction);
      } else {
        throw new LocSAXException("Unknown restriction type: " + extendedType,
                              pRestriction.getLocator());
      }

      simpleType = mySimpleType;
      //was: setSimpleType( extendedType.getSimpleType() );
    } else {
      XsTLocalSimpleType localSimpleType = pRestriction.getSimpleType();
      XSType restrictedType;
      if (localSimpleType != null) {
        restrictedType = factory.newXSType(this, localSimpleType);
      } else {
        restrictedType = myComplexType.getSimpleContent().getType();
      }
      restrictedType.validate();
      XSSimpleType restrictedSimpleType = restrictedType.getSimpleType();
      if (restrictedSimpleType.isAtomic()) {
        simpleType = factory.newXSAtomicType(this, restrictedType, pRestriction);
      } else if (restrictedSimpleType.isList()) {
        simpleType = factory.newXSListType(this, restrictedType, pRestriction);
      } else if (restrictedSimpleType.isUnion()) {
        simpleType = factory.newXSUnionType(this, restrictedType, pRestriction);
      }
    }
    this.name = null;
    isSimple = true;
View Full Code Here

Examples of org.apache.ws.jaxme.xs.XSSimpleType

      result.validate();
      annotations = new XSAnnotation[]{result};
    }

    if (isSimple()) {
      XSSimpleType mySimpleType;
      Object baseObject = getXsObject();
      if (baseObject instanceof XsTSimpleType) {
        XsTSimpleType myXsTSimpleType = (XsTSimpleType) baseObject;
        XsEList list = myXsTSimpleType.getList();
        if (list == null) {
          XsEUnion union = myXsTSimpleType.getUnion();
          if (union == null) {
            XsERestriction restriction = myXsTSimpleType.getRestriction();
            if (restriction == null) {
              throw new LocSAXException("Either of the 'list', 'union', or 'restriction' child elements must be set.",
                  myXsTSimpleType.getLocator());
            }
            XsQName myName = restriction.getBase();
            XSType restrictedType;         
            if (myName == null) {
              XsTLocalSimpleType baseType = restriction.getSimpleType();
              if (baseType == null) {
                throw new LocSAXException("Neither the 'base' attribute nor an inner 'simpleType' element are present",
                    restriction.getLocator());
              } else {
                restrictedType = getXSSchema().getXSObjectFactory().newXSType(this, baseType);
              }
            } else {
              restrictedType = getXSSchema().getType(myName);
              if (restrictedType == null) {
                throw new LocSAXException("Unknown base type: " + myName,
                    restriction.getLocator());
              }
            }
            restrictedType.validate();
            if (!restrictedType.isSimple()) {
              throw new LocSAXException("The restricted type " + myName + " is complex.",
                  restriction.getLocator());
            }
            XSSimpleType baseType = restrictedType.getSimpleType();
            if (baseType.isAtomic()) {
              mySimpleType = getXSSchema().getXSObjectFactory().newXSAtomicType(this, restrictedType, restriction);
            } else if (baseType.isList()) {
              mySimpleType = getXSSchema().getXSObjectFactory().newXSListType(this, restrictedType, restriction);
            } else if (baseType.isUnion()) {
              mySimpleType = getXSSchema().getXSObjectFactory().newXSUnionType(this, restrictedType, restriction);
            } else {
              throw new LocSAXException("Unknown restriction type: " + baseType, restriction.getLocator());
            }
          } else {
View Full Code Here

Examples of org.apache.ws.jaxme.xs.XSSimpleType

    }
  }

  public XSSimpleType getSimpleType() throws SAXException {
    validate();
    XSSimpleType result = simpleType;
    if (result == null) {
      throw new IllegalStateException("This is a complex type.");
    }
    return result;
  }
View Full Code Here

Examples of org.apache.xerces.impl.dv.XSSimpleType

    //The normalized value of a string value
    String normalizedValue = validatedInfo.normalizedValue ;

    //If the type is a union type, then the member type which
    //actually validated the string value.
    XSSimpleType memberType = validatedInfo.memberType ;

    return validatedInfo;

}//validateString()
View Full Code Here

Examples of org.apache.xerces.impl.dv.XSSimpleType

    System.err.println("'base type definition' target namespace : " + ( baseType != null ? baseType.getTypeName() : "null" )   );

    //check if base type is simple or complex
    if(baseType != null && (baseType.getXSType() == XSTypeDecl.SIMPLE_TYPE) ){
        //now we can get all the details of base type
        XSSimpleType simpleTypeDecl = (XSSimpleType)baseType;
    }

    // 'facets' property
    // gives bit combination of the constants defined in XSSimpleType interface.
    short facets = simpleType.getDefinedFacets() ;
    printFacets(facets);

    //'final' property
    //the explicit values of this property extension, restriction, list and union prevent further
    //derivations by extension (to yield a complex type) and restriction (to yield a simple type)
    //and use in constructing lists and unions respectively.
    short finalSet = simpleType.getFinalSet() ;
    printFinal(finalSet);

    //if variety is 'list'
    if( variety == XSSimpleType.VARIETY_LIST ){
        // 'Item Type definition' property of List Simple Type Definition Schema Component.
        XSSimpleType listDecl = ((XSListSimpleType)simpleType).getItemType() ;
    }else if(variety == XSSimpleType.VARIETY_UNION ){
        // 'Member Type definitions' property of Union Simple Type Definition Schema Component.
        XSSimpleType [] memberTypes = ((XSUnionSimpleType)simpleType).getMemberTypes() ;
    }
   
View Full Code Here

Examples of org.apache.xerces.impl.dv.XSSimpleType

public static void main(String [] args){

    SimpleTypeUsage usage = new SimpleTypeUsage();

    if(args.length == 1 ){        
        XSSimpleType builtInType = factory.getBuiltInType(args[0]);
        if(builtInType == null){
            System.err.println("Invalid built-in Simple datatype given as argument.");
            printUsage();
        }
        else {
View Full Code Here

Examples of org.apache.xerces.impl.dv.XSSimpleType

        } else if (fVariety == VARIETY_LIST) {

            Object[] values = (Object[])ob;
            if (fItemType.fVariety == VARIETY_UNION) {
                XSSimpleTypeDecl[] memberTypes = (XSSimpleTypeDecl[])validatedInfo.memberTypes;
                XSSimpleType memberType = validatedInfo.memberType;
                for (int i = values.length-1; i >= 0; i--) {
                    validatedInfo.actualValue = values[i];
                    validatedInfo.memberType = memberTypes[i];
                    fItemType.checkExtraRules(context, validatedInfo);
                }
View Full Code Here

Examples of org.apache.xerces.impl.dv.XSSimpleType

            }
        }
        // normalization: simple type
        else if (fNormalizeData) {
            // if !union type
             XSSimpleType dv = (XSSimpleType)fCurrentType;
             if (dv.getVariety() == XSSimpleType.VARIETY_UNION) {
                 fUnionType = true;
             } else {
                 try {
                    fWhiteSpace = dv.getWhitespace();
                 } catch (DatatypeException e){
                     // do nothing
                 }
             }
        }
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.