Class XhtmlString

A xhtml string value. This class is a container for string fragments.

Inheritance
System.Object
XhtmlString
Implements
System.Web.IHtmlString
System.Runtime.Serialization.ISerializable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 8.11.0
Syntax
public class XhtmlString : IHtmlString, ISerializable, IReadOnly<XhtmlString>, IReadOnly

Constructors

XhtmlString()

Initializes a new instance of the XhtmlString class.

Declaration
public XhtmlString()

XhtmlString(SerializationInfo, StreamingContext)

Initializes a new instance of the XhtmlString class.

Declaration
protected XhtmlString(SerializationInfo info, StreamingContext context)
Parameters
Type Name Description
System.Runtime.Serialization.SerializationInfo info

The serialization info.

System.Runtime.Serialization.StreamingContext context

The serialization context.

XhtmlString(String)

Initializes a new instance of the XhtmlString class.

Declaration
public XhtmlString(string unparsedString)
Parameters
Type Name Description
System.String unparsedString

The unparsed xhtml string.

Properties

FragmentParser

Gets or sets the fragment parser that should be used by the current instance.

Declaration
public virtual Injected<IFragmentParser> FragmentParser { get; set; }
Property Value
Type Description
Injected<IFragmentParser>
Remarks

The fragment parser is mainly exposed for testing purposes.

Fragments

Gets a collection of string fragments that this instance consists of.

Declaration
public virtual StringFragmentCollection Fragments { get; }
Property Value
Type Description
StringFragmentCollection

IsEmpty

Gets a value indicating if this instance has any fragments.

Declaration
public bool IsEmpty { get; }
Property Value
Type Description
System.Boolean

true if this instance has any fragments; otherwise, false.

IsModified

Gets or sets a value indicating whether this instance is modified.

Declaration
public virtual bool IsModified { get; set; }
Property Value
Type Description
System.Boolean

true if this instance is modified; otherwise, false.

IsReadOnly

Gets a value indicating whether this instance is read only.

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
System.Boolean

ParserMode

Gets or sets the parser mode that should be used by the current instance.

Declaration
public virtual FragmentParserMode ParserMode { get; set; }
Property Value
Type Description
FragmentParserMode

Methods

Copy()

Creates a deep copy of this instance.

Declaration
public virtual XhtmlString Copy()
Returns
Type Description
XhtmlString

A copy of the current instance.

CreateStringFragments(String)

Creates a collection containing string fragments from the unparsed string.

Declaration
protected virtual StringFragmentCollection CreateStringFragments(string unparsedString)
Parameters
Type Name Description
System.String unparsedString

The unparsed XHTML string.

Returns
Type Description
StringFragmentCollection

A new StringFragmentCollection containing fragments from the provided string.

CreateWritableClone()

Creates a writable clone of this instance.

Declaration
public XhtmlString CreateWritableClone()
Returns
Type Description
XhtmlString
Remarks

Override CreateWriteableCloneImplementation() to change the clone.

CreateWriteableCloneImplementation()

Creates a writable deep clone of the current object.

Declaration
protected virtual XhtmlString CreateWriteableCloneImplementation()
Returns
Type Description
XhtmlString

A writable copy of the current instance.

GetObjectData(SerializationInfo, StreamingContext)

Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.

Declaration
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type Name Description
System.Runtime.Serialization.SerializationInfo info

The System.Runtime.Serialization.SerializationInfo to populate with data.

System.Runtime.Serialization.StreamingContext context

The destination (see System.Runtime.Serialization.StreamingContext) for this serialization.

Exceptions
Type Condition
System.Security.SecurityException

The caller does not have the required permission.

MakeReadOnly()

Makes this instance read only.

Declaration
public virtual void MakeReadOnly()
Remarks

It will also make its Fragments readonly.

ThrowIfReadOnly()

Declaration
protected void ThrowIfReadOnly()

ToEditString()

Gets the string representation of the current instance in edit mode.

Declaration
public virtual string ToEditString()
Returns
Type Description
System.String

ToHtmlString()

Returns an HTML-encoded string.

Declaration
public virtual string ToHtmlString()
Returns
Type Description
System.String

An HTML-encoded string.

ToHtmlString(IPrincipal)

Returns an HTML-encoded string as a selected principal.

Declaration
public virtual string ToHtmlString(IPrincipal principal)
Parameters
Type Name Description
System.Security.Principal.IPrincipal principal

The principal to use when receiving the string.

Returns
Type Description
System.String

An HTML-encoded string.

ToInternalString()

Gets the internal string representation of the current instance.

Declaration
public virtual string ToInternalString()
Returns
Type Description
System.String

ToString()

Returns a System.String that represents this instance.

Declaration
public override string ToString()
Returns
Type Description
System.String

A System.String that represents this instance.

Overrides
System.Object.ToString()

Explicit Interface Implementations

IReadOnly.CreateWritableClone()

Creates a writable clone of this instance.

Declaration
object IReadOnly.CreateWritableClone()
Returns
Type Description
System.Object
Remarks

Override CreateWriteableCloneImplementation() to change the clone.

Implements

System.Web.IHtmlString
System.Runtime.Serialization.ISerializable

Extension Methods