- <#
- .SYNOPSIS
- This script re-implements an MSDN Sample in PowerShell
- .DESCRIPTION
- This script creates and manipulates an XML Document
- .NOTES
- File Name : Get-XMLNode.ps1
- Author : Thomas Lee - tfl@psp.co.uk
- Requires : PowerShell Version 2.0
- .LINK
- This script posted to:
- http://www.pshscripts.blogspot.com
- MSDN Sample posted at:
- http://msdn.microsoft.com/en-us/library/system.xml.xmlelement.name.aspx
- .EXAMPLE
- [ps] c:\foo> .\Get-XMLElement.ps1
- bk:ISBN = 1-861001-57-5
- namespaceURI=urn:samples
- #>
- # Create new document
- $doc = New-Object System.Xml.XmlDocument
- # Load XML document from text
- $doc.LoadXml("<book xmlns:bk='urn:samples'>" +
- "<bk:ISBN>1-861001-57-5</bk:ISBN>" +
- "<title>Pride And Prejudice</title>" +
- "</book>")
- # Display information on the ISBN element.
- $elem = $doc.DocumentElement.FirstChild;
- "{0} = {1}" -f $elem.Name, $elem.InnerText
- "`tnamespaceURI=" + $elem.NamespaceURI
- # End of Script
This blog contains PowerShell scripts, more PowerShell scripts and still more PowerShell scripts. Occasionally you may see some organisational posts.
Thursday, 17 June 2010
Get-XMLNode.ps1
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment