org.eclipse.xsd.XSDAttributeUse类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(10.9k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中org.eclipse.xsd.XSDAttributeUse类的一些代码示例,展示了XSDAttributeUse类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSDAttributeUse类的具体详情如下:
包路径:org.eclipse.xsd.XSDAttributeUse
类名称:XSDAttributeUse

XSDAttributeUse介绍

[英]A representation of the model object 'Attribute Use'.

The following features are supported:

  • org.eclipse.xsd.XSDAttributeUse#isRequired
  • org.eclipse.xsd.XSDAttributeUse#getValue
  • org.eclipse.xsd.XSDAttributeUse#getConstraint
  • org.eclipse.xsd.XSDAttributeUse#getUse
  • org.eclipse.xsd.XSDAttributeUse#getLexicalValue
  • org.eclipse.xsd.XSDAttributeUse#getAttributeDeclaration
  • org.eclipse.xsd.XSDAttributeUse#getContent
    [中]模型对象Attribute Use的表示形式。
    支持以下功能:
    *组织。日食xsd。需要XSDAttributeUse#
    *组织。日食xsd。XSDAttributeUse#getValue
    *组织。日食xsd。XSDAT论坛#getConstraint
    *组织。日食xsd。XSDAttributeUse#getUse
    *组织。日食xsd。XSDAttributeUse#getLexicalValue
    *组织。日食xsd。XSDAT论坛#获取属性声明
    *组织。日食xsd。XSDAT论坛#获取内容

代码示例

代码示例来源:origin: geotools/geotools

attributes.add(use.getAttributeDeclaration());
} else if (content instanceof XSDAttributeGroupDefinition) {
    attributes.add(use.getAttributeDeclaration());

代码示例来源:origin: geotools/geotools

@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;
}

代码示例来源:origin: geotools/geotools

XSDAttributeDeclaration att = attgcontent.getContent();
descriptor =
    createAttributeDescriptor(

代码示例来源:origin: org.eclipse.emf/org.eclipse.xsd.edit

public String getText(Object object, boolean showType)
{
 XSDAttributeUse xsdAttributeUse = ((XSDAttributeUse)object);
 XSDAttributeDeclaration xsdAttributeDeclaration = getDelegate(xsdAttributeUse);
 StringBuffer result  = new StringBuffer();
 if (xsdAttributeDeclaration != null)
 {
  result.append(itemDelegator.getText(xsdAttributeDeclaration));
 }
 if (xsdAttributeUse.isSetConstraint())
 {
  if (result.length() != 0)
  {
   result.append("  ");
  }
  result.append('<');
  result.append(xsdAttributeUse.getConstraint());
  result.append("=\"");
  result.append(xsdAttributeUse.getLexicalValue());
  result.append("\">");
 }
 return result.toString();
}

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

public static XSDAttributeUse createAttributeUse(Node node)
{
 if (XSDConstants.nodeType(node) == XSDConstants.ATTRIBUTE_ELEMENT)
 {
  XSDAttributeUse xsdAttributeUse = XSDFactory.eINSTANCE.createXSDAttributeUse();
  xsdAttributeUse.setElement((Element)node);
  XSDAttributeDeclaration xsdAttributeDeclaration = XSDAttributeDeclarationImpl.createAttributeDeclaration(node);
  xsdAttributeUse.setContent(xsdAttributeDeclaration);
  return xsdAttributeUse;
 }
 return null;
}

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

xsdAttriuteUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL);
canHaveDefault = false;
 xsdAttriuteUse.setConstraint(XSDConstraint.DEFAULT_LITERAL);
 xsdAttriuteUse.setLexicalValue(transformDefaultValue(xsdAttriuteUse.getAttributeDeclaration().getTypeDefinition(), defaultValue));
 XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttriuteUse.getAttributeDeclaration();
 xsdAttributeDeclaration.setConstraint(XSDConstraint.DEFAULT_LITERAL);
 xsdAttributeDeclaration.setLexicalValue(transformDefaultValue(xsdAttributeDeclaration.getTypeDefinition(), defaultValue));

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

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;
}

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

for (XSDAttributeUse xsdAttributeUse : xsdAttributeUses)
 XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttributeUse.getAttributeDeclaration();
 boolean matched = false;
 for (XSDAttributeUse baseXSDAttributeUse :  baseXSDAttributeUses)
  XSDAttributeDeclaration baseXSDAttributeDeclaration = baseXSDAttributeUse.getAttributeDeclaration();
  if (xsdAttributeDeclaration.hasSameNameAndTargetNamespace(baseXSDAttributeDeclaration))
   if (baseXSDAttributeUse.isRequired() && !xsdAttributeUse.isRequired())
 if (baseXSDAttributeUse.isRequired())
    baseXSDAttributeUse.getAttributeDeclaration().getURI());

代码示例来源:origin: org.eclipse/org.eclipse.xsd

xsdAnnotations.add(xsdAttributeUse.getContent().getAnnotation());
XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttributeUse.getAttributeDeclaration();
xsdAnnotations.add(xsdAttributeDeclaration.getAnnotation());
elements.add(xsdAttributeDeclaration.getElement());

代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui

attributeUse.setAttributeDeclaration(attribute);
attributeUse.setContent(attribute);
   list.add(use.getAttributeDeclaration());
 attributeUse.setAttributeDeclaration(attribute);
 attributeUse.setContent(attribute);

