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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:43:49+00:00 2026-06-13T06:43:49+00:00

I have a simple xml file that contains information such as name, address, job

  • 0

I have a simple xml file that contains information such as name, address, job title… I would like to parse this file with jquery parseXML() and then display its content in a nested list. I have a function like so:

function parseXml(xml)
    { 
      $(xml).find("Employee").each(function()
      {
        $("#output").append("<li><h3>" + $(this).find("name").text()+ "</h3><p>"
                      + $(this).find("jobtitle").text() + "</p>" +  
                      "<ul><li>"+$(this).find("address").text() + 
                      "</li><li>"+$(this).find("workphone").text() + 
                      "</li><li>"+$(this).find("homephone").text() + 
                      "</li><li>"+$(this).find("cellphone").text() +
                      "</li><li>"+$(this).find("fax").text() +
                      "</li><li>"+$(this).find("contractor").text() +
                      "</li></ul></li>"
        );
        $("#output").listview("refresh");
      });
    }

… that gets the information into the first list no problem. However, the second UL, the nested UL, isn’t displaying correctly. Mainly when I click on the parent LI, the final xml entry in the document shows up, badly formated, as the nested LI. Everything is crammed together vertically on the screen.

My xml looks like so:

<Employee>
        <name>Jon</name>
        <email>jon@email.com</email>
        <jobtitle>Software Engineer</jobtitle>
        <address>123 City Street</address>
        <workphone>555-555-5555</workphone>
        <homephone>555-555-5551</homephone>
        <cellphone>555-555-5552</cellphone>
        <fax>555-555-5553</fax>
    </Employee>
    <Employee>
        <name>Don</name>
        <email>don@email.com</email>
        <jobtitle>Software Man</jobtitle>
        <address>555 City Street</address>
        <workphone>222-222-2222</workphone>
        <homephone>222-222-2224</homephone>
        <cellphone>222-222-2226</cellphone>
        <fax>222-222-2228</fax>
    </Employee>
    <Employee>
        <name>Juan</name>
        <email>juan@email.com</email>
        <jobtitle>IT Specialist</jobtitle>
        <address>888 City Street</address>
        <workphone>777-878-7878</workphone>
        <homephone>777-888-7878</homephone>
        <cellphone>777-777-7878</cellphone>
        <fax>777-878-7898</fax>
    </Employee>

Anyone have a better way to display this xml file within a nested list? I like the Jquery Mobile way of just creating the nested list and it turns the parent into a link to the nested LI.

  • 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-13T06:43:50+00:00Added an answer on June 13, 2026 at 6:43 am

    Answered here: jQuery Parse XML display in jQuery Mobile list UL UL returning last item in XML only

    my .listview(“refresh”); needed to be OUTSIDE of the each.

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

Sidebar

Related Questions

I have been provided an XSD and a sample Xml file that contains the
I have a really simple XML file that I'm trying to read, but I
i have a simple xml file in a wcf service that i am trying
I have a map that reads an XML file; it's all very simple and
I have a simple doc.xml file which contains a single root element with a
I've got an XML doc to deal with that contains attributes like: <action name=foo
I have to validate XML file that contains embedded XML, with XML Schema. Correctness
I have an XML file that contains one set of data and this has
I have a simple xml file and I want to remove everything before the
I have this simple XML file : <?xml version=1.0 encoding=utf-8 ?> <Artists> <artist artistId=1>

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.