Package oracle.xml.parser.schema

Examples of oracle.xml.parser.schema.XSDNode


            attributes.add(new AttributeAdapter(this, xsdAttribute.getName(), getTypeMapper(), xsdAttribute));
        }
    }

    private void init(XSDElement xsdElement) {
        XSDNode type = xsdElement.getType();

        // see if we need to create an attribute (simple type)
        AbstractAttributeDefinition attrDef = null;
        if (type instanceof XSDComplexType && QNAME_ANYTYPE.equals(type.getQName())) {
            final String typeAttr = type.getDomNode().getAttribute(XSDConstantValues._type);
            if (typeAttr == null || typeAttr.isEmpty()) {
                // implicit anyType since no type was set in XSD
                attrDef = new TypelessElementAdapter(this, xsdElement.getName(), getTypeMapper());
            } else {
                // explicit anyType can be handled as any normal simpleType element
                attrDef = new AnyTypeElementAdapter(this, xsdElement.getName(), getTypeMapper());
            }
        } else if (type instanceof XSDSimpleType) {
            // simpleType elements (including anySimpleType) can be handld as any normal element
            attrDef = new SimpleElementAdapter(this, xsdElement.getName(), getTypeMapper(), xsdElement);
        }

        if (attrDef != null) {
            if (xsdElement.getMaxOccurs() > 1) {
                // repeating simple attribute needs wrapper for extra (repeating) StructureDefinition
                // FIXME: RepeatingSimpleElementAdapter should also become parent of attrDef (including in its name)
                accessors.add(new RepeatingScalarAccessor(this, getTypeMapper(), attrDef));
            } else {
                attributes.add(attrDef);
            }
        } else if (type instanceof XSDComplexType) {
            // no attribute definition, so create accessor to complexType
            accessors.add(new ComplexElementAdapter(this, xsdElement.getName(), getTypeMapper(), xsdElement));
        } else {
            throw new UnsupportedOperationException("XSDElement with type " + type.getClass().getName() + " " +
                                                    type.getName());
        }
    }
View Full Code Here

TOP

Related Classes of oracle.xml.parser.schema.XSDNode

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.