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 8841173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:38:50+00:00 2026-06-14T10:38:50+00:00

For this problem, I will paste a sample stanza from the xml file I

  • 0

For this problem, I will paste a sample stanza from the xml file I am working with, then discuss what I am trying to do with it.

I have an xml file with stanzas that look like this:

<mb model="460" rev="dba">
        <dmiblock block="Base Board Information">
                <dmiattr name="Manufacturer" value="MSI"/>
                <dmiattr name="Product Name" value="H61M-P25 (MS-7680)"/>
        </dmiblock>
        <dmiblock block="Memory Device">
                <dmiattr name="Bank Locator" value="A1_BANK0"/>
                <dmiattr name="Size" value="4096 MB"/>
        </dmiblock>
        <dmiblock block="Memory Device">
                <dmiattr name="Bank Locator" value="A1_BANK1"/>
                <dmiattr name="Size" value="No Module Installed"/>
        </dmiblock>
        <dmiblock block="Memory Device">
                <dmiattr name="Bank Locator" value="A1_BANK2"/>
                <dmiattr name="Size" value="No Module Installed"/>
        </dmiblock>
        <dmiblock block="Memory Device">
                <dmiattr name="Bank Locator" value="A1_BANK3"/>
                <dmiattr name="Size" value="No Module Installed"/>
        </dmiblock>

        <cpublock number="0">
                <cpuattr name="model name" value="Intel(R) Pentium(R) CPU G850 @ 2.90GHz"/>
        </cpublock>
        <cpublock number="1">
                <cpuattr name="model name" value="Intel(R) Pentium(R) CPU G850 @ 2.90GHz"/>
        </cpublock>
        <pciblock block="NIC">
                <pciattr string="Intel Corporation 82574L Gigabit Network Connection" number="2" />
        </pciblock>
        <blockblock block="model">
                <blockattr value="8GB SATA SSD T 3" number="1" />
                <blockattr value="WDC WD5003ABYX-0" number="1" />
        </blockblock>
</mb>

I am trying to find stanzas based on the value of the attributes model from the mb node and the value attribute from the second element in the first child of the mb node. So, in the stanza above, I would be trying to match against model="460" and value="H61M-P25 (MS-7680)". Having matched against that, I’d want to put rev="dba" in a list and continue searching for other stanzas with the same attributes in other mb nodes.

I haven’t gotten very far at all, I keep getting tripped on the types. I am using this to work from.

import Text.XML
import Text.XML.Cursor
import qualified Data.Text as T


getProfiles :: AdviseConf -> IO () -- AdviseResult
getProfiles  (AdviseConf model mb) = do
   doc <- Text.XML.readFile def xmlFile
   let cursor = fromDocument doc
   _ <- Prelude.writeFile "test.txt" $
        show                         $
        T.concat                     $
        cursor                       $//
        element "mb"                 >=>
        attributeIs "model" "460"    >=>
        element "dmiattr"            >=>
        attributeIs "value" "H61M-P25 (MS-7680)" 
        &// content  

I know the final function content is wrong, but I dont know which would be right. I’m trying to capture all the rev attributes from the nodes that match.

So, when I play with the above, I either end up with an empty list, junk characters, or a type error. Any help would be appreciated.

  • 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-06-14T10:38:51+00:00Added an answer on June 14, 2026 at 10:38 am
    1. I think you’re looking for the attribute function.
    2. By using >=> element "dmiattr" you’re saying “the current element’s name is dmiattr‘. I think you might mean &/ element "dmiattr". But since you want the @rev attribute of the parent, you probably need to use the check function instead.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hope someone will give me a hand with this problem I have. So here
This problem is going to be hard for me to explain but I will
Seems that This will be an easy question for you but this problem is
there's this interesting problem i can not solve myself. I will be very glad,
This is kind of a oddball problem so I will try to describe the
You will suppose this is a big question.but there might be a simple problem
Problem: I would like to share code between multiple assemblies. This shared code will
I have search throughout this site to find a answer to my problem and
Well, I am facing a strange problem. I have developed a sample MFC ribbon
Edit: I've edited the sample to better resemble the problem I have, now the

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.