decl.setName(attQName.getLocalPart()); decl.setTargetNamespace(attQName.getNamespaceURI()); .get("string"); decl.setTypeDefinition(type); att.setNamespace(decl.getTargetNamespace()); att.setName(decl.getName()); att.setText(attributes.getValue(i));
for (Iterator itr = atts.iterator(); itr.hasNext();) { XSDAttributeDeclaration attribute = (XSDAttributeDeclaration) itr.next(); if ( attribute.isAttributeDeclarationReference() ) { attribute = attribute.getResolvedAttributeDeclaration(); XSDSimpleTypeDefinition type = attribute.getTypeDefinition(); if (type == null) { if (Utilities.equals(ad.getTargetNamespace(), attribute.getTargetNamespace()) && Utilities.equals(ad.getName(), attribute.getName())) { type = ad.getTypeDefinition(); break; if ( "uom".equals( attribute.getName() ) ) { System.out.println();
public AttributeEncodeExecutor( Object object, XSDAttributeDeclaration attribute, Document document, Logger logger) { this.object = object; this.attribute = attribute; this.document = document; this.logger = logger; encoding = document.createAttributeNS(attribute.getTargetNamespace(), attribute.getName()); }
if ( attribute.getAnonymousTypeDefinition() != null ) { attribute.getAnonymousTypeDefinition().setName( "_" + attribute.getName() ); anonymous.add( attribute.getAnonymousTypeDefinition() );
simpleAttributeDeclaration./*{@link XSDNamedComponent#setName */setName/*}*/("simpleAttributeDeclaration"); simpleAttributeDeclaration./*{@link XSDAttributeDeclaration#setTypeDefinition */setTypeDefinition/*}*/ (prototypeSchema.resolveSimpleTypeDefinition(/*{@link #*/someOtherSchemaURI/*}*/, "someOtherTypeDefinition")); simpleAttributeDeclaration./*{@link XSDAttributeDeclaration#setConstraint */setConstraint/*}*/(/*{@link */XSDConstraint/*}*/.DEFAULT_LITERAL); simpleAttributeDeclaration./*{@link XSDAttributeDeclaration#setLexicalValue */setLexicalValue/*}*/("defaultValue");
public String getTextForAttribute(XSDAttributeDeclaration ad, boolean showType) { ad = ad.getResolvedAttributeDeclaration(); String name = ad.getName(); StringBuffer result = new StringBuffer(); if (name == null) { result.append(" " + Messages._UI_LABEL_ABSENT + " "); //$NON-NLS-1$ //$NON-NLS-2$ } else { result.append(name); } if (ad.getAnonymousTypeDefinition() == null && ad.getTypeDefinition() != null) { result.append(" : "); //$NON-NLS-1$ // result.append(resolvedAttributeDeclaration.getTypeDefinition().getQName(xsdAttributeDeclaration)); result.append(ad.getTypeDefinition().getName()); } return result.toString(); }
XSDAttributeDeclaration attrDecl = attrUse.getContent(); if (attrDecl != null && attrDecl.isAttributeDeclarationReference()) if (attrDecl.getResolvedAttributeDeclaration().getTargetNamespace() != null) if (attrDecl.getResolvedAttributeDeclaration().getTargetNamespace().equals(oldNS)) attrDecl.getResolvedAttributeDeclaration().setTargetNamespace(newNS); attrDecl.getResolvedAttributeDeclaration().setTargetNamespace(newNS);
attrDecl.setName(localName); attrDecl.setResolvedAttributeDeclaration((XSDAttributeDeclaration)type); attrDecl.setTypeDefinition (component.getSchema().resolveSimpleTypeDefinition((String)type));
xsdAttributeDeclaration.setResolvedAttributeDeclaration(referencedXSDAttributeDeclaration); xsdAttributeDeclaration.setName(name); xsdAttributeDeclaration.setForm(XSDForm.QUALIFIED_LITERAL); !XSDConstants.isOrIsDerivedFromID(xsdAttributeDeclaration.getTypeDefinition()))
public XSDTypeDefinition getTypeDefinition() { return decl.getTypeDefinition(); }
public static class FeatureIteratorImpl extends EContentsEList.FeatureIteratorImpl<XSDConcreteComponent> { public FeatureIteratorImpl(EObject eObject) { super(eObject, (EStructuralFeature [])((BasicEList<?>)eObject.eClass().getEAllReferences()).data()); } public FeatureIteratorImpl(EObject eObject, EStructuralFeature [] eStructuralFeatures) { super(eObject, eStructuralFeatures); } @Override protected boolean isIncluded(EStructuralFeature eStructuralFeature) { EReference eReference = (EReference)eStructuralFeature; return !eReference.isTransient(); } } }
@Override public String getText(Object object) { XSDAttributeDeclaration xsdAttributeDeclaration = ((XSDAttributeDeclaration)object); XSDAttributeDeclaration resolvedXSDAttributeDeclaration = xsdAttributeDeclaration.getResolvedAttributeDeclaration(); String result = resolvedXSDAttributeDeclaration.getName(); return result == null ? XSDEditPlugin.INSTANCE.getString("_UI_Absent_label") : result; } };
child.setName(name); if (namespace != null) child.setTargetNamespace(namespace); child.setResolvedAttributeDeclaration(child); child.setTypeDefinition(parent.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string")); return child;
protected XSDAttributeDeclaration createUnresolvedAttributeDeclaration(String namespace, String localName) { XSDAttributeDeclaration xsdAttributeDeclaration = XSDFactory.eINSTANCE.createXSDAttributeDeclaration(); if (localName != null) { xsdAttributeDeclaration.setName(localName); } if (namespace != null) { xsdAttributeDeclaration.setTargetNamespace(namespace); } xsdAttributeDeclaration.setResolvedAttributeDeclaration(xsdAttributeDeclaration); return xsdAttributeDeclaration; }
protected XSDAttributeDeclaration createGlobalXSDAttributeDeclaration(XSDSchema xsdSchema) { ensureSchemaElement(xsdSchema); XSDAttributeDeclaration attribute = XSDFactory.eINSTANCE.createXSDAttributeDeclaration(); attribute.setTypeDefinition(xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("string")); //$NON-NLS-1$ attribute.setName(XSDCommonUIUtils.createUniqueElementName("NewAttribute", xsdSchema.getAttributeDeclarations())); //$NON-NLS-1$ Text textNode = xsdSchema.getDocument().createTextNode("\n"); //$NON-NLS-1$ xsdSchema.getElement().appendChild(textNode); xsdSchema.getContents().add(attribute); return attribute; }
if (input instanceof XSDAttributeDeclaration) XSDAttributeDeclaration namedComponent = ((XSDAttributeDeclaration) input).getResolvedAttributeDeclaration(); String oldName = namedComponent.getName(); if (!newValue.equals(oldName)) String qname = attrRef.getResolvedAttributeDeclaration().getQName(); attrRef.getElement().setAttribute(XSDConstants.REF_ATTRIBUTE, qname);
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; }
String msg = "Encode failed for " + attribute.getName() + ". Cause: " + t.getLocalizedMessage();
public Object caseXSDAttributeDeclaration(XSDAttributeDeclaration attributeDeclaration) { XSDConcreteComponent target = null; if (attributeDeclaration.isAttributeDeclarationReference()) { target = attributeDeclaration.getResolvedAttributeDeclaration(); } else if (attributeDeclaration.getAnonymousTypeDefinition() == null) { target = attributeDeclaration.getTypeDefinition(); // Avoid navigating to built in data types. if (isFromSchemaForSchema(target)) { target = null; } } return target; }
@Override public void setPropertyValue(Object o, Object value) { XSDAttributeDeclaration xsdAttributeDeclaration = (XSDAttributeDeclaration)o; if (xsdAttributeDeclaration.isAttributeDeclarationReference()) { XSDAttributeDeclaration newResolvedAttributeDeclaration = xsdAttributeDeclaration.resolveAttributeDeclaration(xsdAttributeDeclaration.getTargetNamespace(), (String)value); EditingDomain editingDomain = getEditingDomain(xsdAttributeDeclaration); if (editingDomain == null) { xsdAttributeDeclaration.setResolvedAttributeDeclaration(newResolvedAttributeDeclaration); } else { editingDomain.getCommandStack().execute (SetCommand.create (editingDomain, xsdAttributeDeclaration, xsdPackage.getXSDAttributeDeclaration_ResolvedAttributeDeclaration(), newResolvedAttributeDeclaration)); } } else { super.setPropertyValue(o, value); } } });