> ## Documentation Index
> Fetch the complete documentation index at: https://easyaf.nimbleapps.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# XmlMixedElement

> Represents a child element in mixed content. This class cannot be inherited.

## Definition

**Assembly:** CloudNimble.XmlEssentials.dll

**Namespace:** CloudNimble.Text.Xml.Serialization

**Inheritance:** CloudNimble.Text.Xml.Serialization.XmlMixedContentItem

## Syntax

```csharp theme={"dark"}
CloudNimble.Text.Xml.Serialization.XmlMixedElement
```

## Summary

Represents a child element in mixed content. This class cannot be inherited.

## Usage

An `XmlMixedElement` is a child element inside mixed content. Its `Element` property holds the element as an `XmlElementNode`, with its attributes and everything inside it.

When you read, get the name, attributes, and content from the node. When you write, build a node and wrap it:

```csharp theme={"dark"}
var note = new XmlElementNode("Note");
note.Add(new XmlTextNode("Changes are saved to disk."));
paragraph.Content.Add(new XmlMixedText(" "));
paragraph.Content.Add(new XmlMixedElement(note));

var options = new XmlSerializerOptions { OmitXmlDeclaration = true };
output.WriteLine(XmlSerializer.Serialize(paragraph, options));
```

Added to the paragraph `Press <Key>Ctrl</Key> and <Key>S</Key> to save.`, the code produces the following output:

```xml theme={"dark"}
<Paragraph>Press <Key>Ctrl</Key> and <Key>S</Key> to save. <Note>Changes are saved to disk.</Note></Paragraph>
```

[View the complete sample on GitHub](https://github.com/CloudNimble/XmlEssentials/blob/main/src/CloudNimble.XmlEssentials.Samples/18_MixedContent.cs)

## Considerations

* An item whose `Element` is `null` is skipped when the list is written.
* The element is a DOM node, not a typed object. To turn it into an object, pass the node to `XmlSerializer.Deserialize<T>(XmlNode)`.
* The node is mutable. Changes you make to it are written the next time you serialize.

## Constructors

### &#x20;.ctor

Initializes a new instance of the [XmlMixedElement](https://easyaf.nimbleapps.cloud/xmlessentials/api-reference/CloudNimble/Text/Xml/Serialization/XmlMixedElement.md) class that has no element.

#### Syntax

```csharp theme={"dark"}
public XmlMixedElement()
```

### &#x20;.ctor

Initializes a new instance of the [XmlMixedElement](https://easyaf.nimbleapps.cloud/xmlessentials/api-reference/CloudNimble/Text/Xml/Serialization/XmlMixedElement.md) class with the specified element.

#### Syntax

```csharp theme={"dark"}
public XmlMixedElement(CloudNimble.Text.Xml.Nodes.XmlElementNode element)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `element` | `CloudNimble.Text.Xml.Nodes.XmlElementNode` | The child element. |

### &#x20;.ctor Inherited

> [!NOTE]
>
> Inherited from `CloudNimble.Text.Xml.Serialization.XmlMixedContentItem`

#### Syntax

```csharp theme={"dark"}
protected XmlMixedContentItem()
```

### &#x20;.ctor Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public Object()
```

## Properties

### &#x20;Element

Gets or sets the child element.

#### Syntax

```csharp theme={"dark"}
public CloudNimble.Text.Xml.Nodes.XmlElementNode Element { get; set; }
```

#### Property Value

Type: `CloudNimble.Text.Xml.Nodes.XmlElementNode?`
The child element, or [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) if none is set. An item whose element is [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) is not written.
The default is [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

## Methods

### &#x20;Equals Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual bool Equals(object obj)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `obj` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;Equals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public static bool Equals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;GetHashCode Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual int GetHashCode()
```

#### Returns

Type: `int`

### &#x20;GetType Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public System.Type GetType()
```

#### Returns

Type: `System.Type`

### &#x20;MemberwiseClone Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
protected internal object MemberwiseClone()
```

#### Returns

Type: `object`

### &#x20;ReferenceEquals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public static bool ReferenceEquals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;ToString Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual string ToString()
```

#### Returns

Type: `string?`

## Related APIs

* CloudNimble.Text.Xml.Serialization.XmlMixedContentItem
* CloudNimble.Text.Xml.Serialization.XmlMixedText
* CloudNimble.Text.Xml.Serialization.XmlMixedAttribute
* CloudNimble.Text.Xml.Nodes.XmlElementNode
* CloudNimble.Text.Xml.Nodes.XmlNode


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.