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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:34:26+00:00 2026-05-24T03:34:26+00:00

I am using javascript to make XML to HTML. I have followed this guide:http://www.w3schools.com/xml/xml_to_html.asp

  • 0

I am using javascript to make XML to HTML. I have followed this guide:http://www.w3schools.com/xml/xml_to_html.asp

How do I add pagination to a XML feed?

  • 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-24T03:34:27+00:00Added an answer on May 24, 2026 at 3:34 am

    based on the url you provided in your question, here is how you can paginate the data.

    The html content:

    <div id="content"></div>
    <div id="pagination"></div>
    

    The Javascript code:

    var page = 1, perPage = 4, content = document.getElementById('content'),
    pagination = document.getElementById('pagination'), records;
    
    function paganation(page)
    {
        var nextMaxItem = perPage * page;
        var fromItem = (page - 1) * perPage;
        var maxPages = records.length / perPage;
    
        var xmlContent = "<table border='1'>";
        for (var i = fromItem; i < nextMaxItem; i++) {
            xmlContent += "<tr><td>";
            xmlContent += records[i].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue;
            xmlContent += "</td><td>";
            xmlContent += records[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue;
            xmlContent += "</td></tr>";
        }
        xmlContent += "</table>";
        content.innerHTML = xmlContent;
    
        var paginationContent = "";
        var previous = page - 1;
        if (page > 1) {
            paginationContent += '<a href="javascript:paganation('+previous+');">Back</a>';
        } else {
            paginationContent += "Back";
        }
    
        for (var j = 1; j < Math.ceil(maxPages); j++) {
            paginationContent += " ";
            paginationContent += '<a href="javascript:paganation('+j+');">'+j+'</a>';
            paginationContent += " ";
        }
    
        var next = page + 1;
        if (next <= maxPages) {
            paginationContent += '<a href="javascript:paganation('+next+');">Next</a>';
        } else {
            paginationContent += "Next";
        }
        pagination.innerHTML = paginationContent;
    }
    
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.open("GET","cd_catalog.xml",false);
    xmlhttp.send();
    xmlDoc=xmlhttp.responseXML; 
    records = xmlDoc.getElementsByTagName("CD");
    paganation(1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am traversing a HTML document using javascript DOM. I want make a list
I make program to read xml file by using traditional JavaScript. <script type=text/javascript> var
I am displaying an XML document in an HTML file using JavaScript. So far
Without using Javascript, is there a way to make a CSS property toggle on
I am currently using a javascript code to make an entire row in my
How to make multiple forms with shared fields without using javascript? <input type=text name=username
Im using JavaScript, the HTML5 canvas-element and WebGL to make a simple 3D-game in
How can I make a visitor's browser go fullscreen using JavaScript, in a way
I'm trying to make a drop down menu using javascript/jquery but can't get my
How do I make a user's browser blink/flash/highlight in the task bar using JavaScript?

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.