Reading XML

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of kvprasoon kvprasoon 3 months, 2 weeks ago.

  • Author
    Posts
  • #63959
    Profile photo of JC
    JC
    Participant

    I have a simple XML file with the regular "header" and one root element containing multiple child elements where some contain values describing the host and some are empty. My problem is when I save my xml into a variable
    [xml]$xml = Get-Content host.xml
    $details = $xml.host

    I then try to extract the values for of the child elements like so
    $xml.host.serialNumber – this works. But when I use my $details variable it doesn't.
    $details.serialNumber – this doesn't.
    What am I missing?

  • #64239
    Profile photo of kvprasoon
    kvprasoon
    Participant

    This is strange,

    Which PS Version ?
    Can you post the content of xml or any test xml content where you face this issue.
    and are you getting any error ?

    Regards,
    kvprasoon

You must be logged in to reply to this topic.