Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSObject


            {
               XSNamedMap components = model.getComponents(XSConstants.ELEMENT_DECLARATION);
               String roots = "";
               for(int j = 0; j < components.getLength(); ++j)
               {
                  XSObject xsObject = components.item(j);
                  if(j > 0)
                  {
                     roots += ", ";
                  }
                  roots += "{" + xsObject.getNamespace() + "}" + xsObject.getName();
               }
               throw new IllegalStateException("Root element not found: " + qName + " among " + roots);
            }

            marshalElement(element.getNamespace(),
View Full Code Here


    private boolean canAddComponents(Vector components) {
        final int size = components.size();
        final XSDDescription desc = new XSDDescription();
        for (int i=0; i<size; i++) {
            XSObject component = (XSObject) components.elementAt(i);
            if (!canAddComponent(component, desc)) {
                return false;
            }
        }
        return true;
View Full Code Here

                newComponents.add(components[i]);
            }
        }
       
        for (int i=0; i<newComponents.size(); i++) {
            final XSObject component = (XSObject) newComponents.elementAt(i);
            expandRelatedComponents(component, newComponents, dependencies);
        }
       
        return newComponents;
    }
View Full Code Here

                if (fMaps != null) {
                    return (XSObject)fMaps[i].get(localName);
                }
                // Otherwise (it's created from an array)
                // go through the array to find a matching name
                XSObject ret;
                for (int j = 0; j < fLength; j++) {
                    ret = fArray[j];
                    if (ret.getName().equals(localName)) {
                        return ret;
                    }
                }
                return null;
            }
