attempts to add an element to a container

@param container
@param element
@throws DocumentException
491702
@Override
   public void addToContainer(Element container, Element element) throws DocumentException, VectorPrintException {
      if (container instanceof TextElementArray) {
         if (element instanceof Image) {
            ((TextElementArray) container).add(new Chunk((Image) element, 0, 0, true));
         } else {
            ((TextElementArray) container).add(element);
         }
      } else if (container instanceof PdfPTable) {
         if (element instanceof PdfPCell) {
            ((PdfPTable) container).addCell((PdfPCell) element);
         } else if (element instanceof Phrase) {
            ((PdfPTable) container).addCell((Phrase) element);
         } else if (element instanceof PdfPTable) {
            ((PdfPTable) container).addCell((PdfPTable) element);
         } else if (element instanceof Image) {
            ((PdfPTable) container).addCell((Image) element);
         } else {
            throw new VectorPrintException(String.format("don't know how to add %s to %s", (element == null) ? "null" : element.getClass().getName(), (container == null) ? "null" : container.getClass().getName()));
         }
      } else if (container instanceof PdfPCell) {
         if (element instanceof PdfPTable) {
            throw new VectorPrintException(String.format("use %s.%s if you want to nest tables", CONTAINER_ELEMENT.class.getName(), CONTAINER_ELEMENT.NESTED_TABLE));
         }
         ((PdfPCell) container).addElement(element);
      } else if (container instanceof ColumnText) {
         ((ColumnText) container).addElement(element);
      } else {
         throw new VectorPrintException(String.format("don't know how to add %s to %s", (element == null) ? "null" : element.getClass().getName(), (container == null) ? "null" : container.getClass().getName()));
      }
   }
887446
protected void init(I_CmsXmlContentContainer container) {

        m_container = container;

        // append to parent element name (required for nested schemas)
        m_element = CmsXmlUtils.concatXpath(m_container.getXmlDocumentElement(), m_element);

        // get loaded content from parent <contentload> tag
        m_content = m_container.getXmlDocument();
        m_locale = m_container.getXmlDocumentLocale();
        m_index = 0;
        m_currentElement = null;

        // the next loop is the first loop
        m_firstLoop = true;
    }
548276
private boolean addPropertyElement(Element element, String elementName, String textContent) {
        Document doc = element.getOwnerDocument();
        Element newElement = doc.createElement(elementName);
        newElement.setTextContent(textContent);
        Text textNode = doc.createTextNode("\n    ");

        NodeList childNodes = element.getChildNodes();
        for (int i = 0, size = childNodes.getLength(); i < size; i++) {
            Node item = childNodes.item(i);
            if (item instanceof Element) {
                Element childElement = (Element) item;
                int value = childElement.getTagName().compareTo(elementName);
                if (value == 0) {
                    return false;
                }
                if (value > 0) {
                    element.insertBefore(textNode, childElement);
                    element.insertBefore(newElement, textNode);
                    return true;
                }
            }
        }
        // lets insert at the end
        element.appendChild(textNode);
        element.appendChild(newElement);
        return true;
    }
888762
public void add(E element) {
        if (element == null) throw new NullPointerException();

        if (root == null) {
            root = new MutableNode<>(element);
        } else {
            MutableNode<E> node = root;
            while (!node.getElement().equals(element)) {
                int distance = distance(node.getElement(), element);

                MutableNode<E> parent = node;
                node = parent.childrenByDistance.get(distance);
                if (node == null) {
                    node = new MutableNode<>(element);
                    parent.childrenByDistance.put(distance, node);
                    break;
                }
            }
        }
    }
948665
public function addElement($element)
    {
        if ($this->processing === 'B') {
            $this->pdf->addBody($element);

            return;
        }

        if ($this->processing === 'H') {
            $this->pdf->addHeader($element);

            return;
        }

        if ($this->processing === 'F') {
            $this->pdf->addFooter($element);

            return;
        }
    }
