ZPT-Sharp
v1.0.0
Zope Page Templates for .NET
|
Implementation of ZptElement based on documents parsed using the HTML Agility Pack. More...
Public Member Functions | |
override string | ToString () |
Returns a System.String that represents the current ZptHtmlElement. More... | |
override bool | Equals (ZptElement other) |
Determines whether the specified CSF.Zpt.Rendering.ZptElement is equal to the current CSF.Zpt.DocumentProviders.ZptHtmlElement. More... | |
override int | GetHashCode () |
Serves as a hash function for a CSF.Zpt.DocumentProviders.ZptHtmlElement object. More... | |
override IZptElement | ReplaceWith (IZptElement replacement) |
Replaces the current element in its respective DOM with the given replacement. More... | |
override IZptElement[] | ReplaceWith (string content, bool interpretContentAsStructure) |
Replaces the current element instance with the given content. More... | |
override void | ReplaceChildrenWith (string content, bool interpretContentAsStructure) |
Removes all children of the current element instance and replaces them with the given content. More... | |
override 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... | |
override 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... | |
override IZptElement | GetParentElement () |
Gets the element which is the parent of the current instance. More... | |
override IZptElement[] | GetChildElements () |
Gets a collection of the child elements from the current source element. More... | |
override IZptAttribute[] | GetAttributes () |
Gets a collection of the attributes present upon the current element. More... | |
override 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... | |
override void | SetAttribute (ZptNamespace attributeNamespace, string name, string value) |
Sets the value of an attribute. More... | |
override void | RemoveAttribute (ZptNamespace attributeNamespace, string name) |
Removes a named attribute. More... | |
override 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... | |
override void | PurgeAttributes (ZptNamespace attributeNamespace) |
Recursively searches for attributes with a given namespace or prefix and removes them from their parent element. More... | |
override void | PurgeElements (ZptNamespace elementNamespace) |
Recursively searches for elements with a given namespace or prefix and removes them using the Omit behaviour. More... | |
override void | AddCommentBefore (string comment) |
Adds a new comment to the DOM immediately before the current element. More... | |
override void | AddCommentInside (string comment) |
Adds a new comment to the DOM inside the current element as its first child. More... | |
override void | AddCommentAfter (string comment) |
Adds a new comment to the DOM immediately after the current element. More... | |
override IZptElement | Clone () |
Clone this instance into a new Element instance, which may be manipulated without affecting the original. More... | |
override IZptElement[] | Omit () |
Omits the current element, replacing it with its children. More... | |
override void | Remove () |
Removes the current element from the DOM. More... | |
override void | RemoveAllChildren () |
Removes all child elements from the current element. More... | |
override bool | IsInNamespace (ZptNamespace nSpace) |
Determines whether or not the current instance is in the specified namespace. More... | |
override bool | IsFromSameDocumentAs (IZptElement other) |
Determines whether this instance is from same document as the specified element. More... | |
override IZptDocument | CreateDocumentFromThisElement () |
Creates a new IZptDocument which contains only the current element and its children. More... | |
ZptHtmlElement (HtmlNode node, ISourceInfo sourceFile, IZptDocument ownerDocument, bool isRoot=false, bool isImported=false) | |
Initializes a new instance of the CSF.Zpt.DocumentProviders.ZptHtmlElement class. More... | |
![]() | |
ISourceInfo | GetSourceInfo () |
Gets information about the source of the current element. More... | |
override bool | Equals (object obj) |
Determines whether the specified System.Object is equal to the current CSF.Zpt.Rendering.ZptElement. More... | |
virtual bool | Equals (IZptElement obj) |
Determines whether the specified CSF.Zpt.Rendering.IZptElement is equal to the current CSF.Zpt.Rendering.ZptElement. More... | |
virtual 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... | |
virtual void | SetAttribute (string name, string value) |
Sets the value of an attribute. More... | |
virtual void | RemoveAttribute (string name) |
Removes a named attribute. More... | |
virtual 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... | |
virtual string | GetFileLocation () |
Gets the file location (typically a line number) for the current instance. More... | |
virtual string | GetEndTagFileLocation () |
Gets the file location (typically a line number) for the end tag matched with the current instance. More... | |
virtual string | GetOriginalContextEndTagLocation () |
Gets the file location (typically a line number) for the end tag of an 'original context'. More... | |
virtual ISourceInfo | GetOriginalContextSourceInfo () |
Gets information about the source of the current element. More... | |
virtual string | GetFullFilePathAndLocation () |
Gets the full file path and location for the current element. More... | |
virtual void | CacheSourceInformationInAttributes () |
Writes information to the underlying element's attributes recording its source information. More... | |
virtual void | MarkAsImported (IZptElement originalElement) |
Marks the current element as being imported into its parent document (IE: it represents a context switch). More... | |
ZptElement (ISourceInfo sourceFile, bool isRoot, bool isImported, IZptDocument ownerDocument, ISourceInfoFactory sourceInfoCreator=null) | |
Initializes a new instance of the CSF.Zpt.Rendering.ZptElement class. More... | |
Protected Member Functions | |
override string | GetNativeFileLocation () |
Gets the file location (typically a line number) for the current instance. More... | |
override string | GetNativeEndTagFileLocation () |
Gets the file location (typically a line number) for the end tag matched with the current instance. More... | |
![]() | |
virtual TElement | ConvertTo< TElement > (IZptElement element) |
Converts the given IZptElement to an implementation-specific subclass, or raises an exception if the conversion is not valid. More... | |
virtual void | EnforceParentNodeNotNull (object parentNode) |
Enforces that an System.Object (representing a parent node) is not null, raising an exception if it is not. More... | |
virtual void | EnforceNodeType< TNodeType > (string expectedNodeLanguage, TNodeType expectedNodeType, TNodeType actualNodeType) |
Enforces that two objects (expected and actual), representing node types, are equal. Raises an exception if they are not. More... | |
ZptElement () | |
Fake constructor for Mocking framework usage only. Do not call. More... | |
Properties | |
HtmlNode | Node [get] |
Gets the HTML node object wrapped by the current instance. More... | |
override string | Name [get] |
Gets the element name. More... | |
override bool | HasParent [get] |
Gets a value indicating whether this instance has a parent element or not. More... | |
override Type | ZptDocumentType [get] |
Gets a System.Type indicating the type of IZptDocument to which the current instance belongs. More... | |
override 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... | |
![]() | |
abstract string | Name [get] |
Gets the element name. More... | |
virtual bool | IsRoot [get] |
Gets a value indicating whether this instance is the root of its parent document. More... | |
abstract bool | HasParent [get] |
Gets a value indicating whether this instance has a parent element or not. More... | |
virtual bool | IsImported [get] |
Gets a value indicating whether this instance represents an element imported from another document tree. More... | |
abstract Type | ZptDocumentType [get] |
Gets a System.Type indicating the type of IZptDocument to which the current instance belongs. More... | |
abstract 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... | |
virtual IZptDocument | OwnerDocument [get] |
Gets the IZptDocument instance to which the current instance belongs. More... | |
![]() | |
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... | |
Additional Inherited Members | |
![]() | |
static void | EnforceNameNotEmpty (string name) |
Enforces that a name must not be null or empty, raising an exception if it is. More... | |
Implementation of ZptElement based on documents parsed using the HTML Agility Pack.
|
inline |
Initializes a new instance of the CSF.Zpt.DocumentProviders.ZptHtmlElement class.
node | The source HTML node. |
sourceFile | Information about the element's source file. |
isRoot | Whether or not this is the root element. |
isImported | Whether or not this element is imported. |
ownerDocument | The ZPT document which owns the element. |
|
inlinevirtual |
Adds a new comment to the DOM immediately after the current element.
comment | The comment text. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Adds a new comment to the DOM immediately before the current element.
comment | The comment text. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Adds a new comment to the DOM inside the current element as its first child.
comment | The comment text. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Clone this instance into a new Element instance, which may be manipulated without affecting the original.
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Creates a new IZptDocument which contains only the current element and its children.
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Determines whether the specified CSF.Zpt.Rendering.ZptElement is equal to the current CSF.Zpt.DocumentProviders.ZptHtmlElement.
other | The CSF.Zpt.Rendering.ZptElement to compare with the current CSF.Zpt.DocumentProviders.ZptHtmlElement. |
true
if the specified CSF.Zpt.Rendering.ZptElement is equal to the current CSF.Zpt.DocumentProviders.ZptHtmlElement; otherwise, false
. Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Gets an attribute which matches the given criteria, or a null
reference is no matching attribute is found.
null
reference.attributeNamespace | The attribute namespace. |
name | The attribute name. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Gets a collection of the attributes present upon the current element.
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Gets a collection of the child elements from the current source element.
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Serves as a hash function for a CSF.Zpt.DocumentProviders.ZptHtmlElement object.
Implements CSF.Zpt.Rendering.ZptElement.
|
inlineprotectedvirtual |
Gets the file location (typically a line number) for the end tag matched with the current instance.
Implements CSF.Zpt.Rendering.ZptElement.
|
inlineprotectedvirtual |
Gets the file location (typically a line number) for the current instance.
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Gets the element which is the parent of the current instance.
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
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.
existing | An existing child element, after which the child will be inserted. |
newChild | The new child element to insert. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
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.
existing | An existing child element, before which the child will be inserted. |
newChild | The new child element to insert. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Determines whether this instance is from same document as the specified element.
true
if this instance is from same document as the specified element; otherwise, false
.other | The element to test. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Determines whether or not the current instance is in the specified namespace.
true
if this instance is in the specified namespace; otherwise, false
. nSpace | The namespace for which to test. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Omits the current element, replacing it with its children.
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Recursively searches for attributes with a given namespace or prefix and removes them from their parent element.
attributeNamespace | The attribute namespace. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Recursively searches for elements with a given namespace or prefix and removes them using the Omit behaviour.
elementNamespace | The element namespace. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Removes the current element from the DOM.
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Removes all child elements from the current element.
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Removes a named attribute.
attributeNamespace | The attribute namespace. |
name | The attribute name. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Removes all children of the current element instance and replaces them with the given content.
content | The content with which to replace the children of the current element. |
interpretContentAsStructure | If set to true then the content is interpreted as structure. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Replaces the current element in its respective DOM with the given replacement.
replacement | Replacement. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Replaces the current element instance with the given content.
content | The content with which to replace the current element. |
interpretContentAsStructure | If set to true then the content is interpreted as structure. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Recursively searches the children of the current instance, returning a collection of elements which have an attribute matching the given criteria.
attributeNamespace | The attribute namespace. |
name | The attribute name. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Sets the value of an attribute.
attributeNamespace | The attribute namespace. |
name | The attribute name. |
value | The attribute value. |
Implements CSF.Zpt.Rendering.ZptElement.
|
inlinevirtual |
Returns a System.String that represents the current ZptHtmlElement.
Implements CSF.Zpt.Rendering.ZptElement.
|
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
.
|
get |
Gets a value indicating whether this instance has a parent element or not.
true
if this instance has a parent element; otherwise, false
.
|
get |
Gets the element name.
The name.
|
get |
Gets the HTML node object wrapped by the current instance.
The node.
|
get |
Gets a System.Type
indicating the type of IZptDocument to which the current instance belongs.
The type of ZPT document implementation.