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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:55:06+00:00 2026-05-30T18:55:06+00:00

Using the XML library, I have parsed a web page basicInfo <- htmlParse(myURL, isURL

  • 0

Using the XML library, I have parsed a web page

basicInfo <- htmlParse(myURL, isURL = TRUE)

the relevant section of which is

<div class="col-left"><h1 class="tourney-name">Price Cutter Charity Championship Pres'd         by Dr Pep</h1><img class="tour-logo" alt="Nationwide Tour" src="http://a.espncdn.com/i/golf/leaderboard11/logo-nationwide-tour.png"/></div>

I can manage to extract the tournament name

tourney <- xpathSApply(basicInfo, "//*/div[@class='col-left']", xmlValue)

but also wish to know the tour it is from using the alt tag. In this case I want to get the result “Nationwide Tour”

TIA and apologies for scrolling required

  • 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-30T18:55:07+00:00Added an answer on May 30, 2026 at 6:55 pm

    Don’t know R but I’m pretty good with XPath

    Try this:

    tourney_name <- xpathSApply(basicInfo, "//*/div[@class='col-left']/h1/text()", xmlValue)
    tourney_loc <- xpathSApply(basicInfo, "//*/div[@class='col-left']/img/@alt", xmlValue)
    

    Note the use of “@” to extract attributes and text() to extract text nodes (looks like R did this automatically), my revised tourney_name xpath should do the same thing, but it is more clear which part is being extracted.

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

Sidebar

Related Questions

I am using a class library which represents some of its configuration in .xml.
Is there any external library using which one can edit and save XML files
I have an application in c++ using Xerces-C as main xml manipulation library. I
Completely new to using simple XML library in PHP, and have been using the
I have a requirement to parse/traverse an XML file using the YUI 2.8 library.
I am using the Zend library's XML RPC Client in a PHP application to
I'm using a third-party library that returns XML that is not valid, because it
I'm using TinyXML to parse/build XML files. Now, according to the documentation this library
I am using xml.net in web application When I try load xml through an
I'm using XML Serialization heavily in a web service (the contracts pass complex types

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.