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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:44:23+00:00 2026-06-18T10:44:23+00:00

I work out why lxml will parse part of the xml I’m looking through

  • 0

I work out why lxml will parse part of the xml I’m looking through but not other bits.

The following snippet works and gives me all the titles I need:

doc = lh.fromstring(resp)
for product in doc.xpath('.//item'):
    prices = product.xpath(".//title/text()")

However, a simple change to

doc = lh.fromstring(resp)
for product in doc.xpath('.//item'):
    prices = product.xpath(".//itemId/text()")

or

doc = lh.fromstring(resp)
for product in doc.xpath('.//item'):
    prices = product.xpath(".//globalId/text()")

just returns prices as number of empty results.

XML given below…

<findItemsByProductResponse>
  <ack>Success</ack>
  <version>1.12.0</version>
  <timestamp>2013-02-04T13:35:57.106Z</timestamp>
  <searchResult count="31">
    <item>
      <itemId>130842622974</itemId>
      <title>BONES - COMPLETE SEASON 4 - BLURAY</title>
      <globalId>EBAY-US</globalId>
    <primaryCategory>
      <categoryId>617</categoryId>
      <categoryName>DVDs & Blu-ray Discs</categoryName>
    </primaryCategory>
    <galleryURL>
      http://thumbs3.ebaystatic.com/m/mnuTBPOWZ-6F4kIHS1mj3gg/140.jpg
    </galleryURL>
    <viewItemURL>
      http://www.ebay.com/itm/BONES-COMPLETE-SEASON-4-BLURAY-/130842622974?pt=US_DVD_HD_DVD_Blu_ray
    </viewItemURL>
    <productId type="ReferenceID">78523575</productId>
    <paymentMethod>PayPal</paymentMethod>
    <autoPay>false</autoPay>
    <postalCode>60544</postalCode>
    <location>Plainfield,IL,USA</location>
    <country>US</country>
    <shippingInfo>
      <shippingServiceCost currencyId="USD">0.0</shippingServiceCost>
      <shippingType>Free</shippingType>
      <shipToLocations>Worldwide</shipToLocations>
      <expeditedShipping>true</expeditedShipping>
      <oneDayShippingAvailable>false</oneDayShippingAvailable>
      <handlingTime>1</handlingTime>
    </shippingInfo>
    <sellingStatus>
      <currentPrice currencyId="USD">12.99</currentPrice>
      <convertedCurrentPrice currencyId="USD">12.99</convertedCurrentPrice>  
      <sellingState>Active</sellingState>
      <timeLeft>P3DT23H12M7S</timeLeft>
    </sellingStatus>
    <listingInfo>
      <bestOfferEnabled>false</bestOfferEnabled>
      <buyItNowAvailable>false</buyItNowAvailable>
      <startTime>2013-01-29T12:48:04.000Z</startTime>
      <endTime>2013-02-08T12:48:04.000Z</endTime>
      <listingType>FixedPrice</listingType>
      <gift>false</gift>
    </listingInfo>
    <returnsAccepted>true</returnsAccepted>
    <condition>
      <conditionId>1000</conditionId>
      <conditionDisplayName>Brand New</conditionDisplayName>
    </condition>
    <isMultiVariationListing>false</isMultiVariationListing>
    <topRatedListing>true</topRatedListing>
  </item>

p.s. for added bonus, I’m going to be looking at finding the convertedCurrentPrice as a next step (just thought I should solve one mystery at a time) – the code I was going to use looks something like

doc = lh.fromstring(resp)
for product in doc.xpath('.//item'):
    prices = product.xpath(".//sellingStatus/convertedCurrentPrice/text()")

Does that seem about right or are there better ways of doing this?

Thanks,

Matt

  • 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-18T10:44:24+00:00Added an answer on June 18, 2026 at 10:44 am

    Try with itemid, because I think lxml converts tags to lowercase. Also why not use:

    doc.xpath('.//item/itemid/text()")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

trying to work out how to install zipArchive extension with MAMP, but not having
I have tried to work out with jquery ui selectable but it is not
i am trying to work out the following problem in Java (although it could
I am trying to work out why I can not access the nested function
Can someone work out why my JScrollPane is not working. Perhaps something I may
I'm trying to work out why the following example doesn't work. The observableArray isn't
Im trying to work out the best way to approach the following problem with
I am trying to work out an efficient quicksort algo. It works okay, but
Cannot work out how to get the following menu to display correctly in IE6,
I'm trying to work out what's not working in this code: #!/usr/bin/python import cmd

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.