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

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

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

XSDSchema.getElementDeclarations介绍

[英]Returns the value of the 'Element Declarations' reference list. The list contents are of type org.eclipse.xsd.XSDElementDeclaration.

This represents the element declarations infoset property. It is computed from the #getContents() and should typically not be set directly.
[中]返回“元素声明”引用列表的值。列表内容的类型为org。日食xsd。XSDElementDeclaration。
这表示element declarationsinfoset属性。它是根据#getContents()计算的,通常不应直接设置。

代码示例

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

for (Iterator e = schema.getElementDeclarations().iterator(); e.hasNext(); ) {
  XSDElementDeclaration element = (XSDElementDeclaration) e.next();
  if (ft.getName().equals(element.getName())) {

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

private static boolean hasNoElementsNorTypes(XSDSchema schema) {
  if (schema == null) {
    return false;
  }
  return schema.getElementDeclarations().isEmpty() && schema.getTypeDefinitions().isEmpty();
}

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

protected void buildElementIndex() {
  elementIndex = new HashMap();
  for (int i = 0; i < schemas.length; i++) {
    XSDSchema schema = schemas[i];
    for (Iterator e = schema.getElementDeclarations().iterator(); e.hasNext(); ) {
      XSDElementDeclaration element = (XSDElementDeclaration) e.next();
      QName qName = new QName(element.getTargetNamespace(), element.getName());
      elementIndex.put(qName, element);
    }
  }
}

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

/**
 * Searches <code>schema</code> for an element which matches <code>name</code>.
 *
 * @param schema The schema
 * @param name The element to search for
 * @return The element declaration, or null if it could not be found.
 */
public static XSDElementDeclaration getElementDeclaration(XSDSchema schema, QName name) {
  for (Iterator e = schema.getElementDeclarations().iterator(); e.hasNext(); ) {
    XSDElementDeclaration element = (XSDElementDeclaration) e.next();
    if (element.getTargetNamespace().equals(name.getNamespaceURI())) {
      if (element.getName().equals(name.getLocalPart())) {
        return element;
      }
    }
  }
  return null;
}

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

/**
 * Returns a list of all top level elements that are of a type derived from the type of the
 * specified element.
 *
 * @param element The element.
 * @return All elements which are of a type derived from the type of the specified element.
 */
public static final List getDerivedElementDeclarations(XSDElementDeclaration element) {
  List elements = element.getSchema().getElementDeclarations();
  List derived = new ArrayList();
  for (Iterator itr = elements.iterator(); itr.hasNext(); ) {
    XSDElementDeclaration derivee = (XSDElementDeclaration) itr.next();
    if (derivee.equals(element)) {
      continue; // same element
    }
    XSDTypeDefinition type = derivee.getType();
    while (true) {
      if (type.equals(element.getType())) {
        derived.add(derivee);
        break;
      }
      if (type.equals(type.getBaseType())) {
        break;
      }
      type = type.getBaseType();
    }
  }
  return derived;
}

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

protected final XSDTypeDefinition findGlobalElementXSDType(XSDElementDeclaration element) {
  for (Iterator i = schema.getElementDeclarations().iterator(); i.hasNext();) {
    XSDElementDeclaration e = (XSDElementDeclaration) i.next();
    if (element.getName().equals( e.getName() ) && (element.getTargetNamespace() == null || 
      element.getTargetNamespace().equals( e.getTargetNamespace() ) ) ) {
      return e.getType();
    }
  }
  return null; 
}

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

private boolean hasElement(XSDSchema schema, String elQName) {
  boolean elFound = false;
  EList<XSDElementDeclaration> elDeclList = schema.getElementDeclarations();
  for (XSDElementDeclaration elDecl : elDeclList) {
    if (elQName.equals(elDecl.getQName())) {
      elFound = true;
    }
  }
  return elFound;
}

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

List elements = schema.getElementDeclarations();
for (Iterator itr = elements.iterator(); itr.hasNext();) {
  XSDElementDeclaration element = (XSDElementDeclaration)itr.next();

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

List elements = schema.getElementDeclarations();

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

for ( Iterator e = schema.getElementDeclarations().iterator(); e.hasNext(); ) {
  XSDElementDeclaration element = (XSDElementDeclaration ) e.next();
  if ( element.getAnonymousTypeDefinition() != null ) {

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

resolvedSchema.getReferencingDirectives().remove(directive);
for (XSDElementDeclaration dec :
    resolvedSchema.getElementDeclarations()) {
  if (dec == null) {
    continue;

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

} else {
  for (Iterator e = type.getSchema().getElementDeclarations().iterator(); e.hasNext(); ) {
    XSDElementDeclaration element = (XSDElementDeclaration) e.next();

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

private List getUsedElementNames() {
   List usedNames = new ArrayList();		  
   if (schema != null ) {
     List elementsList = schema.getElementDeclarations();
     Iterator elements = elementsList.iterator(); 
     while (elements.hasNext()) {
       usedNames.add(((XSDElementDeclaration) elements.next()).getName());
     }
   }
   
   return usedNames;
 }
}

代码示例来源:origin: org.geotools/gt2-xml-core

protected void buildElementIndex() {
  elementIndex = new HashMap();
  for (int i = 0; i < schemas.length; i++) {
    XSDSchema schema = schemas[i];
    for (Iterator e = schema.getElementDeclarations().iterator(); e.hasNext();) {
      XSDElementDeclaration element = (XSDElementDeclaration) e.next();
      QName qName = new QName(element.getTargetNamespace(), element.getName());
      elementIndex.put(qName, element);
    }
  }
}

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

public void visitXSDSchema(XSDSchema xsdSchema)
{         
 indent += 2;
 for (Iterator iterator = xsdSchema.getElementDeclarations().iterator(); iterator.hasNext(); )
 {
  visitXSDObject(iterator.next());
 }
 indent -= 2;
}

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

protected void buildElementIndex() {
  elementIndex = new HashMap();
  for (int i = 0; i < schemas.length; i++) {
    XSDSchema schema = schemas[i];
    for (Iterator e = schema.getElementDeclarations().iterator(); e.hasNext();) {
      XSDElementDeclaration element = (XSDElementDeclaration) e.next();
      QName qName = new QName(element.getTargetNamespace(), element.getName());
      elementIndex.put(qName, element);
    }
  }
}

代码示例来源:origin: org.geotools/gt2-xml-xsd

protected void buildElementIndex() {
  elementIndex = new HashMap();
  for (int i = 0; i < schemas.length; i++) {
    XSDSchema schema = schemas[i];
    for (Iterator e = schema.getElementDeclarations().iterator();
        e.hasNext();) {
      XSDElementDeclaration element = (XSDElementDeclaration) e.next();
      QName qName = new QName(element.getTargetNamespace(),
          element.getName());
      elementIndex.put(qName, element);
    }
  }
}

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

public List getGlobalElements(XSDSchema schema, boolean showFromIncludes)
{
 List elements = schema.getElementDeclarations();
 List list = new ArrayList();
 for (Iterator i = elements.iterator(); i.hasNext();)
 {
  XSDElementDeclaration elem = (XSDElementDeclaration) i.next();
  if (isSameNamespace(elem.getTargetNamespace(),schema.getTargetNamespace()) && (elem.getRootContainer() == schema || showFromIncludes))
  {
   list.add(elem);
  }
 }
 List adapterList = new ArrayList();
 populateAdapterList(list, adapterList);
 return adapterList;
}

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

private void setup() {
  if (schema != null) {
    List usedNames = getUsedElementNames();
    setUsedNames(usedNames);
    setDefaultName(XSDCommonUIUtils.createUniqueElementName("NewElement", schema.getElementDeclarations()));
  }
}

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

相关文章

微信公众号

最新文章

更多