代码示例来源:origin: org.eclipse/org.eclipse.xsd

XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttributeUse.getAttributeDeclaration();
extendedMetaData.setFeatureKind(eReference, ExtendedMetaData.ATTRIBUTE_FEATURE);
extendedMetaData.setName(eReference, xsdAttributeDeclaration.getName());
XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttributeUse.getAttributeDeclaration();
extendedMetaData.setFeatureKind(eAttribute, ExtendedMetaData.ATTRIBUTE_FEATURE);
extendedMetaData.setName(eAttribute, xsdAttributeDeclaration.getName());
if (defaultValue == null)
 defaultValue = xsdAttributeUse.getLexicalValue();

代码示例来源:origin: org.eclipse.emf/org.eclipse.xsd.edit

/**
 * This creates an object of type <code>XSDAttributeUse</code> containing
 * an object of type <code>XSDAttributeDeclaration</code> -- if
 * <code>isReference</code> is <code>true</code>, the attribute use
 * content will be a new attribute declaration that resolves to 
 * <code>attributeDeclaration</code>; otherwise, it will be simply
 * <code>attributeDeclaration</code> itself.
 */
protected XSDAttributeUse createAttributeUse(XSDAttributeDeclaration attributeDeclaration, boolean isReference)
{
 XSDAttributeUse au = xsdFactory.createXSDAttributeUse();
 if (isReference)
 {
  XSDAttributeDeclaration ref = xsdFactory.createXSDAttributeDeclaration();
  ref.setResolvedAttributeDeclaration(attributeDeclaration);
  au.setContent(ref);
 }
 else
 {
  au.setContent(attributeDeclaration);
 }
 return au;
}

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

simpleAttributeUse./*{@link XSDAttributeUse#setContent */setContent/*}*/(simpleAttributeDeclarationReference);
simpleAttributeUse.setUse(/*{@link */XSDAttributeUseCategory/*}*/.OPTIONAL_LITERAL);
simpleContentComplexTypeDefinition./*{@link XSDComplexTypeDefinition#getAttributeContents */getAttributeContents/*}*/().add(simpleAttributeUse);

代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui

public void execute()
{
 Element element = component.getElement();
 try
 {
  beginRecording(element);
  String currentMin = element.getAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
  removeMinOccursAttribute = (currentMin == null) ? true : false;
  if (component instanceof XSDParticle)
  {
   oldMinOccurs = ((XSDParticle) component).getMinOccurs();
   ((XSDParticle) component).setMinOccurs(newMinOccurs);
  }
  else if (component instanceof XSDAttributeUse)
  {
   oldMinOccurs = (((XSDAttributeUse) component).getUse() == XSDAttributeUseCategory.REQUIRED_LITERAL ? 1 : 0);
   if (newMinOccurs == 1)
    ((XSDAttributeUse) component).setUse(XSDAttributeUseCategory.REQUIRED_LITERAL);
   else
    ((XSDAttributeUse) component).setUse(XSDAttributeUseCategory.OPTIONAL_LITERAL);
  }
 }
 finally
 {
  endRecording();
 }
}

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

simpleAttributeUseGroupMember./*{@link XSDAttributeUse#setContent */setContent/*}*/(simpleAttributeDeclarationGroupMember);
simpleAttributeUseGroupMember./*{@link XSDAttributeDeclaration#setConstraint */setConstraint/*}*/(/*{@link */XSDConstraint/*}*/.DEFAULT_LITERAL);
simpleAttributeUseGroupMember./*{@link XSDAttributeDeclaration#setLexicalValue */setLexicalValue/*}*/("defaultValue");
simpleAttributeGroupDefinition./*{@link XSDAttributeGroupDefinition#getContents */getContents/*}*/().add(simpleAttributeUseGroupMember);

代码示例来源:origin: org.eclipse.emf/org.eclipse.xsd.edit

if (XSDAttributeUseCategory.REQUIRED_LITERAL != xsdAttributeUse.getUse())
    (XSDAttributeUseCategory.PROHIBITED_LITERAL == xsdAttributeUse.getUse() ?
     "Zero" : 
     XSDAttributeUseCategory.REQUIRED_LITERAL == xsdAttributeUse.getUse() ?
      "One" : 
      "ZeroToOne");

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

protected void setUseToRequired(EAttribute attribute, XSDAttributeUse attrUse)
{
 if (attribute.isRequired())  
 {
  attrUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL);
 }
}

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

((XSDAttributeUse)getContainer()).setAttributeDeclaration(theResolvedAttributeDeclaration);

代码示例来源:origin: org.eclipse/org.eclipse.xsd

xsdAttriuteUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL);
canHaveDefault = false;
 xsdAttriuteUse.setConstraint(XSDConstraint.DEFAULT_LITERAL);
 xsdAttriuteUse.setLexicalValue(defaultValue);
 XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttriuteUse.getAttributeDeclaration();
 xsdAttributeDeclaration.setConstraint(XSDConstraint.DEFAULT_LITERAL);
 xsdAttributeDeclaration.setLexicalValue(defaultValue);

代码示例来源:origin: org.eclipse/org.eclipse.xsd

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;
}

相关文章