412157
private Element addElement(Document document, Element parent,
			Map<ReportKey, Object> reportsData, ReportKey key, String value) {
		if (reportsData.containsKey(key)) {
			Element child = document.createElement(key.name().toLowerCase());
			child.appendChild(document.createTextNode(value));
			parent.appendChild(child);
			return child;
		}
		return null;
	}
1310739
public void addElement(ObjectProperty element) {
        assertNotNull(element);
        if (elements == null) {
            elements = new ArrayList<ObjectProperty>();
        }
        elements.add(element);
        element.setParent(this);
    }
716976
private void addRootElement() {
        if (root instanceof Document) {
            // Get the single element child of the document node.
            // There could be a doctype node and comment nodes that we must skip.
            Element element = DOMHelper.getFirstChildElement(root);
            Assert.notNull(element, "there should be a root element!");
            result.add(element);
        } else {
            Assert.isTrue(root instanceof Element, "root must be a document or element node!");
            result.add(root);
        }
    }
1247042
protected function addNode(DOMElement $element, $key, $value)
    {
        if ($this->replaceSpacesByUnderScoresInKeyNames) {
            $key = str_replace(' ', '_', $key);
        }

        $child = $this->document->createElement($key);
        $element->appendChild($child);
        $this->convertElement($child, $value);
    }
526522
public void add(Iterable<XElement> elements) {
        for (XElement e : elements) {
            e.parent = this;
            children.add(e);
        }
    }
947889
public void initializeSubContainers(CmsContainerPageElementPanel containerElement) {

        int containerCount = m_targetContainers.size();
        m_targetContainers.putAll(m_containerpageUtil.consumeContainers(m_containers, containerElement.getElement()));
        updateContainerLevelInfo();
        if (m_targetContainers.size() > containerCount) {
            // in case new containers have been added, the gallery data needs to be updated
            scheduleGalleryUpdate();
        }
    }
806818
public void addSingletonCell(int element) {
        SortedSet<Integer> cell = new TreeSet<Integer>();
        cell.add(element);
        this.cells.add(cell);
    }
520010
protected function containerToDOM(\DomDocument $doc, \DomNode $node) : void
    {
        foreach ($this->children as $child) {
            $node->appendChild($child->toDOM($doc));
        }
    }
588871
function Element(doc, name, content) {
    if (!doc) {
        throw new Error('document argument required');
    } else if (! (doc instanceof bindings.Document)) {
        throw new Error('document argument must be an ' +
                        'instance of Document');
    } else if (!name) {
        throw new Error('name argument required');
    }

    return new bindings.Element(doc, name, content);
}
1235984
public void add(int index, Object element) {

        if (index == size()) {
            add(element);    //Add to the end of this.
        }

        //If index > size() an exception should be thrown with a slightly
        //different message than the exception thrown by getInternal.
        else if (index > size()) {
            throw new IndexOutOfBoundsException("Index out of bounds: "
                                                + index + " > " + size());
        } else {
            Node current = getInternal(index);
            Node newNext = new Node(current.data, current.next);

            current.data = element;
            current.next = newNext;

            elementCount++;

            //If they inserted at the last valid index, then a new last element
            //was created, therfore update the last pointer
            if (last == current) {
                last = newNext;
            }
        }
    }
993432
protected function addNodeWithKey($key, DOMElement $element, $storage): void
    {
        if ($key === '@attributes') {
            $this->addAttributes($element, $storage);
            return;
        }

        if ($key === '@value') {

            if (\is_string($storage)) {
                $element->nodeValue = $storage;
                return;
            }

            $dom      = new \DOMDocument();
            $fragment = $element->ownerDocument->createDocumentFragment();
            $dom->loadXML(static::toXml($storage, 'root', $this->namespaces));

            /**
             * @var $childNode \DOMText
             */
            foreach ($dom->firstChild->childNodes as $childNode) {
                $fragment->appendXML($childNode->ownerDocument->saveXML($childNode));
            }

            $element->appendChild($fragment);
            return;
        }

        $this->addNode($element, $key, $storage);
    }
993740
public void beginElement(String elementName) throws IOException {		
		addElementName(elementName);
		indent();
		writer.write("<");
		writer.write(elementName);
	}