/**
   * Create the objects described in an XML element containing layer and/or layer-list descriptions.
   * Nested layer lists and included layers are created recursively.
   *
   * @param domElement an XML element describing the layers and/or layer lists.
   * @param params any properties to apply when creating the included layers.
   * @return a <code>Layer</code>, <code>LayerList</code> or array of <code>LayerList</code>s, as
   *     described by the specified description.
   * @throws Exception if an exception occurs during creation. Exceptions occurring during creation
   *     of internal layers or layer lists are not re-thrown but are logged. The layer or layer list
   *     associated with the exception is not contained in the returned object.
   */
  @Override
  protected Object doCreateFromElement(Element domElement, AVList params) throws Exception {
    Element[] elements = WWXML.getElements(domElement, "//LayerList", null);
    if (elements != null && elements.length > 0) return createLayerLists(elements, params);

    elements = WWXML.getElements(domElement, "./Layer", null);
    if (elements != null && elements.length > 1) return createLayerList(elements, params);

    if (elements != null && elements.length == 1)
      return this.createFromLayerDocument(elements[0], params);

    String localName = WWXML.getUnqualifiedName(domElement);
    if (localName != null && localName.equals("Layer"))
      return this.createFromLayerDocument(domElement, params);

    return null;
  }