ZPT-Sharp  v1.0.0
Zope Page Templates for .NET
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
CSF.Zpt.Rendering.IZptElement Interface Reference

Interface for a type which wraps a DOM element. More...

Inheritance diagram for CSF.Zpt.Rendering.IZptElement:
Collaboration diagram for CSF.Zpt.Rendering.IZptElement:

Public Member Functions

ISourceInfo GetSourceInfo ()
 Gets information about the source of the current element. More...
 
string ToString ()
 Returns a System.String that represents the current IZptElement. More...
 
IZptElement ReplaceWith (IZptElement replacement)
 Replaces the current element in its respective DOM with the given replacement. More...
 
IZptElement[] ReplaceWith (string content, bool interpretContentAsStructure)
 Replaces the current element instance with the given content. More...
 
void ReplaceChildrenWith (string content, bool interpretContentAsStructure)
 Removes all children of the current element instance and replaces them with the given content. More...
 
IZptElement InsertBefore (IZptElement existing, IZptElement newChild)
 Inserts a new child element into the current element's child elements. The new child will be the previous sibling before a given existing child. More...
 
IZptElement InsertAfter (IZptElement existing, IZptElement newChild)
 Inserts a new child element into the current element's child elements. The new child will be the next sibling after a given existing child. More...
 
IZptElement GetParentElement ()
 Gets the element which is the parent of the current instance. More...
 
IZptElement[] GetElementChain ()
 Gets an ordered element chain, starting with the current element and including all of its parent elements from closest to furthest ancestors. More...
 
IZptElement[] GetChildElements ()
 Gets a collection of the child elements from the current source element. More...
 
IZptAttribute[] GetAttributes ()
 Gets a collection of the attributes present upon the current element. More...
 
IZptAttribute GetAttribute (ZptNamespace attributeNamespace, string name)
 Gets an attribute which matches the given criteria, or a null reference is no matching attribute is found. More...
 
void SetAttribute (string name, string value)
 Sets the value of an attribute. More...
 
void SetAttribute (ZptNamespace attributeNamespace, string name, string value)
 Sets the value of an attribute. More...
 
void RemoveAttribute (string name)
 Removes a named attribute. More...
 
void RemoveAttribute (ZptNamespace attributeNamespace, string name)
 Removes a named attribute. More...
 
IZptElement[] SearchChildrenByAttribute (ZptNamespace attributeNamespace, string name)
 Recursively searches the children of the current instance, returning a collection of elements which have an attribute matching the given criteria. More...
 
IZptElement SearchAncestorsByAttribute (ZptNamespace attributeNamespace, string name)
 Recursively searches upwards in the DOM tree, returning the first (closest) ancestor element which has an attribute matching the given criteria. More...
 
void PurgeAttributes (ZptNamespace attributeNamespace)
 Recursively searches for attributes with a given namespace or prefix and removes them from their parent element. More...
 
void PurgeElements (ZptNamespace elementNamespace)
 Recursively searches for elements with a given namespace or prefix and removes them using the Omit behaviour. More...
 
void AddCommentBefore (string comment)
 Adds a new comment to the DOM immediately before the current element. More...
 
void AddCommentInside (string comment)
 Adds a new comment to the DOM inside the current element as its first child. More...
 
void AddCommentAfter (string comment)
 Adds a new comment to the DOM immediately after the current element. More...
 
IZptElement Clone ()
 Clone this instance into a new Element instance, which may be manipulated without affecting the original. More...
 
string GetFileLocation ()
 Gets the file location (typically a line number) for the current instance. More...
 
string GetEndTagFileLocation ()
 Gets the file location (typically a line number) for the end tag matched with the current instance. More...
 
string GetOriginalContextEndTagLocation ()
 Gets the file location (typically a line number) for the end tag of an 'original context'. More...
 
ISourceInfo GetOriginalContextSourceInfo ()
 Gets information about the source of the current element. More...
 
IZptElement[] Omit ()
 Omits the current element, replacing it with its children. More...
 
void Remove ()
 Removes the current element from the DOM. More...
 
void RemoveAllChildren ()
 Removes all child elements from the current element. More...
 
bool IsInNamespace (ZptNamespace nSpace)
 Determines whether or not the current instance is in the specified namespace. More...
 
bool IsFromSameDocumentAs (IZptElement other)
 Determines whether this instance is from same document as the specified element. More...
 
string GetFullFilePathAndLocation ()
 Gets the full file path and location for the current element. More...
 
void MarkAsImported (IZptElement originalElement)
 Marks the current element as being imported into its parent document (IE: it represents a context switch). More...
 
void CacheSourceInformationInAttributes ()
 Writes information to the underlying element's attributes recording its source information. More...
 
IZptDocument CreateDocumentFromThisElement ()
 Creates a new IZptDocument which contains only the current element and its children. More...
 

Properties

string Name [get]
 Gets the element name. More...
 
bool IsRoot [get]
 Gets a value indicating whether this instance is the root of its parent document. More...
 
bool HasParent [get]
 Gets a value indicating whether this instance has a parent element or not. More...
 
bool IsImported [get]
 Gets a value indicating whether this instance represents an element imported from another document tree. More...
 
Type ZptDocumentType [get]
 Gets a System.Type indicating the type of IZptDocument to which the current instance belongs. More...
 
bool CanWriteCommentWithoutParent [get]
 Gets a value indicating whether or not this instance can write a comment node to a node that does not have a parent. More...
 
IZptDocument OwnerDocument [get]
 Gets the IZptDocument instance to which the current instance belongs. More...
 

Detailed Description

Interface for a type which wraps a DOM element.

Member Function Documentation

void CSF.Zpt.Rendering.IZptElement.AddCommentAfter ( string  comment)

Adds a new comment to the DOM immediately after the current element.

Parameters
commentThe comment text.

Implemented in CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptHtmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, and CSF.Zpt.Rendering.ZptElement.

void CSF.Zpt.Rendering.IZptElement.AddCommentBefore ( string  comment)

Adds a new comment to the DOM immediately before the current element.

Parameters
commentThe comment text.

Implemented in CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, CSF.Zpt.DocumentProviders.ZptHtmlElement, and CSF.Zpt.Rendering.ZptElement.

void CSF.Zpt.Rendering.IZptElement.AddCommentInside ( string  comment)

Adds a new comment to the DOM inside the current element as its first child.

Parameters
commentThe comment text.

Implemented in CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptHtmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, and CSF.Zpt.Rendering.ZptElement.

void CSF.Zpt.Rendering.IZptElement.CacheSourceInformationInAttributes ( )

Writes information to the underlying element's attributes recording its source information.

Implemented in CSF.Zpt.Rendering.ZptElement.

IZptElement CSF.Zpt.Rendering.IZptElement.Clone ( )

Clone this instance into a new Element instance, which may be manipulated without affecting the original.

Implemented in CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, CSF.Zpt.DocumentProviders.ZptHtmlElement, and CSF.Zpt.Rendering.ZptElement.

IZptDocument CSF.Zpt.Rendering.IZptElement.CreateDocumentFromThisElement ( )

Creates a new IZptDocument which contains only the current element and its children.

Returns
A new document instance.

Implemented in CSF.Zpt.Rendering.ZptElement, CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, and CSF.Zpt.DocumentProviders.ZptHtmlElement.

IZptAttribute CSF.Zpt.Rendering.IZptElement.GetAttribute ( ZptNamespace  attributeNamespace,
string  name 
)

Gets an attribute which matches the given criteria, or a null reference is no matching attribute is found.

Returns
The attribute, or a null reference.
Parameters
attributeNamespaceThe attribute namespace.
nameThe attribute name.

Implemented in CSF.Zpt.DocumentProviders.ZptHtmlElement, CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.Rendering.ZptElement, and CSF.Zpt.DocumentProviders.ZptXmlLinqElement.

