[]
        
(Showing Draft Content)

C1.LiveLinq.LiveViews.Xml.XmlExtensions.AsLive

AsLive Method

AsLive(XDocument)

Creates a view based on the specified XML document.

Declaration
public static View<XDocument> AsLive(this XDocument document)
Parameters
Type Name Description
XDocument document

The XML document to expose as a view.

Returns
Type Description
View<XDocument>

A view representing the specified XML document.

Remarks

Since there can be only one root element in a document, the view based on a document (document.AsLive()) is similar to the view based on its root element (document.Root.AsLive()). The difference is that the document view contains the document as its only item, and the root view contains the root as its only item. This difference is essential only when the root of the document is replaced with a different element (and so the whole XML tree changes), then the document view remains valid and shows the changed document contents, whereas the root view becomes disconnected from the document.

Note: This view is owned by the XDocument object (it is stored as one of its annotations), so, if you create a view for the same document several times, it will be the same object.

AsLive(XElement)

Creates a view based on the specified XML element.

Declaration
public static View<XElement> AsLive(this XElement element)
Parameters
Type Name Description
XElement element

The XML element to expose as a view.

Returns
Type Description
View<XElement>

A view representing the specified XML element.

Remarks

This view represents a single XML node. Therefore, as a collection of items, this view's Count is always 1. This view is usually used as a starting point to construct a view containing elements or attributes from this node's descendants by using a query with operators from XmlExtensions such as Elements, Descendants and others, in combination with standard LINQ query operators where, join and others.

Note: This view is owned by the XElement object (it is stored as one of its annotations), so, if you create a view for the same element several times, it will be the same object.