attributes.add(use.getAttributeDeclaration()); } else if (content instanceof XSDAttributeGroupDefinition) { attributes.add(use.getAttributeDeclaration());
@Override public boolean isIdentifiable(XSDComplexTypeDefinition typeDefinition) { List attributeUses = typeDefinition.getAttributeUses(); final String idAttName = getId().getLocalPart(); for (Iterator it = attributeUses.iterator(); it.hasNext(); ) { XSDAttributeUse use = (XSDAttributeUse) it.next(); XSDAttributeUseCategory useCategory = use.getUse(); XSDAttributeDeclaration idAtt = use.getAttributeDeclaration(); String targetNamespace = idAtt.getTargetNamespace(); String name = idAtt.getName(); if (getNameSpace().equals(targetNamespace) && idAttName.equals(name)) { if (XSDAttributeUseCategory.REQUIRED_LITERAL.equals(useCategory)) { return true; } } } return false; }
XSDAttributeDeclaration att = attgcontent.getContent(); descriptor = createAttributeDescriptor(
public String getText(Object object, boolean showType) { XSDAttributeUse xsdAttributeUse = ((XSDAttributeUse)object); XSDAttributeDeclaration xsdAttributeDeclaration = getDelegate(xsdAttributeUse); StringBuffer result = new StringBuffer(); if (xsdAttributeDeclaration != null) { result.append(itemDelegator.getText(xsdAttributeDeclaration)); } if (xsdAttributeUse.isSetConstraint()) { if (result.length() != 0) { result.append(" "); } result.append('<'); result.append(xsdAttributeUse.getConstraint()); result.append("=\""); result.append(xsdAttributeUse.getLexicalValue()); result.append("\">"); } return result.toString(); }
public static XSDAttributeUse createAttributeUse(Node node) { if (XSDConstants.nodeType(node) == XSDConstants.ATTRIBUTE_ELEMENT) { XSDAttributeUse xsdAttributeUse = XSDFactory.eINSTANCE.createXSDAttributeUse(); xsdAttributeUse.setElement((Element)node); XSDAttributeDeclaration xsdAttributeDeclaration = XSDAttributeDeclarationImpl.createAttributeDeclaration(node); xsdAttributeUse.setContent(xsdAttributeDeclaration); return xsdAttributeUse; } return null; }
xsdAttriuteUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); canHaveDefault = false; xsdAttriuteUse.setConstraint(XSDConstraint.DEFAULT_LITERAL); xsdAttriuteUse.setLexicalValue(transformDefaultValue(xsdAttriuteUse.getAttributeDeclaration().getTypeDefinition(), defaultValue)); XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttriuteUse.getAttributeDeclaration(); xsdAttributeDeclaration.setConstraint(XSDConstraint.DEFAULT_LITERAL); xsdAttributeDeclaration.setLexicalValue(transformDefaultValue(xsdAttributeDeclaration.getTypeDefinition(), defaultValue));
protected XSDAttributeUse createAttributeUse(XSDSchema schema, String name, String type, String use, String form, String fixed) { XSDAttributeDeclaration attributeDeclaration = XSDFactory.eINSTANCE.createXSDAttributeDeclaration(); attributeDeclaration.setName(name); attributeDeclaration.setTypeDefinition(schema.getSchemaForSchema().resolveSimpleTypeDefinition(type)); if ("qualified".equals(form)) { attributeDeclaration.setForm(XSDForm.QUALIFIED_LITERAL); } XSDAttributeUse attributeUse = XSDFactory.eINSTANCE.createXSDAttributeUse(); attributeUse.setContent(attributeDeclaration); if ("optional".equals(use)) { attributeUse.setUse(XSDAttributeUseCategory.OPTIONAL_LITERAL); } if ("required".equals(use)) { attributeUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); } if (fixed != null) { attributeUse.setConstraint(XSDConstraint.FIXED_LITERAL); attributeUse.setLexicalValue("2.0"); } return attributeUse; }
for (XSDAttributeUse xsdAttributeUse : xsdAttributeUses) XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttributeUse.getAttributeDeclaration(); boolean matched = false; for (XSDAttributeUse baseXSDAttributeUse : baseXSDAttributeUses) XSDAttributeDeclaration baseXSDAttributeDeclaration = baseXSDAttributeUse.getAttributeDeclaration(); if (xsdAttributeDeclaration.hasSameNameAndTargetNamespace(baseXSDAttributeDeclaration)) if (baseXSDAttributeUse.isRequired() && !xsdAttributeUse.isRequired()) if (baseXSDAttributeUse.isRequired()) baseXSDAttributeUse.getAttributeDeclaration().getURI());
xsdAnnotations.add(xsdAttributeUse.getContent().getAnnotation()); XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttributeUse.getAttributeDeclaration(); xsdAnnotations.add(xsdAttributeDeclaration.getAnnotation()); elements.add(xsdAttributeDeclaration.getElement());
attributeUse.setAttributeDeclaration(attribute); attributeUse.setContent(attribute); list.add(use.getAttributeDeclaration()); attributeUse.setAttributeDeclaration(attribute); attributeUse.setContent(attribute);
XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttributeUse.getAttributeDeclaration(); extendedMetaData.setFeatureKind(eReference, ExtendedMetaData.ATTRIBUTE_FEATURE); extendedMetaData.setName(eReference, xsdAttributeDeclaration.getName()); XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttributeUse.getAttributeDeclaration(); extendedMetaData.setFeatureKind(eAttribute, ExtendedMetaData.ATTRIBUTE_FEATURE); extendedMetaData.setName(eAttribute, xsdAttributeDeclaration.getName()); if (defaultValue == null) defaultValue = xsdAttributeUse.getLexicalValue();
/** * This creates an object of type <code>XSDAttributeUse</code> containing * an object of type <code>XSDAttributeDeclaration</code> -- if * <code>isReference</code> is <code>true</code>, the attribute use * content will be a new attribute declaration that resolves to * <code>attributeDeclaration</code>; otherwise, it will be simply * <code>attributeDeclaration</code> itself. */ protected XSDAttributeUse createAttributeUse(XSDAttributeDeclaration attributeDeclaration, boolean isReference) { XSDAttributeUse au = xsdFactory.createXSDAttributeUse(); if (isReference) { XSDAttributeDeclaration ref = xsdFactory.createXSDAttributeDeclaration(); ref.setResolvedAttributeDeclaration(attributeDeclaration); au.setContent(ref); } else { au.setContent(attributeDeclaration); } return au; }
simpleAttributeUse./*{@link XSDAttributeUse#setContent */setContent/*}*/(simpleAttributeDeclarationReference); simpleAttributeUse.setUse(/*{@link */XSDAttributeUseCategory/*}*/.OPTIONAL_LITERAL); simpleContentComplexTypeDefinition./*{@link XSDComplexTypeDefinition#getAttributeContents */getAttributeContents/*}*/().add(simpleAttributeUse);
public void execute() { Element element = component.getElement(); try { beginRecording(element); String currentMin = element.getAttribute(XSDConstants.MINOCCURS_ATTRIBUTE); removeMinOccursAttribute = (currentMin == null) ? true : false; if (component instanceof XSDParticle) { oldMinOccurs = ((XSDParticle) component).getMinOccurs(); ((XSDParticle) component).setMinOccurs(newMinOccurs); } else if (component instanceof XSDAttributeUse) { oldMinOccurs = (((XSDAttributeUse) component).getUse() == XSDAttributeUseCategory.REQUIRED_LITERAL ? 1 : 0); if (newMinOccurs == 1) ((XSDAttributeUse) component).setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); else ((XSDAttributeUse) component).setUse(XSDAttributeUseCategory.OPTIONAL_LITERAL); } } finally { endRecording(); } }
simpleAttributeUseGroupMember./*{@link XSDAttributeUse#setContent */setContent/*}*/(simpleAttributeDeclarationGroupMember); simpleAttributeUseGroupMember./*{@link XSDAttributeDeclaration#setConstraint */setConstraint/*}*/(/*{@link */XSDConstraint/*}*/.DEFAULT_LITERAL); simpleAttributeUseGroupMember./*{@link XSDAttributeDeclaration#setLexicalValue */setLexicalValue/*}*/("defaultValue"); simpleAttributeGroupDefinition./*{@link XSDAttributeGroupDefinition#getContents */getContents/*}*/().add(simpleAttributeUseGroupMember);
protected void setUseToRequired(EAttribute attribute, XSDAttributeUse attrUse) { if (attribute.isRequired()) { attrUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); } }
((XSDAttributeUse)getContainer()).setAttributeDeclaration(theResolvedAttributeDeclaration);
xsdAttriuteUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); canHaveDefault = false; xsdAttriuteUse.setConstraint(XSDConstraint.DEFAULT_LITERAL); xsdAttriuteUse.setLexicalValue(defaultValue); XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttriuteUse.getAttributeDeclaration(); xsdAttributeDeclaration.setConstraint(XSDConstraint.DEFAULT_LITERAL); xsdAttributeDeclaration.setLexicalValue(defaultValue);
protected XSDAttributeUse createAttributeUse(XSDSchema schema, String name, String type, String use, String form, String fixed) { XSDAttributeDeclaration attributeDeclaration = XSDFactory.eINSTANCE.createXSDAttributeDeclaration(); attributeDeclaration.setName(name); attributeDeclaration.setTypeDefinition(schema.getSchemaForSchema().resolveSimpleTypeDefinition(type)); if ("qualified".equals(form)) { attributeDeclaration.setForm(XSDForm.QUALIFIED_LITERAL); } XSDAttributeUse attributeUse = XSDFactory.eINSTANCE.createXSDAttributeUse(); attributeUse.setContent(attributeDeclaration); if ("optional".equals(use)) { attributeUse.setUse(XSDAttributeUseCategory.OPTIONAL_LITERAL); } if ("required".equals(use)) { attributeUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); } if (fixed != null) { attributeUse.setConstraint(XSDConstraint.FIXED_LITERAL); attributeUse.setLexicalValue("2.0"); } return attributeUse; }