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

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

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

XSDAttributeDeclaration介绍

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

The following features are supported:

  • org.eclipse.xsd.XSDAttributeDeclaration#isAttributeDeclarationReference
  • org.eclipse.xsd.XSDAttributeDeclaration#getAnnotation
  • org.eclipse.xsd.XSDAttributeDeclaration#getAnonymousTypeDefinition
  • org.eclipse.xsd.XSDAttributeDeclaration#getTypeDefinition
  • org.eclipse.xsd.XSDAttributeDeclaration#getResolvedAttributeDeclaration
    [中]模型对象Attribute Declaration的表示形式。
    支持以下功能:
    *组织。日食xsd。XSDATAttributedEclaration#是一种指定的EclarationReference
    *组织。日食xsd。XSDATAttributedEclaration#getAnnotation
    *组织。日食xsd。XSDATAttributedEclaration#getAnonymousTypeDefinition
    *组织。日食xsd。XSDATAttributedEclaration#getTypeDefinition
    *组织。日食xsd。XSDATAttributedEclaration#getResolvedAttributeDeclaration

代码示例

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

decl.setName(attQName.getLocalPart());
  decl.setTargetNamespace(attQName.getNamespaceURI());
              .get("string");
  decl.setTypeDefinition(type);
att.setNamespace(decl.getTargetNamespace());
att.setName(decl.getName());
att.setText(attributes.getValue(i));

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

