Package org.jibx.binding.model

Examples of org.jibx.binding.model.IComponent


           
            // check for container with element name or text content
            ContainerElementBase contain = (ContainerElementBase)expands.get(i);
            contents = contain.getContentComponents();
            for (int j = 0; j < contents.size(); j++) {
                IComponent comp = (IComponent)contents.get(j);
                if (comp.hasName()) {
                   
                    // component with name means child element
                    haschild = true;
                   
                } else if (comp instanceof ValueElement) {
View Full Code Here


        }
       
        // generate schema equivalents for content components of container
        ArrayList comps = cont.getContentComponents();
        for (int i = offset; i < comps.size(); i++) {
            IComponent comp = (IComponent)comps.get(i);
            if (comp.hasName()) {
               
                // create element for named content component
                ElementElement element = buildElement(comp, repeat, hold);
                if (comp instanceof StructureElementBase) {
                    addItemDocumentation((StructureElementBase)comp, element);
                }
                cdef.getParticleList().add(element);
               
            } else if (comp instanceof ContainerElementBase) {
                ContainerElementBase contain = (ContainerElementBase)comp;
                boolean iscoll = comp instanceof CollectionElement;
                if (contain.children().size() > 0) {
                   
                    // no element name, but children; handle with recursive call
                    CommonCompositorDefinition part = buildCompositor(contain, 0, iscoll, hold);
                    addCompositorPart(part, cdef);
                   
                } else if (iscoll) {
                   
                    // collection without a wrapper element
                    CollectionElement coll = (CollectionElement)comp;
                    String itype = coll.getItemTypeName();
                    TemplateElementBase ref = coll.getDefinitions().getSpecificTemplate(itype);
                    if (ref instanceof MappingElement) {
                       
                        // item type with concrete mapping, make it an element
                        MappingDetail detail = m_detailDirectory.getMappingDetail((MappingElementBase)ref);
                        ElementElement item = new ElementElement();
                        QName oname = detail.getOtherName();
                        setElementRef(oname, item, hold);
                        item.setMinOccurs(Count.COUNT_ZERO);
                        item.setMaxOccurs(Count.COUNT_UNBOUNDED);
                        addItemDocumentation(coll, item);
                        cdef.getParticleList().add(item);
                       
                    } else {
                       
                        // TODO: handle this with xs:any strict?
                        m_context.addWarning("Handling not implemented for unspecified mapping", coll);
                    }
                   
                } else if (comp instanceof StructureElement) {
                   
                    // no children, must be mapping reference
                    StructureElement struct = (StructureElement)comp;
                    MappingElementBase ref = (MappingElementBase)struct.getEffectiveMapping();
                    if (ref == null) {
                       
                        // TODO: handle this with xs:any strict?
                        m_context.addWarning("Handling not implemented for unspecified mapping", struct);
                       
                    } else {
                       
                        // handle mapping reference based on form and name use
                        MappingDetail detail = m_detailDirectory.getMappingDetail(ref);
                        if (ref.isAbstract()) {
                           
                            // abstract inline treated as group
                            GroupRefElement group = new GroupRefElement();
                            setGroupRef(detail.getOtherName(), group, hold);
                            if (comp.isOptional()) {
                                group.setMinOccurs(Count.COUNT_ZERO);
                            }
                            cdef.getParticleList().add(group);
                           
                        } else {
                           
                            // concrete treated as element reference
                            ElementElement elem = new ElementElement();
                            setElementRef(detail.getOtherName(), elem, hold);
                            if (comp.isOptional()) {
                                elem.setMinOccurs(Count.COUNT_ZERO);
                            }
                            addItemDocumentation(struct, elem);
                            cdef.getParticleList().add(elem);
                           
View Full Code Here

    private void fillAttributes(ContainerElementBase cont, int offset, AbstractList attrs, SchemaHolder hold) {
       
        // add child attribute components
        ArrayList comps = cont.getAttributeComponents();
        for (int i = 0; i < comps.size(); i++) {
            IComponent comp = (IComponent)comps.get(i);
            if (comp instanceof ValueElement) {
               
                // simple attribute definition
                AttributeElement attr = new AttributeElement();
                attr.setName(comp.getName());
                QName qname = getSimpleTypeQName(comp);
                if (qname == null) {
                    attr.setTypeDefinition(buildSimpleType(comp));
                } else {
                    setAttributeType(qname, attr, hold);
                }
                if (!comp.isOptional()) {
                    attr.setUse(AttributeElement.REQUIRED_USE);
                }
                addItemDocumentation((ValueElement)comp, attr);
                attrs.add(attr);
               
View Full Code Here

TOP

Related Classes of org.jibx.binding.model.IComponent

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.