protected void addElementDeclarationFromSchema(
     XSDSchema schema, Collection<XSDElementDeclaration> declarations) {
   EList<XSDElementDeclaration> elementDeclarations = schema.getElementDeclarations();
   for (XSDElementDeclaration declaration : elementDeclarations) {
     if (declaration.eContainer().equals(schema)) {
       declarations.add(declaration);
     }
   }
 }
 // TODO THIS THREE METHODS ARE REPEATED IN XSDTAG!!!!
 private void parseElementsFrom(XSDSchema schema) {
   this.parseNamespaceContainers(schema);
   for (Iterator it = schema.getElementDeclarations().iterator(); it.hasNext(); ) {
     XSDElementDeclaration elementDeclaration = (XSDElementDeclaration) it.next();
     if (this.documentStructureDeclaration.getPublicId() == null
         || elementDeclaration
             .getURI()
             .startsWith(this.documentStructureDeclaration.getPublicId())) {
       if (!elementDeclaration.isAbstract()) {
         this.possibleRoots.add(
             new XSDTagTypeDefinition(
                 elementDeclaration, this.documentStructureDeclaration.getNamespace(), this.tags));
       }
       this.handleLeaf(elementDeclaration);
       this.handleElementDeclaration(elementDeclaration);
     }
   }
 }
  protected void addSchemaElements(List list, XSDSchema schema) {

    boolean builtInTypesSchema =
        XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(schema.getTargetNamespace());

    if (builtInTypesSchema && (fFilter & INCLUDE_PRIMITIVES) > 0) {
      list.addAll(XSDUtils.getAdvancedPrimitives());
      return;
    }

    if ((fFilter & INCLUDE_ELEMENT_DECLARATIONS) > 0) {
      list.addAll(schema.getElementDeclarations());
    }

    if ((fFilter & INCLUDE_TYPES) == 0) {
      return;
    }

    List types = schema.getTypeDefinitions();
    Iterator i = types.iterator();
    boolean bAdd = false;

    while (i.hasNext()) {

      XSDTypeDefinition defn = (XSDTypeDefinition) i.next();

      bAdd =
          (((fFilter & INCLUDE_COMPLEX_TYPES) > 0) && (defn instanceof XSDComplexTypeDefinition)
              || ((fFilter & INCLUDE_SIMPLE_TYPES) > 0)
                  && (defn instanceof XSDSimpleTypeDefinition));

      if (bAdd) {
        list.add(defn);
      }
    }
  }