org.eclipse.xsd.XSDAttributeUse.getAttributeDeclaration()方法的使用及代码示例

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

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

XSDAttributeUse.getAttributeDeclaration介绍

[英]Returns the value of the 'Attribute Declaration' reference.

This represents the attribute infoset property. It is computed from the #getContent() and should typically not be set directly.
[中]返回“属性声明”引用的值。
这表示attributeinfoset属性。它是根据#getContent()计算的,通常不应直接设置。

代码示例

代码示例来源: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: org.eclipse.emf/org.eclipse.xsd.edit

@Override
 public XSDAttributeDeclaration getDelegate(XSDAttributeUse xsdAttributeUse)
 {
  return xsdAttributeUse.getAttributeDeclaration();
 }
};

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

protected XSDAttributeDeclaration getXSDAttributeDeclaration()
{
 return getXSDAttributeUse().getAttributeDeclaration();
}

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

protected void setAttributeType(XSDAttributeUse attributeUse)
{
 setAttributeType(attributeUse.getAttributeDeclaration());
}

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

/**
 * This tests whether the combination of given <code>localName</code> and
 * <code>targetNamespace</code> is shared by an attribute declaration of
 * an attribute use in the given collection.  Returns <code>false</code>
 * if so, <code>true</code> otherwise.  Note that this method is tolerant
 * of nulls: a result of <code>true</code> is returned if
 * <code>attributeUse</code> is <code>null</code>, and two null strings
 * are considered equal.
 */
protected boolean isUniqueAttributeDeclarationName(String localName, String targetNamespace, Collection<? extends XSDAttributeUse> attributeUses)
{
 if (attributeUses != null)
 {
  for (XSDAttributeUse attributeUse : attributeUses)
  {
   if (attributeUse.getAttributeDeclaration() != null)
   {
    XSDAttributeDeclaration other = 
     attributeUse.getAttributeDeclaration();
    if (other.hasNameAndTargetNamespace(localName, targetNamespace))
    {
     return false;
    }
   }
  }
 }
 return true;
}

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