IZptAttribute [] CSF.Zpt.Rendering.IZptElement.GetAttributes ( )

Gets a collection of the attributes present upon the current element.

Returns
The attributes.

Implemented in CSF.Zpt.DocumentProviders.ZptHtmlElement, CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.Rendering.ZptElement, and CSF.Zpt.DocumentProviders.ZptXmlLinqElement.

IZptElement [] CSF.Zpt.Rendering.IZptElement.GetChildElements ( )

Gets a collection of the child elements from the current source element.

Returns
The children.

Implemented in CSF.Zpt.DocumentProviders.ZptHtmlElement, CSF.Zpt.Rendering.ZptElement, CSF.Zpt.DocumentProviders.ZptXmlElement, and CSF.Zpt.DocumentProviders.ZptXmlLinqElement.

IZptElement [] CSF.Zpt.Rendering.IZptElement.GetElementChain ( )

Gets an ordered element chain, starting with the current element and including all of its parent elements from closest to furthest ancestors.

Returns
The element chain.

Implemented in CSF.Zpt.Rendering.ZptElement.

string CSF.Zpt.Rendering.IZptElement.GetEndTagFileLocation ( )

Gets the file location (typically a line number) for the end tag matched with the current instance.

Returns
The end tag file location.

Implemented in CSF.Zpt.Rendering.ZptElement.

string CSF.Zpt.Rendering.IZptElement.GetFileLocation ( )

Gets the file location (typically a line number) for the current instance.

Returns
The file location.

Implemented in CSF.Zpt.Rendering.ZptElement.

string CSF.Zpt.Rendering.IZptElement.GetFullFilePathAndLocation ( )

Gets the full file path and location for the current element.

Returns
The full file path and location.

Implemented in CSF.Zpt.Rendering.ZptElement.

string CSF.Zpt.Rendering.IZptElement.GetOriginalContextEndTagLocation ( )

Gets the file location (typically a line number) for the end tag of an 'original context'.

Returns
The end tag file location.

Implemented in CSF.Zpt.Rendering.ZptElement.

ISourceInfo CSF.Zpt.Rendering.IZptElement.GetOriginalContextSourceInfo ( )

Gets information about the source of the current element.

Returns
The end tag file location.

Implemented in CSF.Zpt.Rendering.ZptElement.

IZptElement CSF.Zpt.Rendering.IZptElement.GetParentElement ( )

Gets the element which is the parent of the current instance.

Returns
The parent element.

Implemented in CSF.Zpt.DocumentProviders.ZptHtmlElement, CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.Rendering.ZptElement, and CSF.Zpt.DocumentProviders.ZptXmlLinqElement.

ISourceInfo CSF.Zpt.Rendering.IZptElement.GetSourceInfo ( )

Gets information about the source of the current element.

Implemented in CSF.Zpt.Rendering.ZptElement.

IZptElement CSF.Zpt.Rendering.IZptElement.InsertAfter ( IZptElement  existing,
IZptElement  newChild 
)

Inserts a new child element into the current element's child elements. The new child will be the next sibling after a given existing child.

Returns
The newly-added element.
Parameters
existingAn existing child element, after which the child will be inserted.
newChildThe new child element to insert.

Implemented in CSF.Zpt.DocumentProviders.ZptHtmlElement, CSF.Zpt.Rendering.ZptElement, CSF.Zpt.DocumentProviders.ZptXmlElement, and CSF.Zpt.DocumentProviders.ZptXmlLinqElement.

IZptElement CSF.Zpt.Rendering.IZptElement.InsertBefore ( IZptElement  existing,
IZptElement  newChild 
)

Inserts a new child element into the current element's child elements. The new child will be the previous sibling before a given existing child.

Returns
The newly-added element.
Parameters
existingAn existing child element, before which the child will be inserted.
newChildThe new child element to insert.

Implemented in CSF.Zpt.Rendering.ZptElement, CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptHtmlElement, and CSF.Zpt.DocumentProviders.ZptXmlLinqElement.

