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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:25:54+00:00 2026-05-28T15:25:54+00:00

I am reusing code used in a Windows forms application. I found some help

  • 0

I am reusing code used in a Windows forms application. I found some help on here to get my code error free using the StringReader class. When running my application, which is a Windows Phone Silverlight application, I receive an exception saying

Data at the root level is invalid, Line 1 Position 1

The purpose of the code is to use an ISBN number, search isbndb.com for the book and send back the title, author and description. Any help on this error would be appreciated. The method returns the items “title”, “author” and “description” in a memberbook object.

public class ISBNDB
{
    public string key = "??????????";        
    public string URL = "http://isbndb.com/api/books.xml?access_key=";
    string DETAILS;
    private MemberBook mb;        
    private string title;
    private string author;
    private string description;

    public ISBNDB()
    {
        URL += key;
        DETAILS += key;
        title = null;
    }

    public ISBNDB(string key)
    {
        this.key = key;
        URL += key;
        DETAILS += key;
        title = null;
    }

    public MemberBook GetData(string isbn)
    {
        DETAILS = URL;
        DETAILS += "&results=texts&index1=isbn&value1=" + isbn;

        using (XmlReader reader = XmlReader.Create(new StringReader(DETAILS)))
        while (reader.Read())
        {                
            switch (reader.NodeType)
            {
                case XmlNodeType.Element: // The node is an element.
                    switch(reader.Name)
                    {
                        case "Title":title = reader.ReadContentAsString();                                
                            break;
                        case "AuthorsText": author = reader.ReadContentAsString();
                            break;
                        case "Summary": description = reader.ReadContentAsString();
                            if (description.Equals(""))
                                description = "Not Available";
                            if(description.Length > 2000)
                                description = "Not Available";
                            break;         
                    }                        
                    break;                   
            }
        }
        return mb;
    }
}

}


EDIT SampleXML (L.B)

<?xml version="1.0" encoding="UTF-8"?>
<ISBNdb server_time="2012-01-26T22:30:26Z">
    <BookList total_results="1" page_size="10" page_number="1" shown_results="1">
        <BookData book_id="jaws_a05" isbn="1400064562" isbn13="9781400064564">
            <Title>Jaws</Title>
            <TitleLong></TitleLong>
            <AuthorsText>Peter Benchley, </AuthorsText>
            <PublisherText publisher_id="random_house">Random House</PublisherText>
            <Summary>"Relentless terror." The Philadelphia Inquirer.The classic, blockbuster thriller of man-eating terror that inspired the Steven Spielberg movie and made millions of beachgoers afraid to go into the water. Experience the thrill of helpless horror again -- or for the first time!From the Paperback edition.</Summary>
            <Notes></Notes>
            <UrlsText></UrlsText>
            <AwardsText></AwardsText>
        </BookData>
    </BookList>
</ISBNdb>
  • 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-28T15:25:56+00:00Added an answer on May 28, 2026 at 3:25 pm

    You don’t want to use synchronous network calls in Silverlight. Instead, use an async call to get the XML as a string. Then in the callback, parse it as XML. To get the string asynchronously, use something like this:

    WebClient client = new WebClient();
    client.DownloadStringAsync(new Uri(DETAILS));
    client.DownloadStringCompleted += OnDownloadComplete;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a wierd one. I'm reusing a code base that unfortunately must not be
In the interest of reusing some existing code that was defined as an instance
I use some strongly-typed expressions that get serialized to allow my UI code to
We're using code that we've used before, so I suspect that this may be
I'm working on a heavily data driven ASP.NET web forms application. We're using the
When reusing code (for example, a Util library you created), do you add its
I've tried two different methods of reusing code. I have a solution full of
I'm trying to avoid code like this when reusing the same ViewUserControl in ASP.NET
I have the following 4 lines of code that I keep reusing in my
In the spirit of re-using code, I'm trying to create a few library projects.

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.