Help a newbie with Powershell and XML?

  • I have an XML file as follows:

    <Projects> <Project ProjectName = "DeploymentPackageTest" ProjectFolder = "Test"> <Parameters> <Parameter parmName = "LocalHostTest_ConnectionString" parmDataType = "string" parmReq="True" parmSensitive = "False" parmValue = "Data Source=.;Initial Catalog=TEST;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;" parmDesc = "This is a test"> </Parameter> <Parameter parmName = "TestParameter" parmDataType = "string" parmReq="True" parmSensitive = "False" parmValue = "This is a test" parmDesc = "This is a test"> </Parameter> </Parameters> <Packages> <Package PackageName = "SSISDeploy" varName = "TESTDB_ConnectionString" varValue = "Data Source=.;Initial Catalog=TEST;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;"> </Package> <Package PackageName = "SSISDeploy" varName = "TheTestParameter" varValue = "This is still a test"> </Package> </Packages> </Project> </Projects>

    And this code as follows:

    [xml]$XMLProject = Get-Content -Path C:\TEST\XML\SampleProjectsXML2.xml
    $ProjectName = $XMLProject.Projects.Project.GetAttribute("ProjectName")
    $FolderName = $XMLProject.Projects.Project.GetAttribute("ProjectFolder")

    Now I need to read through multiple <Package> and <Parameter> nodes and load their data into an array.

    This is where I got lost.  My set based brain hurts enough in this object oriented world but I have to make this work.

    Help!

    Brad Feaker"Tantum religio potuit suadere malorum." - Lucretius

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply