Ejemplo n.º 1
0
  /**
   * Adds the given Element declaration to this Schema defintion
   *
   * @param elementDecl the ElementDecl to add to this SchemaDef
   * @exception SchemaException when an ElementDecl already exists with the same name as the given
   *     ElementDecl
   */
  public void addElementDecl(ElementDecl elementDecl) throws SchemaException {

    String name = elementDecl.getName();

    if (name == null) {
      String err = "an element declaration must contain a name.";
      throw new SchemaException(err);
    }
    if (elements.get(name) != null) {
      String err = "an element declaration already exists with the given name: ";
      throw new SchemaException(err + name);
    }

    elements.put(name, elementDecl);
  } // -- addElementDecl
Ejemplo n.º 2
0
  /**
   * Adds the given ElementDecl to this ContentModelGroup
   *
   * @param elementDecl the ElementDecl to add
   * @exception SchemaException when an ElementDecl already exists with the same name as the given
   *     ElementDecl
   */
  public void addElementDecl(ElementDecl elementDecl) throws SchemaException {
    _contentModel.addElementDecl(elementDecl);

    // --set the parent
    elementDecl.setParent(this);
  } // -- addElementDecl