external help file | Module Name | online version | schema |
---|---|---|---|
SelectXmlExtensions.dll-Help.xml |
SelectXmlExtensions |
2.0.0 |
Sets the value of a node found by Select-Xml.
Set-XmlValue [-Value] <String> -SelectXmlInfo <SelectXmlInfo> [<CommonParameters>]
Set-XmlValue -AttributeName <String> -AttributeValue <String> [-AttributeNamespaceUri <String>]
-SelectXmlInfo <SelectXmlInfo> [<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: False
The 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: False
The 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: False
The 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: False
The 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
This 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).