xml parsing

by nbritton at 2013-01-15 08:39:14

I am working with a webservices script to accomplish some tasks. I am using powershell 3.0

I have the data returned from a query in xml format

[xml]$test2 = $servicedesk.doselect("$sid", "pcat", "", 5, "sym")

The problem i have is matching up the pcat (handle) to the attributes.

If i do :

i get the follow results:
Handle Attributes
------ ----------
pcat:66443403 Attributes
pcat:3522067 Attributes
pcat:5103 Attributes
pcat:66443839 Attributes
pcat:56448447 Attributes

However if i do the following i get the attributes:

DataType AttrName AttrValue
-------- -------- ---------
2002 sym Alerting
2002 sym Appleton.Add/Remove/Change Conference…
2002 sym Applications
2002 sym _Site.bu.Equipment Purchase.HEADSETS…
2002 sym `Site.sit1.Telecom

how can i match the handle to an attrvalue?

I have been trying to do selectnodes, and where-object statements. Ideally i would like to see the handle in the second table.

Any thoughts appreciated…

by nbritton at 2013-01-15 08:54:50
Here is some additonal information that may help:

PS C:\Users\nbritton> $test2.UDSObjectList.UDSObject | format-list *

Handle : pcat:66443403
Attributes : Attributes
Name : UDSObject
LocalName : UDSObject
NamespaceURI :
Prefix :
NodeType : Element
ParentNode : UDSObjectList
OwnerDocument : #document
IsEmpty : False
HasAttributes : False
SchemaInfo : System.Xml.XmlName
InnerXml : <Handle>pcat:66443403</Handle><Attributes><Attribute
InnerText : pcat:66443403symAlerting
NextSibling : UDSObject
PreviousSibling :
Value :
ChildNodes : {Handle, Attributes}
FirstChild : Handle
LastChild : Attributes
HasChildNodes : True
IsReadOnly : False
OuterXml : <UDSObject><Handle>pcat:66443403</Handle><Attributes><Attribute DataType="2002"><AttrName>sym</AttrName><A
BaseURI :