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()); }
protected void buildAttriubuteIndex() { attributeIndex = new HashMap(); for (int i = 0; i < schemas.length; i++) { XSDSchema schema = schemas[i]; for (Iterator a = schema.getAttributeDeclarations().iterator(); a.hasNext(); ) { XSDAttributeDeclaration attribute = (XSDAttributeDeclaration) a.next(); QName qName = new QName(attribute.getTargetNamespace(), attribute.getName()); attributeIndex.put(qName, attribute); } } }
@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 attribute = (XSDAttributeDeclaration)itr.next(); if (attribute.getName() == null) continue; if (!ns.equals(attribute.getTargetNamespace())) continue;
String ns = attribute.getTargetNamespace(); String local = attribute.getName();
if (Utilities.equals(ad.getTargetNamespace(), attribute.getTargetNamespace()) && Utilities.equals(ad.getName(), attribute.getName())) { type = ad.getTypeDefinition();
att.setNamespace(decl.getTargetNamespace()); att.setName(decl.getName()); att.setText(attributes.getValue(i));
if (Utilities.equals(ad.getTargetNamespace(), attribute.getTargetNamespace()) && Utilities.equals(ad.getName(), attribute.getName())) { type = ad.getTypeDefinition();
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()); }
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()); }
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()); }
protected void buildAttriubuteIndex() { attributeIndex = new HashMap(); for (int i = 0; i < schemas.length; i++) { XSDSchema schema = schemas[i]; for (Iterator a = schema.getAttributeDeclarations().iterator(); a.hasNext();) { XSDAttributeDeclaration attribute = (XSDAttributeDeclaration) a.next(); QName qName = new QName(attribute.getTargetNamespace(), attribute.getName()); attributeIndex.put(qName, attribute); } } }
protected void buildAttriubuteIndex() { attributeIndex = new HashMap(); for (int i = 0; i < schemas.length; i++) { XSDSchema schema = schemas[i]; for (Iterator a = schema.getAttributeDeclarations().iterator(); a.hasNext();) { XSDAttributeDeclaration attribute = (XSDAttributeDeclaration) a.next(); QName qName = new QName(attribute.getTargetNamespace(), attribute.getName()); attributeIndex.put(qName, attribute); } } }
protected void buildAttriubuteIndex() { attributeIndex = new HashMap(); for (int i = 0; i < schemas.length; i++) { XSDSchema schema = schemas[i]; for (Iterator a = schema.getAttributeDeclarations().iterator(); a.hasNext();) { XSDAttributeDeclaration attribute = (XSDAttributeDeclaration) a .next(); QName qName = new QName(attribute.getTargetNamespace(), attribute.getName()); attributeIndex.put(qName, attribute); } } }
public java.util.List getGlobalAttributes() { Vector items = new Vector(); if (xsdSchema != null) { updateExternalImportGlobals(); if (xsdSchema.getAttributeDeclarations() != null) { Iterator i = xsdSchema.getAttributeDeclarations().iterator(); while (i.hasNext()) { XSDAttributeDeclaration attributeDeclaration = (XSDAttributeDeclaration) i.next(); if (attributeDeclaration.getTargetNamespace() == null || (attributeDeclaration.getTargetNamespace() != null && !attributeDeclaration.getTargetNamespace().equals(XSDConstants.SCHEMA_INSTANCE_URI_2001))) { String name = attributeDeclaration.getQName(xsdSchema); if (name != null) { items.add(name); } } } } // items = addExternalImportedAttributes(items); items = (Vector) sortList(items); } return items; }
/** Create a namespace prefix if needed, other wise retrieve * a predefined namespace prefix * @return */ private String handleNamespacePrefices() { Element schemaElement = component.getSchema().getElement(); String prefix = null; // If target namespace of the attribute already exists List namespacePrefices = manager.getNamespaceInfoList(schemaElement); for (int i = 0; i < namespacePrefices.size(); i++){ NamespaceInfo info = (NamespaceInfo) namespacePrefices.get(i); if ( info.uri.equals(attribute.getTargetNamespace())) { prefix = info.prefix; } } // Create unquie namespace prefix if ( prefix == null){ prefix = createUniquePrefix(component); } NamespaceInfo info = new NamespaceInfo(attribute.getTargetNamespace(), prefix, ""); //$NON-NLS-1$ List infoList = new ArrayList(1); infoList.add(info); manager.addNamespaceInfo(schemaElement, infoList, false); return prefix; }
/** * Determines if elements of the given complex type definition are required to have an * identifier by looking for a child element of <code>typeDefinition</code> of the form * <code><xs:attribute ref="gml:id" use="required" /></code> * * @param typeDefinition * @return */ private boolean isIdentifiable(XSDComplexTypeDefinition typeDefinition) { List attributeUses = typeDefinition.getAttributeUses(); final String idAttName = GML.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 (GML.getNameSpace().equals(targetNamespace) && idAttName.equals(name)) { if (XSDAttributeUseCategory.REQUIRED_LITERAL.equals(useCategory)) { return true; } } } return false; }
@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); } } });
@Override protected void patch() { super.patch(); XSDAttributeDeclaration theResolvedAttributeDeclaration = getResolvedAttributeDeclaration(); if (theResolvedAttributeDeclaration == this) { XSDSimpleTypeDefinition typeDefinition = getTypeDefinition(); if (typeDefinition != null && (forceResolve && typeDefinition.getName() != null || typeDefinition.getContainer() == null)) { XSDSimpleTypeDefinition newTypeDefinition = resolveSimpleTypeDefinition(typeDefinition.getTargetNamespace(), typeDefinition.getName()); if (forceResolve || newTypeDefinition.getContainer() != null & newTypeDefinition != typeDefinition) { setTypeDefinitionGen(newTypeDefinition); } } } else { XSDAttributeDeclaration newResolvedAttributeDeclaration = resolveAttributeDeclaration(theResolvedAttributeDeclaration.getTargetNamespace(), theResolvedAttributeDeclaration.getName()); if (newResolvedAttributeDeclaration != theResolvedAttributeDeclaration) { setResolvedAttributeDeclaration(newResolvedAttributeDeclaration); } } }
@Override protected void patch() { super.patch(); XSDAttributeDeclaration theResolvedAttributeDeclaration = getResolvedAttributeDeclaration(); if (theResolvedAttributeDeclaration == this) { XSDSimpleTypeDefinition typeDefinition = getTypeDefinition(); if (typeDefinition != null && (forceResolve && typeDefinition.getName() != null || typeDefinition.getContainer() == null)) { XSDSimpleTypeDefinition newTypeDefinition = resolveSimpleTypeDefinition(typeDefinition.getTargetNamespace(), typeDefinition.getName()); if (forceResolve || newTypeDefinition.getContainer() != null & newTypeDefinition != typeDefinition) { setTypeDefinitionGen(newTypeDefinition); } } } else { XSDAttributeDeclaration newResolvedAttributeDeclaration = resolveAttributeDeclaration(theResolvedAttributeDeclaration.getTargetNamespace(), theResolvedAttributeDeclaration.getName()); if (newResolvedAttributeDeclaration != theResolvedAttributeDeclaration) { setResolvedAttributeDeclaration(newResolvedAttributeDeclaration); } } }