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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:46:50+00:00 2026-06-05T12:46:50+00:00

I’m new to Erlang and am trying to parse an XML document into a

  • 0

I’m new to Erlang and am trying to parse an XML document into a record. I have tried various methods (xmerl_scan/xpath) but get painted into a corner because I don’t know enough to know where to begin.

I’ve plodded through three books on the subject and spent a few hours googling the subject matter but I think I must be missing something obvious.

There must be a simple way to visit each node using some sort of pattern matching and generate a list of matches.

This is the input…

<Sports>
<Sport> SportId="1" SportName="Cricket"> 
<League LeagueId="1" LeagueName="Test Match"> 
<Meeting MeetingId="1" MeetingName="Test Match"/> 
</League> 
<League LeagueId="2" LeagueName="One Day International"> 
<Meeting MeetingId="1" MeetingName="One Day International Match""/> 
<Meeting MeetingId="2" MeetingName="One Day International Series"/> 
</League>
<League LeagueId="3" LeagueName="T20 World Cup"> 
<Meeting MeetingId="1" MeetingName="T20 World Cup Futures"/> 
</League> 
</Sport> 
<Sport SportId="7" SportName="Golf"> 
<League LeagueId="1" LeagueName="PGA Tour"> 
<Meeting MeetingId="1" MeetingName="St Jude Classic"/> 
<Meeting MeetingId="2" MeetingName="US Open"/> 
</League> 
<League LeagueId="22" LeagueName="European Tour"> 
<Meeting MeetingId="100" MeetingName="Nordea Masters"/> 
<Meeting MeetingId="101" MeetingName="Nordea Masters Tournament HH"/> 
<Meeting MeetingId="102" MeetingName="Nordea Masters Top Aussie"/> 
<Meeting MeetingId="107" MeetingName="Nordea Masters Handicap"/> 
<Meeting MeetingId="110" MeetingName="Nordea Masters R1 3 Balls"/> 
</League> 
<League LeagueId="34" LeagueName="Ryder Cup"> 
<Meeting MeetingId="1" MeetingName="Ryder Cup 2012"/> 
</League> 
</Sport> 
</Sports> 

and this is the desired output…

[{SportId,SportName,LeagueId,LeagueName,MeetingId,MeetingName}] 

Don’t necessarily need a canned answer but just a push in the right direction would be useful so I can do some further research myself.

I’ve used mochiweb_html:parse to search for a specific information in a particular node but in the above instance I need to extract information from multiple nodes.

thanks

  • 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-05T12:46:51+00:00Added an answer on June 5, 2026 at 12:46 pm

    Have you looked into erlsom yet?

    It is IMO easier to use than xmerl. With erlsom you can generate record definitions from an XSD schema. The record definitions map the types from the schema (plus some extra information). Having the records pattern matching is straight forward to use. More info you can find here.

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
I am trying to understand how to use SyndicationItem to display feed which is

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.