本文整理了Java中org.eclipse.xsd.XSDFactory
类的一些代码示例,展示了XSDFactory
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSDFactory
类的具体详情如下:
包路径:org.eclipse.xsd.XSDFactory
类名称:XSDFactory
[英]The Factory for the model. It provides a create method for each non-abstract class of the model.
[中]这家工厂生产这种模型。它为模型的每个非抽象类提供了一个创建方法。
代码示例来源:origin: geotools/geotools
for (Iterator itr = schema.getQNamePrefixToNamespaceMap().entrySet().iterator();
itr.hasNext(); ) {
Map.Entry entry = (Map.Entry) itr.next();
namespaces.declarePrefix("", schema.getTargetNamespace());
root = XSDFactory.eINSTANCE.createXSDElementDeclaration();
root.setName(name.getLocalPart());
root.setTargetNamespace(name.getNamespaceURI());
root.setTypeDefinition(type);
String local = attribute.getName();
if ((entry.encoding.getAttributeNS(ns, local) != null)
&& !"".equals(entry.encoding.getAttributeNS(ns, local))) {
continue;
entry.encoding.setAttributeNodeNS(attr);
XSDParticle particle = (XSDParticle) tuple[0];
XSDElementDeclaration child =
(XSDElementDeclaration) particle.getContent();
if (particle.getMinOccurs() == 0) {
if (particle.isSetMaxOccurs()) {
maxOccurs = particle.getMaxOccurs();
} else {
代码示例来源:origin: geotools/geotools
for (Iterator itr = children.iterator(); itr.hasNext(); ) {
XSDParticle particle = (XSDParticle) itr.next();
XSDElementDeclaration child = (XSDElementDeclaration) particle.getContent();
if (child.isElementDeclarationReference()) {
child = child.getResolvedElementDeclaration();
comment.appendChild(
encoder.getDocument().createTextNode(v.next().toString()));
XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
XSDFactory.eINSTANCE.createXSDElementDeclaration();
elementDecl.setTargetNamespace(Encoder.COMMENT.getNamespaceURI());
elementDecl.setName(Encoder.COMMENT.getLocalPart());
elementDecl.setElement(comment);
particle.setContent(elementDecl);
particles.put(name, particle);
.resolveElementDeclaration(
name.getNamespaceURI(), name.getLocalPart());
XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
XSDElementDeclaration wrapper = XSDFactory.eINSTANCE.createXSDElementDeclaration();
wrapper.setResolvedElementDeclaration(elementDecl);
particle.setContent(wrapper);
代码示例来源:origin: geotools/geotools
decl = XSDFactory.eINSTANCE.createXSDAttributeDeclaration();
decl.setName(attQName.getLocalPart());
decl.setTargetNamespace(attQName.getNamespaceURI());
(XSDSimpleTypeDefinition)
XSDUtil.getSchemaForSchema(XSDUtil.SCHEMA_FOR_SCHEMA_URI_2001)
.getSimpleTypeIdMap()
.get("string");
代码示例来源:origin: geotools/geotools
@SuppressWarnings("unchecked")
protected XSDSchema xsd(SimpleFeatureType simpleFeatureType) throws IOException {
XSDFactory factory = XSDFactory.eINSTANCE;
XSDSchema xsd = factory.createXSDSchema();
xsd.setSchemaForSchemaQNamePrefix("xsd");
xsd.getQNamePrefixToNamespaceMap().put("xsd", XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
xsd.setElementFormDefault(XSDForm.get(XSDForm.QUALIFIED));
XSDImport gml = factory.createXSDImport();
gml.setNamespace(gmlNamespace);
gml.setSchemaLocation(baseURL.toString() + "/" + gmlLocation);
gml.setResolvedSchema(gmlConfiguration.getXSD().getSchema());
xsd.getContents().add(gml);
xsd.getQNamePrefixToNamespaceMap().put("gml", gmlNamespace);
xsd.getQNamePrefixToNamespaceMap().put("gml", "http://www.opengis.net/gml");
XSDElementDeclaration element = factory.createXSDElementDeclaration();
element.setName(simpleFeatureType.getTypeName());
XSDElementDeclaration _FEATURE = xsd.resolveElementDeclaration(gmlNamespace, "_Feature");
element.setSubstitutionGroupAffiliation(_FEATURE);
element.setTypeDefinition(featureType);
xsd.getContents().add(element);
xsd.updateElement();
return xsd;
代码示例来源:origin: geotools/geotools
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;
}
}
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
/*{@link */XSDComplexTypeDefinition/*}*/ simpleRecursiveComplexTypeDefinition = xsdFactory.createXSDComplexTypeDefinition();
simpleRecursiveComplexTypeDefinition./*{@link XSDNamedComponent#getName */setName/*}*/("SimpleRecursiveComplexTypeDefinition");
simpleRecursiveComplexTypeDefinition./*{@link XSDComplexTypeDefinition#setAbstract */setAbstract/*}*/(false);
simpleRecursiveComplexTypeDefinition./*{@link XSDComplexTypeDefinition#getBlock */getBlock/*}*/().add(/*{@link */XSDProhibitedSubstitutions/*}*/.ALL_LITERAL);
simpleRecursiveComplexTypeDefinition./*{@link XSDComplexTypeDefinition#getLexicalFinal */getLexicalFinal/*}*/().add(/*{@link */XSDComplexFinal/*}*/.ALL_LITERAL);
simpleRecursiveComplexTypeDefinition./*{@link XSDComplexTypeDefinition#setDerivationMethod */setDerivationMethod/*}*/(/*{@link */XSDDerivationMethod/*}*/.RESTRICTION_LITERAL);
simpleRecursiveComplexTypeDefinition./*{@link XSDComplexTypeDefinition#setMixed */setMixed/*}*/(true);
/*{@link */XSDAnnotation/*}*/ annotation = xsdFactory.createXSDAnnotation();
simpleRecursiveComplexTypeDefinition./*{@link XSDComplexTypeDefinition#setAnnotation */setAnnotation/*}*/(annotation);
/*{@link */XSDModelGroupDefinition/*}*/ simpleRecursiveModelGroupDefinitionReference = xsdFactory.createXSDModelGroupDefinition();
simpleRecursiveModelGroupDefinitionReference./*{@link XSDModelGroupDefinition#setResolvedModelGroupDefinition */setResolvedModelGroupDefinition/*}*/
(prototypeSchema./*{@link XSDConcreteComponent#resolveModelGroupDefinition(String) */resolveModelGroupDefinition/*}*/("simpleRecursiveModelGroupDefinition"));
/*{@link */XSDParticle/*}*/ modelGroupParticle = xsdFactory.createXSDParticle();
modelGroupParticle./*{@link XSDParticle#setContent */setContent/*}*/(simpleRecursiveModelGroupDefinitionReference);
simpleRecursiveComplexTypeDefinition./*{@link XSDComplexTypeDefinition#setContent */setContent/*}*/(modelGroupParticle);
/*{@link */XSDAttributeDeclaration/*}*/ simpleAttributeDeclarationReference = xsdFactory.createXSDAttributeDeclaration();
simpleAttributeDeclarationReference./*{@link XSDAttributeDeclaration#setResolvedAttributeDeclaration */setResolvedAttributeDeclaration/*}*/
(prototypeSchema./*{@link XSDConcreteComponent#resolveAttributeDeclaration */resolveAttributeDeclaration/*}*/("simpleAttributeDeclaration"));
/*{@link */XSDAttributeUse/*}*/ simpleAttributeUse = xsdFactory.createXSDAttributeUse();
simpleAttributeUse./*{@link XSDAttributeUse#setContent */setContent/*}*/(simpleAttributeDeclarationReference);
simpleAttributeUse./*{@link XSDAttributeUse#setUse */setUse/*}*/(/*{@link */XSDAttributeUseCategory/*}*/.OPTIONAL_LITERAL);
simpleRecursiveComplexTypeDefinition./*{@link XSDComplexTypeDefinition#getAttributeContents */getAttributeContents/*}*/().add(simpleAttributeUse);
/*{@link */XSDAttributeGroupDefinition/*}*/ simpleAttributeGroupDefinitionReference = xsdFactory.createXSDAttributeGroupDefinition();
simpleAttributeGroupDefinitionReference./*{@link XSDAttributeGroupDefinition#setResolvedAttributeGroupDefinition */setResolvedAttributeGroupDefinition/*}*/
(prototypeSchema./*{@link XSDConcreteComponent#resolveAttributeGroupDefinition(String) */resolveAttributeGroupDefinition/*}*/("simpleAttributeGroupDefinition"));
代码示例来源:origin: org.eclipse/org.eclipse.xsd
if (element.getLocalName().equals("schema") &&
/*{@link */XSDConstants/*}*/./*{@link XSDConstants#isSchemaForSchemaNamespace */isSchemaForSchemaNamespace/*}*/(element.getNamespaceURI()))
/*{@link */XSDSchema/*}*/ xsdSchema = XSDFactory.eINSTANCE./*{@link XSDFactory#createXSDSchema */createXSDSchema/*}*/();
xsdSchema./*{@link XSDConcreteComponent#setElement */setElement/*}*/(element);
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
protected XSDParticle createXSDElementReference()
{
List list = xsdModelGroup.getSchema().getElementDeclarations();
XSDElementDeclaration referencedElement = null;
if (list.size() > 0)
{
referencedElement = (XSDElementDeclaration)list.get(0);
}
else
{
referencedElement = createGlobalXSDElementDeclaration();
Text textNode = xsdSchema.getDocument().createTextNode("\n"); //$NON-NLS-1$
xsdSchema.getElement().appendChild(textNode);
xsdSchema.getContents().add(referencedElement);
}
XSDElementDeclaration element = XSDFactory.eINSTANCE.createXSDElementDeclaration();
element.setResolvedElementDeclaration(referencedElement);
XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
particle.setContent(element);
addedXSDConcreteComponent = element;
return particle;
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
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;
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
beginRecording(xsdSchema.getElement());
XSDElementDeclaration element = createGlobalXSDElementDeclaration();
Text textNode = xsdSchema.getDocument().createTextNode("\n"); //$NON-NLS-1$
xsdSchema.getElement().appendChild(textNode);
xsdSchema.getContents().add(element);
addedXSDConcreteComponent = element;
XSDParticle particle = factory.createXSDParticle();
xsdModelGroup = factory.createXSDModelGroup();
xsdModelGroup.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
particle.setContent(xsdModelGroup);
xsdModelGroupDefinition.setModelGroup(xsdModelGroup);
if (!isReference)
xsdModelGroup.getContents().add(createXSDElementDeclarationForModelGroupDefinitions());
xsdModelGroup.getContents().add(createXSDElementReference());
XSDParticle particle = factory.createXSDParticle();
xsdModelGroup = factory.createXSDModelGroup();
xsdModelGroup.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
particle.setContent(xsdModelGroup);
xsdComplexTypeDefinition.setContent(particle);
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
XSDComplexTypeDefinition complexType = factory.createXSDComplexTypeDefinition();
addedXSDConcreteComponent = complexType;
String newName = getNewName(nameToAdd == null ? "NewXSDComplexType" : nameToAdd, parent.getSchema()); //$NON-NLS-1$
Text textNode = xsdSchema.getDocument().createTextNode("\n"); //$NON-NLS-1$
xsdSchema.getElement().appendChild(textNode);
xsdSchema.getContents().add(complexType);
((XSDElementDeclaration) parent).setAnonymousTypeDefinition(complexType);
formatChild(parent.getElement());
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
schema = XSDFactory.eINSTANCE.createXSDSchema();
resourceSet = XSDSchemaImpl.createResourceSet();
resourceSet.getAdapterFactories().add(new XSDSchemaLocationResolverAdapterFactory());
schema = XSDFactory.eINSTANCE.createXSDSchema();
resource.getContents().add(schema);
resourceSet.getResources().add(resource);
schema.setDocument(document);
final Element element = document.getDocumentElement();
if (element != null)
String schemaForSchemaNamespace = element.getNamespaceURI();
XSDSchemaImpl.getSchemaForSchema(schemaForSchemaNamespace);
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
protected void addImport(String namespace, String schemaLocation)
{
XSDImport xsdImport = XSDFactory.eINSTANCE.createXSDImport();
xsdImport.setNamespace(namespace);
xsdImport.setSchemaLocation(schemaLocation);
xsdSchema.getContents().add(0, xsdImport);
}
代码示例来源:origin: geotools/geotools
XSDFactory factory = XSDFactory.eINSTANCE;
XSDComplexTypeDefinition definition = factory.createXSDComplexTypeDefinition();
definition.setName(type.getName().getLocalPart());
definition.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
XSDModelGroup attributes = factory.createXSDModelGroup();
attributes.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
XSDElementDeclaration attribute = factory.createXSDElementDeclaration();
attribute.setName(attributeDescriptor.getLocalName());
attribute.setNillable(attributeDescriptor.isNillable());
if (xsd.resolveTypeDefinition(name.getNamespaceURI(), name.getLocalPart())
== null) {
XSDParticle particle = factory.createXSDParticle();
particle.setMinOccurs(attributeDescriptor.getMinOccurs());
particle.setMaxOccurs(attributeDescriptor.getMaxOccurs());
particle.setContent(attribute);
attributes.getContents().add(particle);
XSDParticle contents = factory.createXSDParticle();
contents.setContent(attributes);
xsd.getContents().add(definition);
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
protected void makeReferenceAttribute(EReference reference, XSDComplexTypeDefinition xsdComplexTypeDefinition)
{
XSDAttributeDeclaration attrDecl = XSDFactory.eINSTANCE.createXSDAttributeDeclaration();
attrDecl.setName(getName(reference));
setReferenceAttribType(attrDecl);
XSDAttributeUse attrUse = XSDFactory.eINSTANCE.createXSDAttributeUse();
attrUse.setContent(attrDecl);
xsdComplexTypeDefinition.getAttributeContents().add(attrUse);
map(attrUse, reference);
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
XSDConcreteComponent elementDecl = ((XSDElementDeclaration)getModelObject()).cloneConcreteComponent(true, true);
container.getSchema().getContents().add(elementDecl);
XSDFactory.eINSTANCE.createXSDElementDeclaration();
elementRef.setValue(element.getValue());
elementRef.setResolvedElementDeclaration((XSDElementDeclaration)elementDecl);
XSDModelGroup modelGroup = (XSDModelGroup)container;
int index = modelGroup.getContents().indexOf(parent);
XSDParticle particle =
XSDFactory.eINSTANCE.createXSDParticle();
particle.setContent(elementRef);
modelGroup.getContents().add(index, particle);
if (parentParticle.isSetMinOccurs()) {
particle.setMinOccurs(parentParticle.getMinOccurs());
parentParticle.unsetMinOccurs();
container.getSchema().updateElement(true);
formatChild(elementDecl.getElement());
代码示例来源:origin: geotools/geotools
XSDComplexTypeDefinition type = f.createXSDComplexTypeDefinition();
type.setTargetNamespace(featureType.getName().getNamespaceURI());
type.setName(featureType.getTypeName() + "Type");
type.setBaseTypeDefinition(schemaIndex.getTypeDefinition(gml.qName("AbstractFeatureType")));
XSDModelGroup group = f.createXSDModelGroup();
group.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
XSDElementDeclaration element = f.createXSDElementDeclaration();
element.setName(attribute.getLocalName());
element.setNillable(attribute.isNillable());
XSDParticle particle = f.createXSDParticle();
particle.setMinOccurs(attribute.getMinOccurs());
particle.setMaxOccurs(attribute.getMaxOccurs());
particle.setContent(element);
particle.setElement(
dom.createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "element"));
group.getContents().add(particle);
XSDParticle particle = f.createXSDParticle();
particle.setContent(group);
particle.setElement(
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
protected void addElementDeclarationReference(XSDSchema schema, XSDModelGroup modelGroup, String reference)
{
XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
XSDElementDeclaration elementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration();
elementDeclaration.setResolvedElementDeclaration(schema.resolveElementDeclaration(reference));
particle.setContent(elementDeclaration);
modelGroup.getContents().add(particle);
}
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
protected void makeReferenceElement(EReference reference, XSDComplexTypeDefinition xsdComplexTypeDefinition)
{
XSDModelGroup modelGroup = getModelGroup(xsdComplexTypeDefinition);
XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration();
xsdElementDeclaration.setName(getName(reference));
if (reference.isUnsettable() && !reference.isMany())
{
xsdElementDeclaration.setNillable(true);
}
setReferenceElementType(reference, xsdElementDeclaration);
XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
particle.setContent(xsdElementDeclaration);
setReferenceElementMultiplicity(reference, particle);
modelGroup.getContents().add(particle);
map(particle, reference);
}
代码示例来源:origin: org.eclipse/org.eclipse.xsd
protected void importXMI()
{
Map<String, String> namespaces = this.xsdSchema.getQNamePrefixToNamespaceMap();
if (namespaces.put(XMI_PREFIX, XMI_URI) == null)
{
XSDImport xmiImport = XSDFactory.eINSTANCE.createXSDImport();
xmiImport.setNamespace(XMI_URI);
xmiImport.setSchemaLocation(EcorePackage.eNS_URI.equals(xsdSchema.getTargetNamespace()) ? XMI_SCHEMA_LOCATION : "platform:/plugin/org.eclipse.emf.ecore/model/" + XMI_SCHEMA_LOCATION);
this.xsdSchema.getContents().add(0, xmiImport);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!