Schema for CLI XML output
-
Sunday, January 06, 2013 3:30 PM
Can somewhere tell me where I can find the content for the XML Schema:
http://schemas.microsoft.com/powershell/2004/04
I am trying to serialize/deserialize this XML with some non powershell tools.
Thanks in advance!!
All Replies
-
Sunday, January 06, 2013 5:07 PM
I don't know if a formal schema ever was written for it; it's kind of an oddity since the actual nodes are .NET objects serialized in a stan
Snover mentioned it as Appendix E when he blogged about the original standard here:
http://blogs.msdn.com/b/powershell/archive/2007/05/17/microsoft-command-line-standard.aspx
However, the standard at http://technet.microsoft.com/en-us/library/ee156811.aspx only shows an example in Appendix E (and Appendix F looks like placeholder).
From past inspection of CLI XML output, I think the reason there's no formal schema is that PowerShell wound up using the default .NET XML serialization. It appears to me that all Export-CliXml does is basically bag up the output and put it into a file.
This makes a general schema awkward, because there isn't apparently a general schema for this output (although I think .NET's serializer may write a dynamic schema for serialized objects, including only info for the data types that were serialized).
Here's the general info page on the current serializer in .NET:
http://msdn.microsoft.com/en-us/library/system.xml.serialization.aspx
and here's an article discussing the serializer and schema from the early framework versions:
http://msdn.microsoft.com/en-us/library/90c86ass(v=vs.71).aspx
Although the schema tool discussed there can be helpful, I think the real answer to the problem is finding a schema that defines in general form how .NET serializes objects.
-
Sunday, January 06, 2013 6:49 PM
Can somewhere tell me where I can find the content for the XML Schema:
http://schemas.microsoft.com/powershell/2004/04
I am trying to serialize/deserialize this XML with some non powershell tools.
Thanks in advance!!
The following is the schema:
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
The namespace reference applies the schema. You can reference this in any XML edit tools that support namespaces and will perform as expected. This works in Visual Studio and other Microsoft Products and all vendor products that support schemas.
I suspect that the schema is hidden to allow the vendor to make changes to it and not allow others to create local copies.
Some tools can extract the schema dynamically.
The CliXml file is not intended to be executed or used by any tools other than PowerShell.
If you want to make objects portable look into serialize/deserialize. It is object specific so will not allow intersystem(Unix) transmission.
¯\_(ツ)_/¯
- Edited by jrvMicrosoft Community Contributor Sunday, January 06, 2013 6:56 PM
-
Sunday, January 06, 2013 7:01 PM
Here is the serialization documentation for the object schemas.
http://msdn.microsoft.com/en-us/library/dd341950.aspx
Most types are referenced to W3C schema types.
Happy New Year ¯\_(ツ)_/¯
- Proposed As Answer by Alex K. Angelopoulos Wednesday, January 09, 2013 3:58 AM
- Marked As Answer by Bill_StewartMicrosoft Community Contributor, Moderator Tuesday, January 22, 2013 9:21 PM
-
Sunday, January 06, 2013 7:10 PM
Documentation on Open Standards:
http://msdn.microsoft.com/en-us/library/dd341950.aspx
Happy New Year ¯\_(ツ)_/¯
-
Sunday, January 06, 2013 7:22 PM
Here is the PDF with a detailed description of the serialization/deserialization and a reference to the schema used.
http://download.microsoft.com/download/9/5/E/95EF66AF-9026-4BB0-A41D-A4F81802D92C/[MS-PSRP].pdf
CliXml uses this serialization schema.
Happy New Year ¯\_(ツ)_/¯

