@openxmldev/linq-to-xml
Version:
LINQ to XML for TypeScript
66 lines (65 loc) • 2.3 kB
TypeScript
/**
* @author Thomas Barnekow
* @license MIT
*/
import { LinqElements, LinqNodes, XElement, XName, XNode } from './internal.js';
/**
* Represents a node that can contain other nodes.
* The two classes that derive from {@link XContainer} are {@link XDocument} and {@link XElement}.
*/
export declare abstract class XContainer extends XNode {
protected constructor();
/**
* Gets this container's first `XNode` or `null`, if this container does not
* have any nodes.
*/
get firstNode(): XNode | null;
/**
* Gets this container's last `XNode` or `null`, if this container does not
* have any nodes.
*/
get lastNode(): XNode | null;
/**
* Adds the specified content as a child (or children) of this `XContainer`.
*
* @param content A content object containing simple content or a collection
* of content objects to be added.
*/
add(content: any): void;
/**
* Gets the descendant `XElement`s of this `XContainer`.
*
* @param name The optional name of the descendants to return.
* @returns The descendant `XElement`s of this `XContainer`.
*/
descendants(name?: XName | null): LinqElements;
element(name: XName): XElement | null;
/**
* Gets the child `XElement`s of this `XContainer`.
*
* @param name The optional name of the elements to return.
* @returns The child `XElement`s of this `XContainer`.
*/
elements(name?: XName | null): LinqElements;
/**
* Returns the content of this `XContainer`.
* Note that the content does not include `XAttribute`s.
*
* @returns The content of this `XContainer` as an `IterableOfXNode`.
*/
nodes(): LinqNodes;
/**
* Removes the nodes from this `XContainer`.
* Note that this method does not remove the attributes.
*/
removeNodes(): void;
private removeNodesSkipNotify;
/**
* Replaces the child nodes of this `XContainer` with the specified content.
* The content can be simple content, a collection of content objects, a param
* list of content objects, or null.
*
* @param content The new content.
*/
replaceNodes(...content: any[]): void;
}