public ElementInstance element(String text, QName qname) { // create a fake element declaration and element instance XSDElementDeclaration declaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); declaration.setTypeDefinition(xsdSimple(qname.getLocalPart())); ElementInstance element = new ElementImpl(declaration); element.setText(text); return element; }
Class binding = attribute.getType().getBinding(); if (Point.class.isAssignableFrom(binding)) { element.setTypeDefinition( schemaIndex.getTypeDefinition(gml.qName("PointPropertyType"))); } else if (LineString.class.isAssignableFrom(binding)) { element.setTypeDefinition( searchType(schemaIndex, "LineStringPropertyType", "CurvePropertyType")); } else if (Polygon.class.isAssignableFrom(binding)) { element.setTypeDefinition( searchType(schemaIndex, "PolygonPropertyType", "SurfacePropertyType")); } else if (MultiPoint.class.isAssignableFrom(binding)) { element.setTypeDefinition( schemaIndex.getTypeDefinition(gml.qName("MultiPointPropertyType"))); } else if (MultiLineString.class.isAssignableFrom(binding)) { element.setTypeDefinition( searchType( schemaIndex, element.setTypeDefinition( searchType( schemaIndex, "MultiSurfacePropertyType")); } else { element.setTypeDefinition( schemaIndex.getTypeDefinition(gml.qName("GeometryPropertyType")));
root.setName(name.getLocalPart()); root.setTargetNamespace(name.getNamespaceURI()); root.setTypeDefinition(type);
element.setTypeDefinition(featureType); xsd.getContents().add(element); xsd.updateElement();
decl.setTypeDefinition(type); } else { decl.setTypeDefinition(type);
XSDParticle particle(Attribute att) { XSDFactory factory = XSDFactory.eINSTANCE; AttributeType attType = att.getType(); XSDTypeDefinition xsdType = schemaIndex.getTypeDefinition( new QName( attType.getName().getNamespaceURI(), attType.getName().getLocalPart())); XSDElementDeclaration element = factory.createXSDElementDeclaration(); element.setName(att.getName().getLocalPart()); element.setTargetNamespace(att.getName().getNamespaceURI()); element.setTypeDefinition(xsdType); XSDParticle particle = factory.createXSDParticle(); particle.setContent(element); return particle; } }
attribute.setTypeDefinition(attributeDefinition);
public FeatureTypeContext(SimpleFeature f, GMLDelegate gml) { this.featureType = f.getFeatureType(); QName featureName = new QName( featureType.getName().getNamespaceURI(), featureType.getName().getLocalPart()); // look up the element in the schema XSDElementDeclaration element = encoder.getSchemaIndex().getElementDeclaration(featureName); if (element == null) { // create one element = XSDFactory.eINSTANCE.createXSDElementDeclaration(); element.setName(featureType.getName().getLocalPart()); element.setTargetNamespace(featureType.getName().getNamespaceURI()); element.setTypeDefinition( encoder.getSchemaIndex().getTypeDefinition(GML.AbstractFeatureType)); } // look up all the bindings for each property BindingLoader bindingLoader = encoder.getBindingLoader(); // get all the properties List properties = gml.getFeatureProperties(f, element, encoder); attributes = setupAttributeContexts(properties, featureType, bindingLoader); featureQualifiedName = getFeatureQualifiedName(featureName); }
protected void setElementType(XSDElementDeclaration ed) { ed = ed.getResolvedElementDeclaration(); if (ed != null) { ed.setTypeDefinition(newType); } }
element.setTypeDefinition(itemType);
protected XSDElementDeclaration createElementDeclaration(XSDSchema schema, String name, String type, boolean schemaType) { XSDElementDeclaration elementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); elementDeclaration.setName(name); if (schemaType) { elementDeclaration.setTypeDefinition(schema.getSchemaForSchema().resolveSimpleTypeDefinition(type)); } else { elementDeclaration.setTypeDefinition(schema.resolveSimpleTypeDefinition(type)); } return elementDeclaration; }
@Override protected void setReferenceElementType(EReference reference, XSDElementDeclaration xsdElementDeclaration) { if (reference.getEType() != null) { super.setReferenceElementType(reference, xsdElementDeclaration); } else { importXMI(); xsdElementDeclaration.setTypeDefinition(xsdElementDeclaration.resolveSimpleTypeDefinition(XMI_URI, "Any")); } }
@Override protected void setReferenceElementType(EReference reference, XSDElementDeclaration xsdElementDeclaration) { if (reference.getEType() != null) { super.setReferenceElementType(reference, xsdElementDeclaration); } else { importXMI(); xsdElementDeclaration.setTypeDefinition(xsdElementDeclaration.resolveSimpleTypeDefinition(XMI_URI, "Any")); } }
public void visitElementDeclaration(org.eclipse.xsd.XSDElementDeclaration element) { if (element.getTypeDefinition() == target) { XSDSimpleTypeDefinition type = target.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string"); //$NON-NLS-1$ element.setTypeDefinition(type); } super.visitElementDeclaration(element); } };
protected XSDParticle createXSDElementDeclarationForModelGroupDefinitions() { XSDSimpleTypeDefinition type = xsdModelGroup.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string"); //$NON-NLS-1$ XSDElementDeclaration element = XSDFactory.eINSTANCE.createXSDElementDeclaration(); ArrayList usedAttributeNames = new ArrayList(); usedAttributeNames.addAll(XSDCommonUIUtils.getAllAttributes(xsdModelGroupDefinition)); element.setName(XSDCommonUIUtils.createUniqueElementName( nameToAdd == null ? "NewElement" : nameToAdd , usedAttributeNames)); //$NON-NLS-1$ element.setTypeDefinition(type); XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle(); particle.setContent(element); addedXSDConcreteComponent = element; return particle; }
protected XSDElementDeclaration buildGlobalElement(XSDSchema xsdSchema, EClass eClass) { XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); xsdElementDeclaration.setName(extendedMetaData.getName(eClass)); XSDTypeDefinition xsdTypeDefinition = xsdSchema.resolveTypeDefinitionURI(getURI(eClass)); handleImport(xsdSchema, xsdTypeDefinition); xsdElementDeclaration.setTypeDefinition(xsdTypeDefinition); xsdSchema.getContents().add(xsdElementDeclaration); map(xsdElementDeclaration, eClass); createEcoreAnnotation(xsdElementDeclaration, "ignore", "true"); return xsdElementDeclaration; }
protected XSDElementDeclaration buildGlobalElement(XSDSchema xsdSchema, EClass eClass) { XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); xsdElementDeclaration.setName(extendedMetaData.getName(eClass)); XSDTypeDefinition xsdTypeDefinition = xsdSchema.resolveTypeDefinitionURI(getURI(eClass)); handleImport(xsdSchema, xsdTypeDefinition); xsdElementDeclaration.setTypeDefinition(xsdTypeDefinition); xsdSchema.getContents().add(xsdElementDeclaration); map(xsdElementDeclaration, eClass); createEcoreAnnotation(xsdElementDeclaration, "ignore", "true"); return xsdElementDeclaration; }
protected XSDElementDeclaration createGlobalXSDElementDeclaration() { ensureSchemaElement(xsdSchema); XSDSimpleTypeDefinition type = xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("string"); //$NON-NLS-1$ XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory(); XSDElementDeclaration element = factory.createXSDElementDeclaration(); element.setName(XSDCommonUIUtils.createUniqueElementName( nameToAdd == null ? "NewElement" : nameToAdd , xsdSchema.getElementDeclarations())); //$NON-NLS-1$ element.setTypeDefinition(type); return element; }
static XSDParticle particle(XSDSchema schema, String elementName, String typeNS, String typeName, boolean nillable, int minOccurs, int maxOccurs) { XSDFactory factory = XSDFactory.eINSTANCE; XSDElementDeclaration element = factory.createXSDElementDeclaration(); element.setName(elementName); element.setNillable(nillable); XSDTypeDefinition type = schema.resolveTypeDefinition(typeNS, typeName); element.setTypeDefinition(type); XSDParticle particle = factory.createXSDParticle(); particle.setMinOccurs(minOccurs); particle.setMaxOccurs(maxOccurs); particle.setContent(element); return particle; }
XSDParticle particle(Attribute att) { XSDFactory factory = XSDFactory.eINSTANCE; AttributeType attType = att.getType(); XSDTypeDefinition xsdType = schemaIndex.getTypeDefinition( new QName(attType.getName().getNamespaceURI(), attType.getName().getLocalPart())); XSDElementDeclaration element = factory.createXSDElementDeclaration(); element.setName(att.getName().getLocalPart()); element.setTargetNamespace(att.getName().getNamespaceURI()); element.setTypeDefinition(xsdType); XSDParticle particle = factory.createXSDParticle(); particle.setContent(element); return particle; }