-
Notifications
You must be signed in to change notification settings - Fork 0
Set XmlValue
external help file: SelectXmlExtensions.dll-Help.xml Module Name: SelectXmlExtensions online version: schema: 2.0.0
Sets the value of a node found by Select-Xml.
Set-XmlValue [-Value] <String> -SelectXmlInfo <SelectXmlInfo> [-ProgressAction <ActionPreference>]
[<CommonParameters>]
Set-XmlValue -AttributeName <String> -AttributeValue <String> [-AttributeNamespaceUri <String>]
-SelectXmlInfo <SelectXmlInfo> [-ProgressAction <ActionPreference>] [<CommonParameters>]
This cmdlet sets the text value of a selected XML node.
PS C:\> ('<a href="https://old.example.com/">link</a>' |Select-Xml /a/@href |Set-XmlValue https://new.example.org/).OuterXml
<a href="https://new.example.org/">link</a>
PS C:\> ('<a href="https://example.com/">link</a>' |Select-Xml /a |Set-XmlValue Example).OuterXml
<a href="https://example.com/">Example</a>
PS C:\> ('<a href="https://old.example.com/">link</a>' |Select-Xml /a |Set-XmlValue -AttributeName href -AttributeValue https://new.example.org/).OuterXml
<a href="https://new.example.org/">Example</a>
PS C:\> ('<a>link</a>' |Select-Xml /a |Set-XmlValue -AttributeName href -AttributeValue https://example.com/).OuterXml
<a href="https://example.com/">Example</a>
PS C:\> ('<a href="https://example.com/">link</a>' |Select-Xml /a |Set-XmlValue -AttributeName title -AttributeValue 'Example site').OuterXml
<a href="https://example.com/" title="Example site">link</a>
The output from Select-Xml.
Type: SelectXmlInfo
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseThe new text value of the node.
Type: String
Parameter Sets: NodeValue
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe name of an attribute to set for selected elements (ignored for other node types).
Type: String
Parameter Sets: AttributeValue
Aliases: AN, NameOfAttribute
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe optional namespace URI for the attribute name.
Type: String
Parameter Sets: AttributeValue
Aliases: NS, NamespaceUri
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe value of an attribute to set for selected elements (ignored for other node types).
Type: String
Parameter Sets: AttributeValue
Aliases: AV, ValueOfAttribute
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
The output from Select-Xml.
The modified XML document (if not selected from a file).