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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:31:52+00:00 2026-05-28T03:31:52+00:00

I would like to add XML to my HTML page. I would like the

  • 0

I would like to add XML to my HTML page. I would like the Topic to display as an ‘h3’, the content to display as a ‘p’ and the url to display within a ‘a href’.

XML

<linkedin>
<discussion>
    <topic>This is the discussion name</topic>
    <content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ligula mi, convallis eget iaculis id, euismod non arcu. Morbi porta.</content>
    <url>http://www.linkedin.com/groups/</url>
</discussion>

Here’s how I would like the outputted HTML to look:

<h3>This is the discussion name</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ligula mi, convallis eget iaculis id, euismod non arcu. Morbi porta.</p>
<a href="http://www.linkedin.com/groups/"></a>

Many Thanks, I hope this explanation of what I’m stuck on makes sense.

  • 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-28T03:31:53+00:00Added an answer on May 28, 2026 at 3:31 am

    NOTE : This is as simple as it gets. It doesn’t handle cases where any of the child nodes aren’t present.

    Just to get you started using an ajax request.

    HTML

    <!DOCTYPE>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script type = "text/javascript" src = "script.js" defer = "defer"></script>
    </head>
    <body>
    
    </body>
    </html>
    

    JS (script.js)

    function getXML() {
        var xmlhttp,xmlDoc;
        if (window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        }
        else {// code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.open("GET", "your-xml-file.xml", false);
        xmlhttp.send();
        xmlDoc = xmlhttp.responseXML;
        showDiscussions(xmlDoc);
    }
    
    function showDiscussions(xmlDoc) {
        var discHolder = document.createElement("DIV"),
            disc = xmlDoc.getElementsByTagName("discussion");
        for (var i = 0, j = disc.length; i < j; i++) {
            var topic = document.createElement("h3"),
                content = document.createElement("p"),
                url = document.createElement("a");
    
            topic.innerHTML = disc[i].getElementsByTagName("topic")[0].childNodes[0].nodeValue;
            discHolder.appendChild(topic);
            content.innerHTML = disc[i].getElementsByTagName("content")[0].childNodes[0].nodeValue;
            discHolder.appendChild(content);
            url.href = disc[i].getElementsByTagName("url")[0].childNodes[0].nodeValue;
            url.innerHTML = disc[i].getElementsByTagName("url")[0].childNodes[0].nodeValue;
            discHolder.appendChild(url);
    
        }
    
        document.body.appendChild(discHolder);
    }
    
    getXML();
    

    I will also recommend using jquery

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

Sidebar

Related Questions

I would like to add two additional xml namespaces to the <HTML> element in
I would like to add things like bullet points • to HTML using the
I would like to know if this is possible to add special character into
I would like to do something like add a nice-to-Excel-functions Name property to the
I would like to add the following MIME type to a site run by
I would like to add a DataGridViewTextBoxCell cell to a DataGridViewCell control, but as
I would like to add AES encryption to a software product, but am concerned
I would like to add graphing to my User Controls in ASP.NET MVC. I
I would like to add a typing speed indicator just below the textarea we
I would like to add a BuildListener to my headless build process, which is

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.