Examples of XSSimpleTypeDefinition


Examples of org.apache.xerces.xs.XSSimpleTypeDefinition

            }
        }
        if (type != base) {
            // If the base is a union, check if "derived" is allowed through any of the member types.
            if (base.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
                XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) base;
                if (st.getVariety() ==  XSSimpleTypeDefinition.VARIETY_UNION) {
                    XSObjectList memberTypes = st.getMemberTypes();
                    final int length = memberTypes.getLength();
                    for (int i = 0; i < length; ++i) {
                        if (typeDerivationOK(derived, (XSTypeDefinition) memberTypes.item(i), blockingConstraint)) {
                            return true;
                        }
View Full Code Here

Examples of org.apache.xerces.xs.XSSimpleTypeDefinition

   private static void bindAttributes(SchemaBinding doc,
                                      TypeBinding type,
                                      XSAttributeUse attrUse)
   {
      XSAttributeDeclaration attr = attrUse.getAttrDeclaration();
      XSSimpleTypeDefinition attrType = attr.getTypeDefinition();
      TypeBinding typeBinding = bindSimpleType(doc, attrType);
      QName attrName = new QName(attr.getNamespace(), attr.getName());
      AttributeBinding binding = type.addAttribute(attrName, typeBinding, RtAttributeHandler.INSTANCE);
      if( attrUse.getConstraintType() == XSConstants.VC_DEFAULT )
      {
         // Associate the default value with the binding
         binding.setDefaultConstraint(attrUse.getConstraintValue());
      }

      XSAnnotation an = attr.getAnnotation();
      if(an != null)
      {
         XsdAnnotation xsdAn = XsdAnnotation.unmarshal(an.getAnnotationString());
         XsdAppInfo appInfo = xsdAn.getAppInfo();
         if(appInfo != null)
         {
            PropertyMetaData propertyMetaData = appInfo.getPropertyMetaData();
            if(propertyMetaData != null)
            {
               binding.setPropertyMetaData(propertyMetaData);
            }

            boolean mapEntryKey = appInfo.isMapEntryKey();
            if(mapEntryKey)
            {
               binding.setMapEntryKey(mapEntryKey);
            }

            boolean mapEntryValue = appInfo.isMapEntryValue();
            if(mapEntryValue)
            {
               binding.setMapEntryValue(mapEntryValue);
            }
         }
      }

      if(log.isTraceEnabled())
      {
         String msg = "attribute " +
            new QName(attr.getNamespace(), attr.getName()) +
            ": ";

         if(binding.getPropertyMetaData() != null)
         {
            msg += " property=" +
               binding.getPropertyMetaData().getName() +
               ", collectionType=" + binding.getPropertyMetaData().getCollectionType();
         }
         else if(binding.isMapEntryKey())
         {
            msg += "bound as a key in a map entry";
         }
         else if(binding.isMapEntryValue())
         {
            msg += "bound as a value in a map entry";
         }
         else
         {
            msg += " type=" + attrType.getName() + ", owner type=" + type.getQName();
         }

         if(binding.getDefaultConstraint() != null)
         {
            msg += ", default=" + binding.getDefaultConstraint();
View Full Code Here

Examples of org.apache.xerces.xs.XSSimpleTypeDefinition

        }

        // If the content model of this complex type is simple, then we create a
        // PropDef corresponding to the XML text node defined by this content model.
        if (ctdef.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_SIMPLE) {
            XSSimpleTypeDefinition stdef = ctdef.getSimpleType();
            //set to non-mandatory, single-value property called "jcr:xmlcharacters"
            PropDef propDef = simpleTypeToPropDef(stdef, XML_CONTENT_PROPERTY_NAME, false, false);
            propDefList.add(propDef);

            // If the content model of this complex type is element or mixed then we must convert the
View Full Code Here

Examples of org.apache.xerces.xs.XSSimpleTypeDefinition

            XSTypeDefinition tDef = eDec.getTypeDefinition();

            // If this element declaration is of simple type
            // then it is converted into a property def
            if (tDef.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
                XSSimpleTypeDefinition stDef = (XSSimpleTypeDefinition) tDef;
                PropDef propDef = simpleTypeToPropDef(stDef, name, mandatory, multiple);
                propDefList.add(propDef);

                // If this element declaration is of complex type then
                // it is converted into either node or property def
            } else if (tDef.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
                XSComplexTypeDefinition ctDef = (XSComplexTypeDefinition) tDef;

                // If the complex type definition contains a simple content model
                // and does not contain any attribute uses or attribute wildcards
                // then the enclosing element is converted to a property def
                if (ctDef.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_SIMPLE &&
                        ctDef.getAttributeUses().getLength() == 0 && ctDef.getAttributeWildcard() == null) {
                    XSSimpleTypeDefinition std = ctDef.getSimpleType();
                    PropDef pd = simpleTypeToPropDef(std, name, mandatory, multiple);
                    propDefList.add(pd);

                    // If the complex type definition contains a complex content model
                    // or a simple content model with attribute uses or an attribute wildcard
View Full Code Here

Examples of org.apache.xerces.xs.XSSimpleTypeDefinition

        // Since this is an attribute declaration we assume it converts to
        // a single value property (we ignore the XML Schema List Type)
        boolean multiple = false;

        // Get the simple type def for this attribute
        XSSimpleTypeDefinition std = ad.getTypeDefinition();

        // convert it to a propdef
        return simpleTypeToPropDef(std, name, mandatory, multiple);
    }
View Full Code Here

Examples of org.apache.xerces.xs.XSSimpleTypeDefinition

            {
               addVariableMappingMap(xm, jxtm, javaType);
            }

            // Add simple content if it exists
            XSSimpleTypeDefinition simple = xc.getSimpleType();
            if (simple != null)
            {
               addJavaXMLTypeMap(simple, xc.getName(), "", "", jwm, skipWrapperArray);
            }
View Full Code Here

Examples of org.apache.xerces.xs.XSSimpleTypeDefinition

   {
      for (int i = 0; i < attributes.getLength(); i++)
      {
         XSAttributeUse obj = (XSAttributeUse)attributes.item(i);
         XSAttributeDeclaration att = obj.getAttrDeclaration();
         XSSimpleTypeDefinition simple = att.getTypeDefinition();
         addJavaXMLTypeMap(simple, "none", "", "", jxtm.getJavaWsdlMapping(), true);
         VariableMapping vm = new VariableMapping(jxtm);
         String name = att.getName();
         vm.setXmlAttributeName(name);
         // JBWS-1170 Convert characters which are illegal in Java identifiers
View Full Code Here

Examples of org.apache.xerces.xs.XSSimpleTypeDefinition

        Config config = dataProvider.getConfig();

        List<XSAttributeUse> attributes = Util.collectAttributeUses(element);
        for (XSAttributeUse attrUse : attributes) {
            if (attrUse.getRequired()) {
                XSSimpleTypeDefinition attrType = Util.getType(attrUse);
                String codeTmpl = config.getTemplateAttributeCheckRequiredPresent();
                if (codeTmpl.contains(Constants.TMPL_ATTR_NOT_PRESENT_CHECK)) {
                    if (Util.findVariety(attrType) == Variety.ATOMIC) {
                        if (Util.hasFacetEnum(attrType)) {
                            codeTmpl = codeTmpl.replace(Constants.TMPL_ATTR_NOT_PRESENT_CHECK, config
View Full Code Here

Examples of org.apache.xerces.xs.XSSimpleTypeDefinition

        XSComplexTypeDefinition complexTypeDefi = Util.getComplexType(element.getTypeDefinition());
        if (complexTypeDefi != null) {
            List<XSAttributeUse> attributeUses = Util.objectListToList(complexTypeDefi.getAttributeUses());
            for (XSAttributeUse attrUse : attributeUses) {
                if (Util.isAttributeInitializationRequired(attrUse, dataProvider.getConfig())) {
                    XSSimpleTypeDefinition attrType = Util.getType(attrUse);
                    String codeTmpl = dataProvider.getConfig().getTemplateAttributeInitObject();

                    if (codeTmpl.contains(Constants.TMPL_ATTR_INIT_OBJECT)) {
                        boolean hasDefaultVal = Util.hasDefaultValue(attrUse);
                        String constraintValue = attrUse.getConstraintValue();
                        String attrValue = null;

                        if (codeTmpl.contains(Constants.TMPL_ATTR_INIT_OBJECT_SET_PRESENT)) {
                            String setPresent = null;
                            if (hasDefaultVal) {
                                setPresent = Constants.TMPL_INDENT + Constants.TMPL_ATTR_PRESENT_SET;
                            } else {
                                setPresent = "";
                            }
                            codeTmpl = codeTmpl.replace(Constants.TMPL_ATTR_INIT_OBJECT_SET_PRESENT, setPresent);
                        }

                        switch (Util.findVariety(attrType)) {
                        case UNION:
                            if (hasDefaultVal) {
                                String unionDefault = config.getTemplateAttributeInitObjectUnionDefault();
                                if (unionDefault.contains(Constants.TMPL_ATTR_INIT_OBJECT_DEFAULT_VAL)) {
                                    unionDefault = unionDefault.replace(Constants.TMPL_ATTR_INIT_OBJECT_DEFAULT_VAL,
                                            "\"" + constraintValue + "\"");
                                }
                                if (unionDefault.contains(Constants.TMPL_ATTR_INIT_OBJECT_DEFAULT_VAL_LENGTH)) {
                                    unionDefault = unionDefault.replace(
                                            Constants.TMPL_ATTR_INIT_OBJECT_DEFAULT_VAL_LENGTH, String
                                                    .valueOf(constraintValue.length()));
                                }
                                unionDefault = fillInUnionTemplate(unionDefault, attrType, dataProvider);
                                attrValue = config.getTemplateAttributeInitObjectUnionPreDefault();
                                attrValue += config.getTemplateAttributeInitObjectNoDefaultLHS() + unionDefault;
                            } else {
                                CppEnumNameCreator cppEnumOrUnionNameCreator = dataProvider.getEnumOrUnionNameCreator();
                                String unionType = cppEnumOrUnionNameCreator.createUnionTypeName(attrType, dataProvider
                                        .getElementStack());
                                attrValue = config.getTemplateAttributeInitObjectNoDefaultLHS() + unionType + "();";
                            }
                            break;
                        case LIST:
                            if (hasDefaultVal) {
                                XSSimpleTypeDefinition itemType = attrType.getItemType();
                                String xsdType = Util.findXSDSimpleTypeString(itemType, config);
                                String listType;
                                if (Util.findVariety(itemType) == Variety.UNION) {
                                    listType = dataProvider.getConfig()
                                            .getTemplateUnionAttributeListTypeConversionNoItemValidation();
View Full Code Here

Examples of org.apache.xerces.xs.XSSimpleTypeDefinition

                streamEndFuncName = "0";
            }
            tmpl = tmpl.replace(Constants.TMPL_SIMPLE_VALI_FUNCTION_NAME_STREAM_END, streamEndFuncName);
        }
        if (tmpl.contains(Constants.TMPL_SIMPLE_VALI_ITEM_TYPE_FUNCTION_NAME)) {
            XSSimpleTypeDefinition itemType = simpleType.getItemType();
            String funcName = xsSimpleType2validationFunctionName.get(itemType);
            if (funcName == null) {
                funcName = "0";
            } else {
                funcName = "&" + funcName;
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.