| IAbstractMarkupDataContainer Interface |
Namespace: Sdl.FileTypeSupport.Framework.BilingualApi
The IAbstractMarkupDataContainer type exposes the following members.
| Name | Description | |
|---|---|---|
| AllSubItems |
An iterator that can be used to iterate over all child items - including sub-items - in the container.
| |
| CanBeSplit |
Indicates whether it is possible to split this container into different
parts by calling the Split(Int32) method.
| |
| Locations |
Iterator for all possible locations in the collection and its sub-collections
|
| Name | Description | |
|---|---|---|
| Find(PredicateIAbstractMarkupData) |
Returns the first item that matches the specified predecate.
The iteration is performed over all items and sub-items in this collection and all sub-collections until the item is located. | |
| Find(PredicateLocation) |
Returns the first location that matches the specified predecate.
The iteration is performed over all locations in this collection and all sub-collections until
the element is located.
| |
| Find(Location, PredicateLocation) |
Returns the first location that matches the specified predecate, starting
at a specific location.
| |
| ForEachSubItem |
Execute the specified action on each item and (recursively) each sub-item in this container.
| |
| GetLocationsFrom |
Enumerator for locations starting from a specific location
| |
| MoveAllItemsTo(IAbstractMarkupDataContainer) |
Moves all items from this container into another one.
| |
| MoveAllItemsTo(IAbstractMarkupDataContainer, Int32) |
Moves all items from this container to a specific location in another container.
| |
| MoveItemsTo(IAbstractMarkupDataContainer, Int32, Int32) |
Moves a number of items from this container into another one.
| |
| MoveItemsTo(IAbstractMarkupDataContainer, Int32, Int32, Int32) |
Moves a number of items from this container into a specific location in another one.
| |
| Split |
Splits this container in two. After the split, this object will hold
all items with index lower than the splitBeforeItemIndex parameter.
The returned object is a clone of this object, which contains all other items.
|
Adding or inserting an item into the container automatically sets the Parent property of the item. Removing an item from a container automatically sets the parent property to null.
An item can never appear in more than one container at the same time. Attempting to add an item to a container if it is already in another container causes an exception.
If you want an equivalent item to appear in two containers, you can clone it, and insert the clone into the second container. The cloned item will then reference the same properties object(s).
Implementations of this interface may or may not be IAbstractMarkupData. ITagPair is an example of a container that is also a markup data item, and can therefore appear inside other containers. IParagraph is an example of a container that is NOT a markup data item.
The following example demonstrates how to retrieve the parent container for a container node if it is a markup data item.
IAbstractMarkupData GetParent(IAbstractMarkupDataContainer container)
{
IAbstractMarkupData item = container as IAbstractMarkupData;
if (item != null)
{
return item.Parent;
}
// container is not a markup data item
return null;
}During content manipulation it is sometimes necessary to split a container into two parts, with the first part containing some of the items, the second containing others, and both containers referencing the same properties objects. The easiest way to accomplish this is to call Split(Int32).
Note that not all containers can be split (for example, IParagraph cannot be split). Before calling Split(Int32) you should therefore check the CanBeSplit property.
Another common operation is to move items into a different container. The easiest way to do that is to use one of the overloads of MoveAllItemsTo() or MoveItemsTo().
It is sometimes necessary to reference locations inside a container. This can be done using the Location class. You can iterate over all possible locations in a container (including locations in nested containers) using the Locations iterator.