bool CSF.Zpt.Rendering.IZptElement.IsFromSameDocumentAs ( IZptElement  other)

Determines whether this instance is from same document as the specified element.

Returns
true if this instance is from same document as the specified element; otherwise, false.
Parameters
otherThe element to test.

Implemented in CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, CSF.Zpt.DocumentProviders.ZptHtmlElement, and CSF.Zpt.Rendering.ZptElement.

bool CSF.Zpt.Rendering.IZptElement.IsInNamespace ( ZptNamespace  nSpace)

Determines whether or not the current instance is in the specified namespace.

Returns
true if this instance is in the specified namespace; otherwise, false.
Parameters
nSpaceThe namespace for which to test.

Implemented in CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, CSF.Zpt.DocumentProviders.ZptHtmlElement, and CSF.Zpt.Rendering.ZptElement.

void CSF.Zpt.Rendering.IZptElement.MarkAsImported ( IZptElement  originalElement)

Marks the current element as being imported into its parent document (IE: it represents a context switch).

Parameters
originalElementThe original element.

Implemented in CSF.Zpt.Rendering.ZptElement.

IZptElement [] CSF.Zpt.Rendering.IZptElement.Omit ( )

Omits the current element, replacing it with its children.

Returns
A collection of the IZptElement instances which were children of the element traversed

Implemented in CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, CSF.Zpt.DocumentProviders.ZptHtmlElement, and CSF.Zpt.Rendering.ZptElement.

void CSF.Zpt.Rendering.IZptElement.PurgeAttributes ( ZptNamespace  attributeNamespace)

Recursively searches for attributes with a given namespace or prefix and removes them from their parent element.

Parameters
attributeNamespaceThe attribute namespace.

Implemented in CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptHtmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, and CSF.Zpt.Rendering.ZptElement.

void CSF.Zpt.Rendering.IZptElement.PurgeElements ( ZptNamespace  elementNamespace)

Recursively searches for elements with a given namespace or prefix and removes them using the Omit behaviour.

Parameters
elementNamespaceThe element namespace.

Implemented in CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, CSF.Zpt.DocumentProviders.ZptHtmlElement, and CSF.Zpt.Rendering.ZptElement.

void CSF.Zpt.Rendering.IZptElement.Remove ( )
void CSF.Zpt.Rendering.IZptElement.RemoveAllChildren ( )
void CSF.Zpt.Rendering.IZptElement.RemoveAttribute ( string  name)

Removes a named attribute.

Parameters
nameThe attribtue name.

Implemented in CSF.Zpt.Rendering.ZptElement.

void CSF.Zpt.Rendering.IZptElement.RemoveAttribute ( ZptNamespace  attributeNamespace,
string  name 
)

Removes a named attribute.

Parameters
attributeNamespaceThe attribute namespace.
nameThe attribute name.

Implemented in CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptHtmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, and CSF.Zpt.Rendering.ZptElement.

void CSF.Zpt.Rendering.IZptElement.ReplaceChildrenWith ( string  content,
bool  interpretContentAsStructure 
)

Removes all children of the current element instance and replaces them with the given content.

Parameters
contentThe content with which to replace the children of the current element.
interpretContentAsStructureIf set to true then the content is interpreted as structure.

Implemented in CSF.Zpt.Rendering.ZptElement, CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, and CSF.Zpt.DocumentProviders.ZptHtmlElement.

IZptElement CSF.Zpt.Rendering.IZptElement.ReplaceWith ( IZptElement  replacement)

Replaces the current element in its respective DOM with the given replacement.

Returns
A reference to the replacement element, in its new DOM.
Parameters
replacementReplacement.

Implemented in CSF.Zpt.Rendering.ZptElement, CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, and CSF.Zpt.DocumentProviders.ZptHtmlElement.

IZptElement [] CSF.Zpt.Rendering.IZptElement.ReplaceWith ( string  content,
bool  interpretContentAsStructure 
)