for (Iterator itr = atts.iterator(); itr.hasNext();) {
        XSDAttributeDeclaration attribute = (XSDAttributeDeclaration) itr.next();
        if ( attribute.isAttributeDeclarationReference() ) {
          attribute = attribute.getResolvedAttributeDeclaration();
        XSDSimpleTypeDefinition type = attribute.getTypeDefinition();
        if (type == null) {
            if (Utilities.equals(ad.getTargetNamespace(), attribute.getTargetNamespace()) 
              && Utilities.equals(ad.getName(), attribute.getName())) {
              type = ad.getTypeDefinition();
              break;
        if ( "uom".equals( attribute.getName() ) ) {
          System.out.println();

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

public AttributeEncodeExecutor(
    Object object, XSDAttributeDeclaration attribute, Document document, Logger logger) {
  this.object = object;
  this.attribute = attribute;
  this.document = document;
  this.logger = logger;
  encoding = document.createAttributeNS(attribute.getTargetNamespace(), attribute.getName());
}

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

if ( attribute.getAnonymousTypeDefinition() != null ) {
  attribute.getAnonymousTypeDefinition().setName( "_" + attribute.getName() );
  anonymous.add( attribute.getAnonymousTypeDefinition() );

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

simpleAttributeDeclaration./*{@link XSDNamedComponent#setName */setName/*}*/("simpleAttributeDeclaration");
simpleAttributeDeclaration./*{@link XSDAttributeDeclaration#setTypeDefinition */setTypeDefinition/*}*/
 (prototypeSchema.resolveSimpleTypeDefinition(/*{@link #*/someOtherSchemaURI/*}*/, "someOtherTypeDefinition"));
simpleAttributeDeclaration./*{@link XSDAttributeDeclaration#setConstraint */setConstraint/*}*/(/*{@link */XSDConstraint/*}*/.DEFAULT_LITERAL);
simpleAttributeDeclaration./*{@link XSDAttributeDeclaration#setLexicalValue */setLexicalValue/*}*/("defaultValue");

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

public String getTextForAttribute(XSDAttributeDeclaration ad, boolean showType)
{
 ad = ad.getResolvedAttributeDeclaration();
 String name = ad.getName();
 StringBuffer result = new StringBuffer();
 if (name == null)
 {
  result.append(" " + Messages._UI_LABEL_ABSENT + " ");  //$NON-NLS-1$ //$NON-NLS-2$
 }
 else
 {
  result.append(name);
 }
 if (ad.getAnonymousTypeDefinition() == null && ad.getTypeDefinition() != null)
 {
  result.append(" : "); //$NON-NLS-1$
  // result.append(resolvedAttributeDeclaration.getTypeDefinition().getQName(xsdAttributeDeclaration));
  result.append(ad.getTypeDefinition().getName());
 }
 return result.toString();
}

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

XSDAttributeDeclaration attrDecl = attrUse.getContent();
if (attrDecl != null && attrDecl.isAttributeDeclarationReference())
       if (attrDecl.getResolvedAttributeDeclaration().getTargetNamespace() != null)
  if (attrDecl.getResolvedAttributeDeclaration().getTargetNamespace().equals(oldNS))
   attrDecl.getResolvedAttributeDeclaration().setTargetNamespace(newNS);
           attrDecl.getResolvedAttributeDeclaration().setTargetNamespace(newNS);

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

attrDecl.setName(localName);
 attrDecl.setResolvedAttributeDeclaration((XSDAttributeDeclaration)type);
 attrDecl.setTypeDefinition
  (component.getSchema().resolveSimpleTypeDefinition((String)type));

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

xsdAttributeDeclaration.setResolvedAttributeDeclaration(referencedXSDAttributeDeclaration);
xsdAttributeDeclaration.setName(name);
 xsdAttributeDeclaration.setForm(XSDForm.QUALIFIED_LITERAL);
  !XSDConstants.isOrIsDerivedFromID(xsdAttributeDeclaration.getTypeDefinition()))

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

public XSDTypeDefinition getTypeDefinition() {
  return decl.getTypeDefinition();
}

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

@Override
 public String getText(Object object)
 {
  XSDAttributeDeclaration xsdAttributeDeclaration = ((XSDAttributeDeclaration)object);
  XSDAttributeDeclaration resolvedXSDAttributeDeclaration = xsdAttributeDeclaration.getResolvedAttributeDeclaration();
  String result = resolvedXSDAttributeDeclaration.getName();
  return result == null ? XSDEditPlugin.INSTANCE.getString("_UI_Absent_label") : result;
 }
};

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

child.setName(name); 
 if (namespace != null)
  child.setTargetNamespace(namespace);
 child.setResolvedAttributeDeclaration(child);
child.setTypeDefinition(parent.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string"));
return child;

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

protected XSDAttributeDeclaration createUnresolvedAttributeDeclaration(String namespace, String localName)
{
 XSDAttributeDeclaration xsdAttributeDeclaration = XSDFactory.eINSTANCE.createXSDAttributeDeclaration();
 if (localName != null)
 {
  xsdAttributeDeclaration.setName(localName);
 }
 if (namespace != null)
 {
  xsdAttributeDeclaration.setTargetNamespace(namespace);
 }
 xsdAttributeDeclaration.setResolvedAttributeDeclaration(xsdAttributeDeclaration);
 return xsdAttributeDeclaration;
}

代码示例来源: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

if (input instanceof XSDAttributeDeclaration)
 XSDAttributeDeclaration namedComponent = ((XSDAttributeDeclaration) input).getResolvedAttributeDeclaration();
 String oldName = namedComponent.getName();
 if (!newValue.equals(oldName))
  String qname = attrRef.getResolvedAttributeDeclaration().getQName();
  attrRef.getElement().setAttribute(XSDConstants.REF_ATTRIBUTE, qname);

代码示例来源: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: geotools/geotools

String msg =
    "Encode failed for "
        + attribute.getName()
        + ". Cause: "
        + t.getLocalizedMessage();

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

public Object caseXSDAttributeDeclaration(XSDAttributeDeclaration attributeDeclaration)
{
 XSDConcreteComponent target = null;
 if (attributeDeclaration.isAttributeDeclarationReference())
 {
  target = attributeDeclaration.getResolvedAttributeDeclaration();
 }
 else if (attributeDeclaration.getAnonymousTypeDefinition() == null)
 {
  target = attributeDeclaration.getTypeDefinition();
  // Avoid navigating to built in data types.
  if (isFromSchemaForSchema(target))
  {
   target = null;
  }
 }
 return target;
}

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

@Override
public void setPropertyValue(Object o, Object value)
 {
  XSDAttributeDeclaration xsdAttributeDeclaration = (XSDAttributeDeclaration)o;
  if (xsdAttributeDeclaration.isAttributeDeclarationReference())
  {
   XSDAttributeDeclaration newResolvedAttributeDeclaration =
    xsdAttributeDeclaration.resolveAttributeDeclaration(xsdAttributeDeclaration.getTargetNamespace(), (String)value);
   EditingDomain editingDomain = getEditingDomain(xsdAttributeDeclaration);
   if (editingDomain == null)
   {
    xsdAttributeDeclaration.setResolvedAttributeDeclaration(newResolvedAttributeDeclaration);
   }
   else
   {
    editingDomain.getCommandStack().execute
     (SetCommand.create
      (editingDomain,
       xsdAttributeDeclaration,
       xsdPackage.getXSDAttributeDeclaration_ResolvedAttributeDeclaration(),
       newResolvedAttributeDeclaration));
   }
  }
  else
  {
   super.setPropertyValue(o, value);
  }
 }
});

相关文章

微信公众号

最新文章

更多