Search in sources :

Example 1 with ComplexTypeDefinition

use of org.eclipse.wst.xml.xpath2.api.typesystem.ComplexTypeDefinition in project webtools.sourceediting by eclipse.

the class NodeType method getXDMTypedValue.

// getTypedValueForPrimitiveType
/*
	 * Construct the "typed value" from a "string value", given the simpleType of the node.
     */
protected ResultSequence getXDMTypedValue(TypeDefinition typeDef, List itemValTypes) {
    if ("anySimpleType".equals(typeDef.getName()) || "anyAtomicType".equals(typeDef.getName())) {
        return new XSUntypedAtomic(getStringValue());
    } else {
        SimpleTypeDefinition simpType = null;
        if (typeDef instanceof ComplexTypeDefinition) {
            ComplexTypeDefinition complexTypeDefinition = (ComplexTypeDefinition) typeDef;
            simpType = complexTypeDefinition.getSimpleType();
            if (simpType != null) {
                // element has a complexType with a simple content
                return getTypedValueForSimpleContent(simpType, itemValTypes);
            } else {
                // element has a complexType with complex content
                return new XSUntypedAtomic(getStringValue());
            }
        } else {
            // element has a simpleType
            simpType = (SimpleTypeDefinition) typeDef;
            return getTypedValueForSimpleContent(simpType, itemValTypes);
        }
    }
}
Also used : ComplexTypeDefinition(org.eclipse.wst.xml.xpath2.api.typesystem.ComplexTypeDefinition) SimpleTypeDefinition(org.eclipse.wst.xml.xpath2.api.typesystem.SimpleTypeDefinition)

Aggregations

ComplexTypeDefinition (org.eclipse.wst.xml.xpath2.api.typesystem.ComplexTypeDefinition)1 SimpleTypeDefinition (org.eclipse.wst.xml.xpath2.api.typesystem.SimpleTypeDefinition)1