Replaces the current element instance with the given content.

Returns
A collection of IZptElement, indicating the element(s) which replaced the current instance.
Parameters
contentThe content with which to replace the current element.
interpretContentAsStructureIf set to true then the content is interpreted as structure.

Implemented in CSF.Zpt.Rendering.ZptElement, CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, and CSF.Zpt.DocumentProviders.ZptHtmlElement.

IZptElement CSF.Zpt.Rendering.IZptElement.SearchAncestorsByAttribute ( ZptNamespace  attributeNamespace,
string  name 
)

Recursively searches upwards in the DOM tree, returning the first (closest) ancestor element which has an attribute matching the given criteria.

Returns
The closest ancestor element, or a null reference if no ancestor was found.
Parameters
attributeNamespaceThe attribute namespace.
nameThe attribute name.

Implemented in CSF.Zpt.Rendering.ZptElement.

IZptElement [] CSF.Zpt.Rendering.IZptElement.SearchChildrenByAttribute ( ZptNamespace  attributeNamespace,
string  name 
)

Recursively searches the children of the current instance, returning a collection of elements which have an attribute matching the given criteria.

Returns
The matching child elements.
Parameters
attributeNamespaceThe attribute namespace.
nameThe attribute name.

Implemented in CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptHtmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, and CSF.Zpt.Rendering.ZptElement.

void CSF.Zpt.Rendering.IZptElement.SetAttribute ( string  name,
string  value 
)

Sets the value of an attribute.

Parameters
nameThe attribute name.
valueThe attribute value.

Implemented in CSF.Zpt.Rendering.ZptElement.

void CSF.Zpt.Rendering.IZptElement.SetAttribute ( ZptNamespace  attributeNamespace,
string  name,
string  value 
)

Sets the value of an attribute.

Parameters
attributeNamespaceThe attribute namespace.
nameThe attribute name.
valueThe attribute value.

Implemented in CSF.Zpt.DocumentProviders.ZptHtmlElement, CSF.Zpt.DocumentProviders.ZptXmlElement, CSF.Zpt.DocumentProviders.ZptXmlLinqElement, and CSF.Zpt.Rendering.ZptElement.

string CSF.Zpt.Rendering.IZptElement.ToString ( )

Returns a System.String that represents the current IZptElement.

Returns
A System.String that represents the current IZptElement.

Implemented in CSF.Zpt.Rendering.ZptElement, CSF.Zpt.DocumentProviders.ZptHtmlElement, CSF.Zpt.DocumentProviders.ZptXmlElement, and CSF.Zpt.DocumentProviders.ZptXmlLinqElement.

Property Documentation

bool CSF.Zpt.Rendering.IZptElement.CanWriteCommentWithoutParent
get

Gets a value indicating whether or not this instance can write a comment node to a node that does not have a parent.

true if this instance can write a comment node if it does not have a parent; otherwise, false.

bool CSF.Zpt.Rendering.IZptElement.HasParent
get

Gets a value indicating whether this instance has a parent element or not.

true if this instance has a parent element; otherwise, false.

bool CSF.Zpt.Rendering.IZptElement.IsImported
get

Gets a value indicating whether this instance represents an element imported from another document tree.

true if this instance is imported; otherwise, false.

bool CSF.Zpt.Rendering.IZptElement.IsRoot
get

Gets a value indicating whether this instance is the root of its parent document.

true if this instance is the root element; otherwise, false.

string CSF.Zpt.Rendering.IZptElement.Name
get

Gets the element name.

The name.

IZptDocument CSF.Zpt.Rendering.IZptElement.OwnerDocument
get

Gets the IZptDocument instance to which the current instance belongs.

Type CSF.Zpt.Rendering.IZptElement.ZptDocumentType
get

Gets a System.Type indicating the type of IZptDocument to which the current instance belongs.

The type of ZPT document implementation.


The documentation for this interface was generated from the following file: