protected void processStructure(
      com.liferay.portal.kernel.xml.Document structureDocument,
      Document document,
      Element rootElement)
      throws Exception {

    LinkedList<Element> queue = new LinkedList<Element>(rootElement.elements());

    Element element = null;

    while ((element = queue.poll()) != null) {
      String elName = element.attributeValue("name", StringPool.BLANK);
      String elType = element.attributeValue("type", StringPool.BLANK);
      String elIndexType = element.attributeValue("index-type", StringPool.BLANK);

      if (structureDocument != null) {
        String path = element.getPath().concat("[@name='").concat(elName).concat("']");

        Node structureNode = structureDocument.selectSingleNode(path);

        if (structureNode != null) {
          Element structureElement = (Element) structureNode;

          elType = structureElement.attributeValue("type", StringPool.BLANK);
          elIndexType = structureElement.attributeValue("index-type", StringPool.BLANK);
        }
      }

      if (Validator.isNotNull(elType)) {
        indexField(document, element, elType, elIndexType);
      }

      queue.addAll(element.elements());
    }
  }