Package org.jibx.binding.model

Examples of org.jibx.binding.model.TemplateElementBase


                   
                } else if (!isSimpleValue(itype)) {
                   
                    // find implied mapping, if one defined
                    String type = itype.getName();
                    TemplateElementBase ref = collect.getDefinitions().getSpecificTemplate(type);
                    if (ref instanceof MappingElement) {
                        MappingElement mapref = (MappingElement)ref;
                        MappingDetail detail = forceMappingDetail(mapref);
                        detail.setElement(true);
                    }
                }
               
                // check for nested type reference(s)
                checkReferences(collect, null);
               
            } else if (child instanceof StructureElement) {
               
                // structure, check for nested definition
                StructureElement struct = (StructureElement)child;
                if (struct.children().size() > 0) {
                   
                    // just handle references from nested components
                    checkReferences(struct, null);
                   
                } else {
                   
                    // no nested definition, check for mapping reference
                    MappingElement ref = (MappingElement)struct.getEffectiveMapping();
                    if (ref == null) {
                        m_context.addError("No handling defined for empty structure with no mapping reference", struct);
                    } else {
                       
                        // get the referenced mapping information
                        MappingDetail detail = forceMappingDetail(ref);
                        if (struct.hasDirectName()) {
                            if (ref.isAbstract()) {
                               
                                // named element referencing the mapping implies it's a type definition
                                detail.setType(true);
                               
                            } else {
                               
                                // concrete with name should never happen
                                m_context.addError("No handling defined for name on concrete mapping reference", struct);
                               
                            }
                        } else {
                            if (ref.getName() == null) {
                               
                                // abstract inline treated as group
                                detail.setGroup(true);
                               
                            } else {
View Full Code Here


               
            } else {
               
                // empty collection, item-type must reference a concrete mapping
                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);
                    ComplexTypeElement type = new ComplexTypeElement();
View Full Code Here

                } 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()) {
View Full Code Here

           
            // collection may define type or not
            CollectionElement collection = (CollectionElement)comp;
            String itype = collection.getItemTypeClass().getName();
            DefinitionContext dctx = getDefinitions();
            TemplateElementBase templ = dctx.getSpecificTemplate(itype);
            Element element = null;
            if (! (templ instanceof MappingElement)) {
                if (only) {
                    addComment(egroup, " Replace \"any\" with details of " +
                        "content to complete schema ");
                    element = addChildElement(egroup, "any");
                } else {
                    addComment(egroup,
                        " No mapping for items of collection at " +
                        ValidationException.describe(collection) + " ");
                    addComment(egroup,
                        " Fill in details of content to complete schema ");
                }
            } else {
                element = addChildElement(egroup, "element");
                String name = ((MappingElementBase)templ).getName();
                if (element.getPrefix() == null) {
                    name = "tns:" + name;
                }
                element.setAttribute("ref", name);
            }
            if (element != null) {
                element.setAttribute("minOccurs", "0");
                element.setAttribute("maxOccurs", "unbounded");
            }
           
        } else {
           
            // check for reference to a mapped class
            StructureElement structure = (StructureElement)comp;
            TemplateElementBase templ = structure.getEffectiveMapping();
            if (! (templ instanceof MappingElement)) {
               
                // unknown content, leave it to user to fill in details
                if (only) {
                    addComment(egroup, " Replace \"any\" with details of " +
View Full Code Here

TOP

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

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.