View Full Code Here

        // Defer creation of the entry set until it is actually needed.
        if (fEntrySet == null) {
            final int length = getLength();
            final XSNamedMapEntry[] entries = new XSNamedMapEntry[length];
            for (int i = 0; i < length; ++i) {
                XSObject xso = item(i);
                entries[i] = new XSNamedMapEntry(new QName(xso.getNamespace(), xso.getName()), xso);
            }
            // Create a view of this immutable map.
            fEntrySet = new AbstractSet() {
                public Iterator iterator() {
                    return new Iterator() {
View Full Code Here

            {
               XSNamedMap components = model.getComponents(XSConstants.ELEMENT_DECLARATION);
               String roots = "";
               for (int j = 0; j < components.getLength(); ++j)
               {
                  XSObject xsObject = components.item(j);
                  if (j > 0)
                  {
                     roots += ", ";
                  }
                  roots += xsObject.getNamespace() + ":" + xsObject.getName();
               }
               throw new IllegalStateException("Root element not found: " + qName + " among " + roots);
            }

            marshalElement(element, 1, 1);// todo fix min/max
View Full Code Here

            }
        }
        XSParticle particle = null;
        if (modelGroup != null && modelGroup.getParticles() != null) {
            for (int i = 0; i < modelGroup.getParticles().getLength(); i++) {
                XSObject particleObject = modelGroup.getParticles().item(i);
                if (particleObject instanceof XSParticle) {
                    XSParticle currentParticle = (XSParticle) particleObject;
                    if (currentParticle.getTerm() instanceof XSElementDeclaration) {
                        XSElementDeclaration particleElement = (XSElementDeclaration) currentParticle.getTerm();
                        if (particleElement.getName().equals(element.getName())) {
                            particle = currentParticle;
                            break;
                        }
                    }
                }
            }
        }
       
        Config config = dataProvider.getConfig();
        int iterationCounter = 0;
        while (tmpl.contains(Constants.TEMPLATE_DELIMITER_COMPLEX_VALIDATION)) {
            iterationCounter++;
            if (iterationCounter > config.getMaxTemplateResolvingIterations()) {
                System.err.println("********************************************");
                System.err.println("Could not resolve template:");
                System.err.println(fillInTemplate(tmpl, cppElementName, null, null, null, null, null, dataProvider));
                System.err.println("********************************************");
                break;
            }

            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_STRUCT_TYPE)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_STRUCT_TYPE, cppValidationDataStructType);
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_STRUCT_NAME)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_STRUCT_NAME, config
                        .getComplexValidationDataStructVariableName());
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_PARENT_STRUCT_NAME)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_PARENT_STRUCT_NAME, config
                        .getComplexValidationDataParentStructVariableName());
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_STRUCT_MEMBER)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_STRUCT_MEMBER, Util
                        .createComplexValidationDataStructMemberName(element, config));
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_CHECK_MAX_OCCURENCE)) {
                String maxOccCheck = config.getTemplateComplexValidationCheckMaxOccurence();
                if (particle == null || (particle != null && particle.getMaxOccursUnbounded()) || complexTypeMaxOccursUnbounded ) {
                    maxOccCheck = "";
                }
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_CHECK_MAX_OCCURENCE, maxOccCheck);
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_GET_VALIDATION_DATA)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_GET_VALIDATION_DATA, config
                        .getTemplateComplexValidationGetTopValidationData());
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_DELETE_VALIDATION_DATA)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_DELETE_VALIDATION_DATA, config
                        .getTemplateComplexValidationDeleteValidationData());
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_GET_PARENT_VALIDATION_DATA)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_GET_PARENT_VALIDATION_DATA, config
                        .getTemplateComplexValidationGetTopParentValidationData());
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_INCREMENT_OCCURENCE)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_INCREMENT_OCCURENCE, config
                        .getTemplateComplexValidationIncrementOccurence());
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_MAX_OCCURENCE)) {
                int maxOccurence = 0;
                if (particle != null) {
                    maxOccurence = particle.getMaxOccurs();
                }
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_MAX_OCCURENCE, String.valueOf(maxOccurence));
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_CHECK_MIN_OCCURENCE_OF_CHILDREN)) {
                String childrenCheck = "";
                if (modelGroup != null && modelGroup.getParticles() != null) {
                    switch (modelGroup.getCompositor()) {
                    case XSModelGroup.COMPOSITOR_ALL:
                    case XSModelGroup.COMPOSITOR_SEQUENCE:
                        for (int i = 0; i < modelGroup.getParticles().getLength(); i++) {
                            XSObject item = modelGroup.getParticles().item(i);
                            if (item instanceof XSParticle) {
                                XSParticle child = (XSParticle) item;
                                if (child.getMinOccurs() == 0) {
                                    continue;
                                }
                                String particleTmpl = config.getTemplateComplexValidationCheckMinOccurencOfChildren();
                                childrenCheck += fillInComplexValidationParticleTemplate(particleTmpl, child, config);
                            }
                        }
                        break;
                    case XSModelGroup.COMPOSITOR_CHOICE:
                        boolean allChildrenHaveMinOccurs = true;
                        for (int i = 0; i < modelGroup.getParticles().getLength(); i++) {
                            XSObject item = modelGroup.getParticles().item(i);
                            if (item instanceof XSParticle) {
                                XSParticle child = (XSParticle) item;
                                if (child.getMinOccurs() == 0) {
                                    allChildrenHaveMinOccurs = false;
                                    continue;
                                }
                                String particleTmpl = config
                                        .getTemplateComplexValidationChoiceCheckMinOccurencOfChildren();
                                childrenCheck += fillInComplexValidationParticleTemplate(particleTmpl, child, config);
                            }
                        }
                        if (allChildrenHaveMinOccurs) {
                            childrenCheck += config.getTemplateComplexValidationChoiceCheckOneChildPresent();
                            if (childrenCheck.contains(Constants.TMPL_COMPLEX_VALI_CHOICE_ONE_CHILD_PER_CHILD)) {
                                for (int i = 0; i < modelGroup.getParticles().getLength(); i++) {
                                    XSObject item = modelGroup.getParticles().item(i);
                                    if (item instanceof XSParticle) {
                                        XSParticle child = (XSParticle) item;
                                        String perChild = config
                                                .getTemplateComplexValidationChoiceCheckOneChildPresentPerChild();
                                        if (i != modelGroup.getParticles().getLength() - 1) {
View Full Code Here

            XSComplexTypeDefinition complexType = (XSComplexTypeDefinition) element.getTypeDefinition();
            createComplexValidationDataStructName(element2ElementName.get(element).cppElementName, element, complexType);
            XSObjectList attributeUses = complexType.getAttributeUses();

            for (int i = 0; i < attributeUses.getLength(); i++) {
                XSObject item = attributeUses.item(i);
                if (item instanceof XSAttributeUse) {
                    XSAttributeUse attrUse = (XSAttributeUse) item;
                    XSSimpleTypeDefinition simpleType = Util.getType(attrUse);
                    createSimpleValidationFunctionName(element2ElementName.get(element).cppElementName, element,
                            simpleType);
View Full Code Here

        // case 4: anonymous type inside an element which has been declared as
        // top level element
        // TODO make this element naming case namespace unique
        XSNamedMap elementMap = getModel().getComponents(XSConstants.ELEMENT_DECLARATION);
        for (int i = 0; i < elementMap.getLength(); i++) {
            XSObject item = elementMap.item(i);
            if (item.getType() == XSConstants.ELEMENT_DECLARATION) {
                if (item == element) {
                    name = element.getName();
                    CppElementNameParentTypesPair returnVal = new CppElementNameParentTypesPair();
                    returnVal.cppElementName = Util.replaceCharactersForbiddenInCppIdentifiers(name);
                    returnVal.parentTypes = parentTypes;
View Full Code Here

    protected void checkModelGroup(XSModelGroup modelGroup, int nestedHierarchy) {
        if (!checkedGroups.contains(modelGroup)) {
            checkedGroups.add(modelGroup);
            XSObjectList particles = modelGroup.getParticles();
            for (int i = 0; i < particles.getLength(); i++) {
                XSObject item = particles.item(i);
                if (item instanceof XSParticle) {
                    XSParticle particle = (XSParticle) item;
                    if (particle.getTerm() instanceof XSModelGroup) {
                        XSModelGroup nestedModelGroup = (XSModelGroup) particle.getTerm();
                        String indent = "  ";
View Full Code Here

TOP

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

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.