2.2.5 Serialization

An object MUST be converted to an XML document by the higher layer before passing it to the PowerShell Remoting Protocol. If the object type is listed in section 2.2.5.1, the higher layer MUST encode the object as specified in that section. For all other object types, the higher layer MUST encode the object as specified in section 2.2.5.2. The resulting XML document MAY have an XML declaration, as specified in [XML] section 2.8. All XML elements and attributes described in this section belong to the following XML namespace:

   http://schemas.microsoft.com/powershell/2004/04

Serialization MAY indicate the XML namespace [XMLNS-2ED] using the xmlns attribute.

The name of the root XML element depends on the type of the element being serialized. Serialization of Primitive Type Objects (section 2.2.5.1) and serialization of Complex Objects (section 2.2.5.2) describe in detail serialization of different types of objects.

The PowerShell Remoting Protocol is only responsible for transferring the XML between the client and server. The higher layer uses the information provided in section 2 to construct the object from the XML.