Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4237628
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:47:54+00:00 2026-05-21T02:47:54+00:00

I have an xml file in a format similar to this: <benchmark> <group> <id>1</id>

  • 0

I have an xml file in a format similar to this:

<benchmark>
<group>
    <id>1</id>
    <rule>
        <id>H1234</id>
        <severity>High</severity>
    </rule>
    <title>How to win</title>
</group>
<group>
    <id>2</id>
    <rule>
        <id>5317</id>
        <severity>low</severity>
    </rule>
    <title>How to not</title>
</group>
<group>
    <id>3</id>
    <rule>
        <id>H15678</id>
        <severity>medium</severity>
    </rule>
    <title>How to be</title>
</group>
<group>
    <id>4</id>
    <rule>
        <id>H454</id>
        <severity>High</severity>
    </rule>
    <title>How to lose</title>
</group></benchmark>

I would like to be able to select the group/id, group/rule/id, group/rule/severity and group/title values from each group in the xml docoument.

I have tried this but it only gets me part of the way there:

I have tried $xml.benchmark.group | %{$_} | select title, id

I appreciate your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:47:55+00:00Added an answer on May 21, 2026 at 2:47 am

    This works for me:

    $xml.benchmark.group |
    select @{ L = 'GroupID';      E = { $_.id } },
           @{ L = 'GroupTitle';   E = { $_.title } },
           @{ L = 'RuleID';       E = { $_.rule.id } },
           @{ L = 'RuleSeverity'; E = { $_.rule.severity } }
    

    yielding the following:

    GroupID GroupTitle  RuleID RuleSeverity
    ------- ----------  ------ ------------
    1       How to win  H1234  High
    2       How to not  5317   low
    3       How to be   H15678 medium
    4       How to lose H454   High
    

    The syntax above is similar to SQL’s SELECT Foo AS Bar, selecting a value (Expression or E in the hashtable) and providing an alias for display purposes (Label or L in the hashtable).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML file with format similar to: <root> <baby> <a>stuff</a> <b>stuff</b> <c>stuff</c>
For example, we have xml file with this format: <A> <B> <C></C> <D></D> <D></D>
I have an xml-file with a format similar to docx, i.e.: <w:r> <w:rPr> <w:sz
I have an XML file format that contains a structure of questions: <question id=q101>
I have an XML based file format that I'm using to store and load
I have a XML file with the following data format: <net NetName=abc attr1=123 attr2=234
I have an xml file in the following format: <food> <desert> cake <desert> </food>
I have an XSLT stylesheet that transforms an XML file to JSON format and
I have an XML file with a lot of nodes similar to the following
I have a XML file of the format: <outer1> <inner1> <name>Stonecold</name> <profession>warrior</profession> <org>wwf</org> </inner1>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.