Package org.jibx.schema.elements

Examples of org.jibx.schema.elements.ElementElement


       
        // finish by generating element definition
        if (detail.isElement()) {
            QName qname = detail.getOtherName();
            SchemaHolder hold = findSchema(qname.getUri());
            ElementElement elem = new ElementElement();
            elem.setName(qname.getName());
            setSubstitutionGroup(detail.getSubstitution(), elem, hold);
            if (detail.isType()) {
                setElementType(detail.getTypeName(), elem, hold);
            } else {
               
                // check for just an element wrapper around type reference
                MappingElementBase ext = detail.getExtensionBase();
                if (ext != null && !detail.hasAttribute() && mapping.getContentComponents().size() == 1) {
                    setElementType(ext.getTypeQName(), elem, hold);
                } else {
                   
                    // add documentation to element which is not also a type
                    addDocumentation(info, elem);
                    elem.setTypeDefinition(buildComplexType(detail, hold));
                }
            }
            hold.getSchema().getTopLevelChildren().add(elem);
        }
    }
View Full Code Here


            ReferenceItem reference = (ReferenceItem)elemdef.getFirstChild();
            DefinitionItem basedef = reference.getDefinition();
            if (!basedef.hasDirectGenerateClass() && ((Boolean)usemap.get(basedef)).booleanValue()) {
               
                // single element definition using type, make sure abstract state matches on element and type
                ElementElement element = (ElementElement)elemdef.getSchemaComponent();
                AnnotatedBase refcomp = basedef.getSchemaComponent();
                if (!(refcomp instanceof ComplexTypeElement) ||
                    ((ComplexTypeElement)refcomp).isAbstract() == element.isAbstract()) {
                   
                    // abstract state matches, force class for type but none for element
                    basedef.setInlineBlocked(true);
                    elemdef.setInlineBlocked(true);
                    typeinstmap.put(basedef, elemdef);
View Full Code Here

                MappingElementBase mapping = new MappingElement();
                mapping.setClassName(clas.getBindingName());
                if (comp.type() == SchemaBase.ELEMENT_TYPE) {
                   
                    // abstract or concrete mapping for element
                    ElementElement element = (ElementElement)comp;
                    setName(element.getEffectiveQName(), mapping, holder);
                    mapping.setAbstract(element.isAbstract());
                    QName group = element.getSubstitutionGroup();
                    if (group != null) {
                        ElementElement base = m_validationContext.findElement(group);
                        DefinitionItem basedef = ((GlobalExtension)base.getExtension()).getDefinition();
                        mapping.setExtendsName(basedef.getGenerateClass().getFullName());
                    }
                   
                } else {
                   
                    // abstract mapping for type definition or group
                    mapping.setAbstract(true);
                    QName qname = definition.getQName();
                    mapping.setTypeQName(qname);
                    String uri = qname.getUri();
                    if (uri != null) {
                        m_bindingDirectory.addTypeNameReference(holder, uri, schema);
                    }
                   
                }
               
                // add the mapping to binding and set on class
                holder.addMapping(mapping);
                ((StructureClassHolder)clas).setBinding(mapping);
                DefinitionItem elementdef = (DefinitionItem)typeinst.get(definition);
                if (elementdef != null) {
                   
                    // create mapping for element name linked to type
                    ElementElement element = (ElementElement)elementdef.getSchemaComponent();
                    SchemaElement elschema = element.getSchema();
                    MappingElementBase elmapping = new MappingElement();
                    elmapping.setClassName(clas.getBindingName());
                    elmapping.setAbstract(element.isAbstract());
                   
                    // handle linking to substitution group head using extends mapping
                    QName group = element.getSubstitutionGroup();
                    if (group != null) {
                        ElementElement base = m_validationContext.findElement(group);
                        DefinitionItem basedef = ((GlobalExtension)base.getExtension()).getDefinition();
                        elmapping.setExtendsName(basedef.getGenerateClass().getFullName());
                    }
                   
                    // create single structure child invoking the type mapping
                    holder = m_bindingDirectory.getRequiredBinding(elschema);
View Full Code Here

TOP

Related Classes of org.jibx.schema.elements.ElementElement

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.