Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Format-Xml

Format-Xml

pscx.dll

Synopsis

PSCX Cmdlet: Pretty print for XML files and XmlDocument objects.

Syntax

Format-Xml [-Path] [-AttributesOnNewLine] [-ConformanceLevel] [-EnableDtd] [-IndentString] [-OmitXmlDeclaration] [<CommonParameters>]

Format-Xml [-InputObject] [-AttributesOnNewLine] [-ConformanceLevel] [-EnableDtd] [-IndentString] [-OmitXmlDeclaration] [<CommonParameters>]

Format-Xml [-LiteralPath] [-AttributesOnNewLine] [-ConformanceLevel] [-EnableDtd] [-IndentString] [-OmitXmlDeclaration] [<CommonParameters>]

Detailed Description

Pretty print for XML files and XmlDocument objects.

Parameters

-LiteralPath <String[]>

Specifies a path to the item. The value of -LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Path <String[]>

Specifies the path to the file to process. Wildcard syntax is allowed.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

true

-InputObject <PSObject>

Accepts an object as input to the cmdlet. Enter a variable that contains the objects or type a command or expression that gets the objects.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByValue)

Accept wildcard characters?

false

-AttributesOnNewLine <SwitchParameter>

Write attributes on a new line.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-ConformanceLevel <ConformanceLevel>

Conformance level for XML.

Aliases

None

Required?

false

Position

named

Default value

Auto

Accept pipeline input?

false

Accept wildcard characters?

false

-EnableDtd <SwitchParameter>

Enables document type definition (DTD) processing.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-IndentString <String>

The string to use for indenting.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-OmitXmlDeclaration <SwitchParameter>

Omit the XML declaration element.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type


Return Type


Notes

Examples

-------------------------- EXAMPLE 1 --------------------------

Formats the XML in foo.xml in a "pretty print" manner.

C:\PS> Format-Xml foo.xml

-------------------------- EXAMPLE 2 --------------------------

Formats the XML in foo.xml in a "pretty print" manner putting each attribute on a new line.

C:\PS> Format-Xml foo.xml -AttributesOnNewLine

-------------------------- EXAMPLE 3 --------------------------

Formats the XML in foo.xml which uses a DTD in a "pretty print" manner.

C:\PS> Format-Xml foo.xml -EnableDtd

Convert-Xml
Test-Xml