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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:00:28+00:00 2026-06-05T17:00:28+00:00

This is the data stream, (Hope I’m displaying this correctly, it took me forever

  • 0

This is the data stream, (Hope I’m displaying this correctly, it took me forever to figure it out). I was just trying to extract the title just to see if I could get it to work. I obviously am lost and don’t understand why I keep getting errors.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <items total="475974">
        <link href="https://www.sciencebase.gov/catalog/items?
            max=1&amp;s=Search&amp;q=water&amp;format=xml" 
            rel="self" />
        <link href="https://www.sciencebase.gov/catalog/items?
            max=1&amp;s=Search&amp;q=water&amp;format=xml&amp;offset=1"
            rel="next" />
        <item id="4f4e4a62e4b07f02db6369dc">
        <link href="https://www.sciencebase.gov/catalog/
                item/4f4e4a62e4b07f02db6369dc" rel="self" />
        <oldId>1800335</oldId>
        <title>Reconnaissance of the water resources of Beaver County,
            Oklahoma</title>
        <summary>Ground water is the major source of water supply in Beaver
            County. Because of the rapidly increasing demand for the limited
            supply of water for irrigation, additional geologic and hydrologic
            data are needed for management of ground-water resources...</summary>
        </item>
    </items>

And this is my code:

function myFunction() {
    var response = UrlFetchApp.fetch("http://www.sciencebase.gov/catalog        
        /items?s=Search&q=water&format=xml&max=1").getContentText();
    var parsedResponse = Xml.parse(response, true);
    //I tried this but it didn't work
    var title = parsedResponse.html.head.getElements("title");
    Browser.msgBox(title);
}
  • 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-05T17:00:34+00:00Added an answer on June 5, 2026 at 5:00 pm

    I always use a tool to look at XML. If you need one, in Chrome, I use the XML Tree extension. Install it, visit your test URL and you’ll see formatted XML that’s expandable and collapsable (just like IE 🙂 and makes it easy to see the structure.

    Here’s your code with some mods and light narration:

    function myFunction() {
      //note I've set max=10 here
      var url="http://www.sciencebase.gov/catalog/items?s=Search&q=water&format=xml&max=10";
      var response = UrlFetchApp.fetch(url).getContentText();
    
      var parsedResponse = Xml.parse(response, true);
    
      debugger; //You will see in the debugger that your 10 results are each XmlElements in the array parsedResponse.items.item[]
    
      //iterate through the results
      for (var i = 0; i < parsedResponse.items.item.length; i++) {
        var result = parsedResponse.items.item[i];
        //View > Logs... to see the title of each result
        Logger.log(result.getElement("title").getText());
      }
    }
    

    Logs the following 10 titles:

    Reconnaissance of the water resources of Beaver County, Oklahoma
    ..
    Water resources data, Oklahoma, water year 2004; Volume 2. Red River basin
    

    Hope this helps, let me know if you need anything further clarified.

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

Sidebar

Related Questions

I'm just trying to read a video Stream out of an IP Camera (Basler
I am trying to extract blocks of JSON data from a data stream in
I have a situation where I receive a continuous stream of data. This data
this code reads numbers from different steam data , and outputs the whole sum.
This data is for a holiday cottage's simple accommodation calendars. The data is simple
Consider this data { _id : ..., array : [ { name : value1,flag
I have this data AnsID QuesID AnsOrder ----------------------- 1 5 NULL 2 5 NULL
I got this Data Structure: 12 Measurements, each Measurement contains 1-x Cells, each Cell
i am getting this data from my database and unserlialzing them for my use
I have this data: <div id=results> <span id=row> <span id=left>left column</span> <span id=middle>middle text</span>

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.