本文整理了Java中org.eclipse.xsd.XSDSchema.resolveSimpleTypeDefinition()
方法的一些代码示例,展示了XSDSchema.resolveSimpleTypeDefinition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSDSchema.resolveSimpleTypeDefinition()
方法的具体详情如下:
包路径:org.eclipse.xsd.XSDSchema
类名称:XSDSchema
方法名:resolveSimpleTypeDefinition
暂无
代码示例来源:origin: org.eclipse/org.eclipse.xsd
public XSDSimpleTypeDefinition resolveSimpleTypeDefinition(String namespace, String localName)
{
XSDSchema xsdSchema = getSchema();
if (xsdSchema != null)
{
return xsdSchema.resolveSimpleTypeDefinition(namespace, localName);
}
else
{
return createUnresolvedSimpleTypeDefinition(namespace, localName);
}
}
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
public XSDSimpleTypeDefinition resolveSimpleTypeDefinition(String namespace, String localName)
{
XSDSchema xsdSchema = getSchema();
if (xsdSchema != null)
{
return xsdSchema.resolveSimpleTypeDefinition(namespace, localName);
}
else
{
return createUnresolvedSimpleTypeDefinition(namespace, localName);
}
}
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
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;
}
代码示例来源:origin: org.eclipse/org.eclipse.xsd
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;
}
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
protected XSDDiagnostic checkBuiltInTypeConstraint
(String builtInTypeName, String value, String part, String anchor, Element element, String attributeName, boolean isRequired)
{
XSDSimpleTypeDefinition builtInType = getSchema().getSchemaForSchema().resolveSimpleTypeDefinition(builtInTypeName);
return checkSimpleTypeConstraint(builtInType, value, part, anchor, element, attributeName, isRequired);
}
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
public XSDSimpleTypeDefinition resolveSimpleTypeDefinition(String localName)
{
XSDSchema xsdSchema = getSchema();
if (xsdSchema != null)
{
return xsdSchema.resolveSimpleTypeDefinition(xsdSchema.getTargetNamespace(), localName);
}
else
{
return createUnresolvedSimpleTypeDefinition(null, localName);
}
}
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
protected void setReferenceAttribType(XSDAttributeDeclaration xsdAttributeDeclaration)
{
addEMFSchema();
xsdAttributeDeclaration.setTypeDefinition(xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition(REFERENCE_TYPE_NAME));
}
代码示例来源:origin: org.eclipse/org.eclipse.xsd
protected XSDDiagnostic checkBuiltInTypeConstraint
(String builtInTypeName, String value, String part, String anchor, Element element, String attributeName, boolean isRequired)
{
XSDSimpleTypeDefinition builtInType = getSchema().getSchemaForSchema().resolveSimpleTypeDefinition(builtInTypeName);
return checkSimpleTypeConstraint(builtInType, value, part, anchor, element, attributeName, isRequired);
}
代码示例来源:origin: org.eclipse/org.eclipse.xsd
protected void setReferenceAttribType(XSDAttributeDeclaration xsdAttributeDeclaration)
{
addEMFSchema();
xsdAttributeDeclaration.setTypeDefinition(xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition(REFERENCE_TYPE_NAME));
}
代码示例来源:origin: org.eclipse/org.eclipse.xsd
public XSDSimpleTypeDefinition resolveSimpleTypeDefinition(String localName)
{
XSDSchema xsdSchema = getSchema();
if (xsdSchema != null)
{
return xsdSchema.resolveSimpleTypeDefinition(xsdSchema.getTargetNamespace(), localName);
}
else
{
return createUnresolvedSimpleTypeDefinition(null, localName);
}
}
代码示例来源:origin: org.eclipse/org.eclipse.xsd
protected void createEMFSchema()
{
emfSchema = XSDFactory.eINSTANCE.createXSDSchema();
emfSchema.setTargetNamespace(EMF_SCHEMA_URI);
emfSchema.setSchemaForSchemaQNamePrefix("xsd");
Map<String, String> namespaces = emfSchema.getQNamePrefixToNamespaceMap();
namespaces.put(EMF_SCHEMA_PREFIX, emfSchema.getTargetNamespace());
namespaces.put(emfSchema.getSchemaForSchemaQNamePrefix(), XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
XSDSimpleTypeDefinition list = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
list.setName(REFERENCE_TYPE_NAME);
XSDSimpleTypeDefinition union = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
union.getMemberTypeDefinitions().add(emfSchema.getSchemaForSchema().resolveSimpleTypeDefinition("IDREF"));
union.getMemberTypeDefinitions().add(emfSchema.getSchemaForSchema().resolveSimpleTypeDefinition("QName"));
union.getMemberTypeDefinitions().add(emfSchema.getSchemaForSchema().resolveSimpleTypeDefinition("anyURI"));
list.setItemTypeDefinition(union);
list.getContents().add(union);
emfSchema.getContents().add(list);
}
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
protected void createEMFSchema()
{
emfSchema = XSDFactory.eINSTANCE.createXSDSchema();
emfSchema.setTargetNamespace(EMF_SCHEMA_URI);
emfSchema.setSchemaForSchemaQNamePrefix("xsd");
Map<String, String> namespaces = emfSchema.getQNamePrefixToNamespaceMap();
namespaces.put(EMF_SCHEMA_PREFIX, emfSchema.getTargetNamespace());
namespaces.put(emfSchema.getSchemaForSchemaQNamePrefix(), XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
XSDSimpleTypeDefinition list = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
list.setName(REFERENCE_TYPE_NAME);
XSDSimpleTypeDefinition union = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
union.getMemberTypeDefinitions().add(emfSchema.getSchemaForSchema().resolveSimpleTypeDefinition("IDREF"));
union.getMemberTypeDefinitions().add(emfSchema.getSchemaForSchema().resolveSimpleTypeDefinition("QName"));
union.getMemberTypeDefinitions().add(emfSchema.getSchemaForSchema().resolveSimpleTypeDefinition("anyURI"));
list.setItemTypeDefinition(union);
list.getContents().add(union);
emfSchema.getContents().add(list);
}
代码示例来源: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
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);
}
};
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
protected XSDParticle createXSDElementDeclarationForComplexType()
{
XSDSimpleTypeDefinition type = xsdModelGroup.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string"); //$NON-NLS-1$
XSDElementDeclaration element = XSDFactory.eINSTANCE.createXSDElementDeclaration();
ArrayList usedAttributeNames = new ArrayList();
usedAttributeNames.addAll(XSDCommonUIUtils.getAllAttributes(xsdComplexTypeDefinition));
usedAttributeNames.addAll(XSDCommonUIUtils.getInheritedAttributes(xsdComplexTypeDefinition));
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;
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
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;
}
代码示例来源:origin: org.eclipse/org.eclipse.xsd
@Override
protected boolean analyze()
{
if (!isAttributeDeclarationReference())
{
XSDSimpleTypeDefinition theTypeDefinition = getTypeDefinition();
if (!isTypeExplicit || theTypeDefinition == null)
{
XSDSimpleTypeDefinition newTypeDefinition = getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("anySimpleType");
if (newTypeDefinition != theTypeDefinition)
{
isTypeExplicit = false;
setTypeDefinitionGen(newTypeDefinition);
}
}
}
return super.analyze();
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
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;
}
代码示例来源:origin: org.eclipse/org.eclipse.xsd
/**
* Each EEnum is mapped to a schema simple type that restricts the string simple type;
* the schema type has an enumeration facet for each EEnumLiteral.
*/
protected void processEnum(EEnum eEnum)
{
XSDSimpleTypeDefinition enumType = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
enumType.setName(getName(eEnum));
enumType.setBaseTypeDefinition(xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("NCName"));
xsdSchema.getContents().add(enumType);
map(enumType, eEnum);
for (EEnumLiteral literal : eEnum.getELiterals())
{
XSDEnumerationFacet facet = XSDFactory.eINSTANCE.createXSDEnumerationFacet();
facet.setLexicalValue(getName(literal));
enumType.getFacetContents().add(facet);
map(facet, literal);
}
}
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
/**
* Each EEnum is mapped to a schema simple type that restricts the string simple type;
* the schema type has an enumeration facet for each EEnumLiteral.
*/
protected void processEnum(EEnum eEnum)
{
XSDSimpleTypeDefinition enumType = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
enumType.setName(getName(eEnum));
enumType.setBaseTypeDefinition(xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("NCName"));
xsdSchema.getContents().add(enumType);
map(enumType, eEnum);
for (EEnumLiteral literal : eEnum.getELiterals())
{
XSDEnumerationFacet facet = XSDFactory.eINSTANCE.createXSDEnumerationFacet();
facet.setLexicalValue(getName(literal));
enumType.getFacetContents().add(facet);
map(facet, literal);
}
}
内容来源于网络,如有侵权,请联系作者删除!