Tuesday, May 15, 2007

Using XPathDocument in a Windows Powershell script

PS C:\Users\Chris> $xdoc = new-object -typename System.Xml.XPath.XPathDocument -ArgumentList C:\Users\Chris\Documents\basketball.xml

PS C:\Users\Chris> $nav = $xdoc.CreateNavigator()

PS C:\Users\Chris> $nav.Select("/Season/Games/Game/AwayTeam/Name") Format-Table -property Value

Value
-----
Vermont
Hampton
Hampton
Youngstown St.
Brown
Vermont
Brown
Chicago St.
Youngstown St.
Alcorn St.
Alabama A&M
South Dakota St.
Pennsylvania
Loyola Chicago
Army
UAB
Davidson
Loyola MD
Monmouth
Eastern Illinois
Alcorn St.
Montreat
Mount St. Mary's
George Washington
Defiance
New Hampshire
Wofford
American
Stony Brook
Howard
Asbury
Lafayette

No comments: