public XSObjectList getMemberTypes() { return xsSimple.getMemberTypes(); }
public List<SimpleTypeDefinition> getMemberTypes() { XSObjectList xsMemberTypes = simpleTypeDefinition.getMemberTypes(); List<SimpleTypeDefinition> memberTypes = new LinkedList<SimpleTypeDefinition>(); for (int i = 0; i < xsMemberTypes.getLength(); i++) { memberTypes.add(createTypeDefinition((XSSimpleTypeDefinition) xsMemberTypes.item(i))); } return memberTypes; }
public void setXDMTypedValueOf$valueForSTVarietyList(Element rootNodeOfAssertTree, String listStrValue, XSSimpleTypeDefinition itemType, boolean isTypeDerivedFromList, DynamicContext xpath2DynamicContext) throws Exception { if (itemType.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION) { // itemType of xs:list has variety 'union' List xdmItemList = new ArrayList(); XSObjectList memberTypes = itemType.getMemberTypes(); // tokenize the list value by a sequence of white spaces StringTokenizer values = new StringTokenizer(listStrValue, " \n\t\r"); while (values.hasMoreTokens()) { String itemValue = values.nextToken(); XSSimpleTypeDefinition listItemTypeForUnion = getActualXDMItemTypeForSTVarietyUnion(memberTypes, itemValue); xdmItemList.add(SchemaTypeValueFactory.newSchemaTypeValue(listItemTypeForUnion.getBuiltInKind(), itemValue)); } xpath2DynamicContext.set_variable(new org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"), XS11TypeHelper.getXPath2ResultSequence(xdmItemList)); } else { setXDMTypedValueOf$value(rootNodeOfAssertTree, listStrValue, itemType, null, isTypeDerivedFromList, xpath2DynamicContext); } } // setXDMTypedValueOf$valueForSTVarietyList
void extraCheckForSTUnionAssertsAttrs(XMLAttributes attributes) { XMLAttributes attrsImpl = (XMLAttributesImpl)attributes; for (int attrIdx = 0; attrIdx < attrsImpl.getLength(); attrIdx++) { Augmentations attrAugs = attrsImpl.getAugmentations(attrIdx); AttributePSVImpl attrPsvi = (AttributePSVImpl)attrAugs.getItem(Constants.ATTRIBUTE_PSVI); XSSimpleTypeDefinition attrSimpleType = (XSSimpleTypeDefinition) attrPsvi.getTypeDefinition(); List isAssertProcessingNeededForSTUnionAttrs = fXmlSchemaValidator.getIsAssertProcessingNeededForSTUnionAttrs(); if (attrSimpleType != null && attrSimpleType.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION && ((XSSimpleType) attrSimpleType.getBaseType()).getVariety() != XSSimpleTypeDefinition.VARIETY_UNION) { if (XS11TypeHelper.isAtomicStrValueValidForSTUnion(attrSimpleType.getMemberTypes(), attrsImpl.getValue(attrIdx), attrPsvi.fValue, Constants.SCHEMA_VERSION_1_1)) { isAssertProcessingNeededForSTUnionAttrs.add(Boolean.valueOf(false)); } else { isAssertProcessingNeededForSTUnionAttrs.add(Boolean.valueOf(true)); } } else { isAssertProcessingNeededForSTUnionAttrs.add(Boolean.valueOf(true)); } } } // extraCheckForSTUnionAssertsAttrs
} else if (simpleType.getMemberTypes().getLength() > 0) { XSObjectList members = simpleType.getMemberTypes(); int rand = RandomUtil.random(0, members.getLength() - 1); return generateSampleValue(config, (XSSimpleTypeDefinition) members.item(rand), hint, counters);
XSAssertImpl assertImpl = getFirstAssertFromUnionMemberTypes(simpleTypeDef.getMemberTypes()); if (assertImpl != null) { simpleTypeAsserts = new Vector();
if (listItemType.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION) { final XSObjectList memberTypes = listItemType.getMemberTypes(); while (values.hasMoreTokens()) { String itemValue = values.nextToken(); XSSimpleTypeDefinition simpleContentTypeForUnion = getActualXDMItemTypeForSTVarietyUnion(complexTypeSimplContentType.getMemberTypes(), value); if (simpleContentTypeForUnion.getVariety() == XSSimpleTypeDefinition.VARIETY_LIST) { setXDMTypedValueOf$valueForSTVarietyList(fRootNodeOfAssertTree, value, simpleContentTypeForUnion, ((XSSimpleTypeDefinition)simpleContentTypeForUnion.getBaseType()).getVariety() == XSSimpleTypeDefinition.VARIETY_LIST, xpath2DynamicContext);
/** * Checks if a type is derived from another by union. See: * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom * * @param ancestorNS * The namspace of the ancestor type declaration * @param ancestorName * The name of the ancestor type declaration * @param type * The reference type definition * * @return boolean True if the type is derived by union for the reference type */ private boolean isDerivedByUnion (String ancestorNS, String ancestorName, XSTypeDefinition type) { // If the variety is union if (type !=null && ((XSSimpleTypeDefinition)type).getVariety() == VARIETY_UNION) { // get member types XSObjectList memberTypes = ((XSSimpleTypeDefinition)type).getMemberTypes(); for (int i = 0; i < memberTypes.getLength(); i++) { // One of the {member type definitions} is T2. if (memberTypes.item(i) != null) { // T2 is derived from the other type definition by DERIVATION_RESTRICTION if (isDerivedByRestriction(ancestorNS, ancestorName,(XSSimpleTypeDefinition)memberTypes.item(i))) { return true; } } } } return false; }
XSObject comp = (XSObject)currentComponents.get(i); if (((XSTypeDefinition)comp).getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) { XSObjectList memberTypes = ((XSSimpleTypeDefinition)comp).getMemberTypes(); for (int j = 0, nt = memberTypes.size(); j < nt; ++j) { addComponent((XSObject)memberTypes.get(j), step.getNametest(), result);
return handleSimpleType(simple.getItemType()); case XSSimpleTypeDefinition.VARIETY_UNION: XSObjectList list = simple.getMemberTypes(); if (list.getLength() > 0) return handleSimpleType((XSSimpleTypeDefinition)list.item(0));
private void expandRelatedSimpleTypeComponents(XSSimpleTypeDefinition type, Vector componentList, String namespace, Hashtable dependencies) { final XSTypeDefinition baseType = type.getBaseType(); if (baseType != null) { addRelatedType(baseType, componentList, namespace, dependencies); } final XSTypeDefinition itemType = type.getItemType(); if (itemType != null) { addRelatedType(itemType, componentList, namespace, dependencies); } final XSTypeDefinition primitiveType = type.getPrimitiveType(); if (primitiveType != null) { addRelatedType(primitiveType, componentList, namespace, dependencies); } final XSObjectList memberTypes = type.getMemberTypes(); if (memberTypes.size() > 0) { for (int i=0; i<memberTypes.size(); i++) { addRelatedType((XSTypeDefinition)memberTypes.item(i), componentList, namespace, dependencies); } } }
XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) base; if (st.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION) { XSObjectList memberTypes = st.getMemberTypes(); final int length = memberTypes.getLength(); for (int i = 0; i < length; ++i) {
XSObjectList memberTypes = simpleTypeDefn.getMemberTypes(); if (memberTypes != null && memberTypes.getLength() > 0 && !isTypeDerivedFromUnion) { if (isValidationFailedForSTUnion(memberTypes, element, value, augs)) {
addComponent(((XSSimpleTypeDefinition)sourceComponent).getItemType(), nameTest, targetComponents); XSObjectList list = ((XSSimpleTypeDefinition)sourceComponent).getMemberTypes(); for (int i = 0, n = list.size(); i < n; ++i) { addComponent(list.item(i), nameTest, targetComponents);