Package org.apache.xerces.xs

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


   {
      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

        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

        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

                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

     */
    public static String fillInTemplate(String tmpl, String cppElementName, XSElementDeclaration element,
            XSAttributeUse attrUse, String dataMethodName, XSTypeDefinition type, String simpleTypeValiTmpl,
            IGenerationDataProvider dataProvider) {

        XSSimpleTypeDefinition simpleType = Util.findSimpleTypeDefinition(type);
        Variety variety = Util.findVariety(simpleType);
        XSSimpleTypeDefinition listType = null;
        if (variety == Variety.LIST) {
            listType = simpleType;
            simpleType = Util.findListItemType(simpleType);
        }
        String xsdType = Util.findXSDSimpleTypeString(simpleType, dataProvider.getConfig());
View Full Code Here

            if (tmpl.contains(Constants.TMPL_UNION_TO_UNION_PER_MEMBER)) {
                String allMembersCode = new String();
                List<XSSimpleTypeDefinition> memberTypes = Util.objectListToList(unionType.getMemberTypes());
                for (int i = 0; i < memberTypes.size(); i++) {
                    String perMemberTmpl = config.getTemplateUnionFuncToUnionPerMember();
                    XSSimpleTypeDefinition memberType = memberTypes.get(i);
                    perMemberTmpl = fillInUnionMemberTemplate(perMemberTmpl, unionType, memberType, i, dataProvider);
                    allMembersCode += perMemberTmpl;
                }
                tmpl = tmpl.replace(Constants.TMPL_UNION_TO_UNION_PER_MEMBER, allMembersCode);
            }
View Full Code Here

    /**
     * Creates parameter list of data convenience method.
     */
    protected String createDataConvenienceParameterList(XSTypeDefinition type) {
        XSSimpleTypeDefinition simpleType = Util.findSimpleTypeDefinition(type);
        Variety variety = Util.findVariety(simpleType);
        if (variety == Variety.LIST) {
            simpleType = Util.findListItemType(simpleType);
        }
        String xsdType = Util.findXSDSimpleTypeString(simpleType, config);
View Full Code Here

     * {@inheritDoc}
     *
     * @see de.netallied.xsd2cppsax.IGenerationDataProvider#findCorrectCppTypeForAttribute(com.sun.org.apache.xerces.internal.xs.XSTypeDefinition)
     */
    public String findCorrectCppTypeForAttribute(XSTypeDefinition type) {
        XSSimpleTypeDefinition simpleType = Util.findSimpleTypeDefinition(type);
        Variety variety = Util.findVariety(simpleType);
        if (variety == Variety.LIST) {
            simpleType = Util.findListItemType(simpleType);
        }
        String xsdType = Util.findXSDSimpleTypeString(simpleType, config);
View Full Code Here

                printBeginConvenienceMethod(cppName, element, hasAttributes);
                printEndConvenienceMethod(cppName, element);

                if (hasChardata) {
                    XSSimpleTypeDefinition simpleType = Util.findSimpleTypeDefinition(typeDefinition);
                    if (Util.hasStreamingFacets(simpleType)) {
                        printComplexValidationDataStruct(cppName, element);
                    }
                    if (xsSimpleType2validationFunctionName.get(simpleType) != null) {
                        printSimpleValidationFunctions(simpleType);
                    }
                    if (Util.findVariety(simpleType) == Variety.LIST) {
                        printSimpleValidationFunctions(simpleType.getItemType());
                    }
                    printDataConvenienceMethod(cppName, element);
                }

                // printPrivate();
View Full Code Here

TOP

Related Classes of org.apache.xerces.xs.XSSimpleTypeDefinition

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.