public String getTextForAttributeUse(XSDAttributeUse attributeUse, boolean showType)
{
 XSDAttributeDeclaration ad = attributeUse.getAttributeDeclaration();
  
 StringBuffer result  = new StringBuffer();
 result.append(getTextForAttribute(ad, showType));
 /*
 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.geotools/gt2-xml-core

public boolean visit(XSDTypeDefinition type) {
    //simple types dont have attributes
    if (type instanceof XSDSimpleTypeDefinition) {
      return true;
    }
    XSDComplexTypeDefinition cType = (XSDComplexTypeDefinition) type;
    //get all the attribute content (groups,or uses) and add to q 
    List attContent = cType.getAttributeContents();
    for (Iterator itr = attContent.iterator(); itr.hasNext();) {
      XSDAttributeGroupContent content = (XSDAttributeGroupContent) itr.next();
      if (content instanceof XSDAttributeUse) {
        //an attribute, add it to the list
        XSDAttributeUse use = (XSDAttributeUse) content;
        attributes.add(use.getAttributeDeclaration());
      } else if (content instanceof XSDAttributeGroupDefinition) {
        //attribute group, add all atts in group to list
        XSDAttributeGroupDefinition attGrp = (XSDAttributeGroupDefinition) content;
        if (attGrp.isAttributeGroupDefinitionReference()) {
          attGrp = attGrp.getResolvedAttributeGroupDefinition();
        }
        List uses = attGrp.getAttributeUses();
        for (Iterator aitr = uses.iterator(); aitr.hasNext();) {
          XSDAttributeUse use = (XSDAttributeUse) aitr.next();
          attributes.add(use.getAttributeDeclaration());
        }
      }
    }
    return true;
  }
};

代码示例来源:origin: org.geotools.xsd/gt-core

public boolean visit(XSDTypeDefinition type) {
    //simple types dont have attributes
    if (type instanceof XSDSimpleTypeDefinition) {
      return true;
    }
    XSDComplexTypeDefinition cType = (XSDComplexTypeDefinition) type;
    //get all the attribute content (groups,or uses) and add to q 
    List attContent = cType.getAttributeContents();
    for (Iterator itr = attContent.iterator(); itr.hasNext();) {
      XSDAttributeGroupContent content = (XSDAttributeGroupContent) itr.next();
      if (content instanceof XSDAttributeUse) {
        //an attribute, add it to the list
        XSDAttributeUse use = (XSDAttributeUse) content;
        attributes.add(use.getAttributeDeclaration());
      } else if (content instanceof XSDAttributeGroupDefinition) {
        //attribute group, add all atts in group to list
        XSDAttributeGroupDefinition attGrp = (XSDAttributeGroupDefinition) content;
        if (attGrp.isAttributeGroupDefinitionReference()) {
          attGrp = attGrp.getResolvedAttributeGroupDefinition();
        }
        List uses = attGrp.getAttributeUses();
        for (Iterator aitr = uses.iterator(); aitr.hasNext();) {
          XSDAttributeUse use = (XSDAttributeUse) aitr.next();
          attributes.add(use.getAttributeDeclaration());
        }
      }
    }
    return true;
  }
};

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

private void updateNames(XSDComplexTypeDefinition ct)
{
 Iterator iter = ct.getAttributeContents().iterator();
 while (iter.hasNext())
 {
  Object obj = iter.next();
  if (obj instanceof XSDAttributeUse)
  {
   XSDAttributeUse use = (XSDAttributeUse) obj;
   XSDAttributeDeclaration attr = use.getAttributeDeclaration();
   String attrName = attr.getName();
   if (attrName != null)
   {
    names.add(attrName);
   }
  }
 }
}

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

public void visitAttributeGroupDefinition(XSDAttributeGroupDefinition attributeGroup)
{
 for (Iterator it = attributeGroup.getContents().iterator(); it.hasNext(); )
 {
  Object o = it.next();
  if (o instanceof XSDAttributeUse)
  {
   XSDAttributeUse attributeUse = (XSDAttributeUse)o;
   concreteComponentList.add(attributeUse.getAttributeDeclaration());
   thingsWeNeedToListenTo.add(attributeUse.getAttributeDeclaration());
  }
  else if (o instanceof XSDAttributeGroupDefinition)
  {
   XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition)o;
   thingsWeNeedToListenTo.add(attrGroup);
   if (attrGroup.isAttributeGroupDefinitionReference())
   {
    attrGroup = attrGroup.getResolvedAttributeGroupDefinition();
    visitAttributeGroupDefinition(attrGroup);
   }
  }
 }
}

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

protected static Map<String, XSDAttributeDeclaration> getProhibitedAttributes(Collection<XSDAttributeGroupContent> xsdAttributeContents)
{
 Map<String, XSDAttributeDeclaration> result = new HashMap<String, XSDAttributeDeclaration>();
 for (XSDAttributeGroupContent xsdAttributeGroupContent :  xsdAttributeContents)
 {
  if (xsdAttributeGroupContent instanceof XSDAttributeGroupDefinition)
  {
   XSDAttributeGroupDefinition xsdAttributeGroupDefinition = (XSDAttributeGroupDefinition)xsdAttributeGroupContent;
   result.putAll(getProhibitedAttributes(xsdAttributeGroupDefinition.getContents()));
  }
  else
  {
   XSDAttributeUse xsdAttributeUse = (XSDAttributeUse)xsdAttributeGroupContent;
   if (xsdAttributeUse.getUse() == XSDAttributeUseCategory.PROHIBITED_LITERAL)
   {
    XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttributeUse.getAttributeDeclaration();
    result.put(xsdAttributeDeclaration.getURI(), xsdAttributeDeclaration);
   }
  }
 }
 return result;
}

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

public void visitAttributeGroupDefinition(XSDAttributeGroupDefinition attributeGroup)
{
 for (Iterator it = attributeGroup.getContents().iterator(); it.hasNext();)
 {
  Object o = it.next();
  if (o instanceof XSDAttributeUse)
  {
   XSDAttributeUse attributeUse = (XSDAttributeUse) o;
   concreteComponentList.add(attributeUse.getAttributeDeclaration());
   thingsWeNeedToListenTo.add(attributeUse.getAttributeDeclaration());
  }
  else if (o instanceof XSDAttributeGroupDefinition)
  {
   XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition) o;
   thingsWeNeedToListenTo.add(attrGroup);
   if (attrGroup.isAttributeGroupDefinitionReference())
   {
    attrGroup = attrGroup.getResolvedAttributeGroupDefinition();
    if (attrGroup.getContents().size() == 0)
    {
     concreteComponentList.add(new SpaceFiller("attribute")); //$NON-NLS-1$
    }
    visitAttributeGroupDefinition(attrGroup);
   }
  }
 }
}

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

protected static Map<String, XSDAttributeDeclaration> getProhibitedAttributes(Collection<XSDAttributeGroupContent> xsdAttributeContents)
{
 Map<String, XSDAttributeDeclaration> result = new HashMap<String, XSDAttributeDeclaration>();
 for (XSDAttributeGroupContent xsdAttributeGroupContent :  xsdAttributeContents)
 {
  if (xsdAttributeGroupContent instanceof XSDAttributeGroupDefinition)
  {
   XSDAttributeGroupDefinition xsdAttributeGroupDefinition = (XSDAttributeGroupDefinition)xsdAttributeGroupContent;
   result.putAll(getProhibitedAttributes(xsdAttributeGroupDefinition.getContents()));
  }
  else
  {
   XSDAttributeUse xsdAttributeUse = (XSDAttributeUse)xsdAttributeGroupContent;
   if (xsdAttributeUse.getUse() == XSDAttributeUseCategory.PROHIBITED_LITERAL)
   {
    XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttributeUse.getAttributeDeclaration();
    result.put(xsdAttributeDeclaration.getURI(), xsdAttributeDeclaration);
   }
  }
 }
 return result;
}

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

localAttributeUses.add(xsdAttributeUse.getAttributeDeclaration().getURI());
if (!localAttributeUses.contains(xsdAttributeUse.getAttributeDeclaration().getURI()))

代码示例来源:origin: org.geotools/gt-app-schema

/**
 * 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>&lt;xs:attribute ref=&quot;gml:id&quot; use=&quot;required&quot; /&gt;</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;
}

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

@Override
protected void validateValue()
{
 XSDSimpleTypeDefinition whiteSpaceEnumeration = 
  ((XSDAttributeUse)
   ((XSDComplexTypeDefinition)
     getSimpleTypeDefinition().
     getSchema().
     getSchemaForSchema().  
     resolveElementDeclaration("whiteSpace").
     getTypeDefinition()).
    getAttributeContents().get(0)).
   getAttributeDeclaration().getTypeDefinition();
 checkSimpleTypeConstraint
  (whiteSpaceEnumeration,
   getLexicalValue(),
   XSDConstants.PART2,
   "element-whiteSpace",
   getElement(),
   XSDConstants.VALUE_ATTRIBUTE,
   true);
}

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

@Override
protected void validateValue()
{
 XSDSimpleTypeDefinition whiteSpaceEnumeration = 
  ((XSDAttributeUse)
   ((XSDComplexTypeDefinition)
     getSimpleTypeDefinition().
     getSchema().
     getSchemaForSchema().  
     resolveElementDeclaration("whiteSpace").
     getTypeDefinition()).
    getAttributeContents().get(0)).
   getAttributeDeclaration().getTypeDefinition();
 checkSimpleTypeConstraint
  (whiteSpaceEnumeration,
   getLexicalValue(),
   XSDConstants.PART2,
   "element-whiteSpace",
   getElement(),
   XSDConstants.VALUE_ATTRIBUTE,
   true);
}

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

public static class FeatureIteratorImpl extends EContentsEList.FeatureIteratorImpl<XSDConcreteComponent>
 {
  public FeatureIteratorImpl(EObject eObject)
  {
   super(eObject, (EStructuralFeature [])((BasicEList<?>)eObject.eClass().getEAllReferences()).data());
  }
  public FeatureIteratorImpl(EObject eObject, EStructuralFeature [] eStructuralFeatures)
  {
   super(eObject, eStructuralFeatures);
  }
  @Override
  protected boolean isIncluded(EStructuralFeature eStructuralFeature)
  {
   EReference eReference = (EReference)eStructuralFeature;
   return !eReference.isTransient();
  }
 }
}

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

public static class FeatureIteratorImpl extends EContentsEList.FeatureIteratorImpl<XSDConcreteComponent>
 {
  public FeatureIteratorImpl(EObject eObject)
  {
   super(eObject, (EStructuralFeature [])((BasicEList<?>)eObject.eClass().getEAllReferences()).data());
  }
  public FeatureIteratorImpl(EObject eObject, EStructuralFeature [] eStructuralFeatures)
  {
   super(eObject, eStructuralFeatures);
  }
  @Override
  protected boolean isIncluded(EStructuralFeature eStructuralFeature)
  {
   EReference eReference = (EReference)eStructuralFeature;
   return !eReference.isTransient();
  }
 }
}

相关文章