xml parsing

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 5 years, 9 months ago.

  • Author
    Posts
  • #5435

    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 :

    $test2.UDSObjectList.UDSObject
    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:

    $test2.UDSObjectList.UDSObject.attributes.attribute
    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...

    Thanks.

    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 : pcat:66443403 DataType="2002">symAlerting
    InnerText : pcat:66443403symAlerting
    NextSibling : UDSObject
    PreviousSibling :
    Value :
    ChildNodes : {Handle, Attributes}
    FirstChild : Handle
    LastChild : Attributes
    HasChildNodes : True
    IsReadOnly : False
    OuterXml : pcat:66443403sym ttrValue>Alerting
    BaseURI :

You must be logged in to reply to this topic.