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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:12:25+00:00 2026-05-30T19:12:25+00:00

I’m trying with jQuery to retrieve the contents of an xml node that contains

  • 0

I’m trying with jQuery to retrieve the contents of an xml node that contains < ul> and < li> information. The problem I’m having is directly translating that into html, retaining the same structure.

XML:

<question num="18">
    <q>JOGs are produced in what two formats? What is the major difference?</q>
    <ans>JOG (Air) and JOG (Ground); the topographical information is identitcal on both, but the ground version shows elevations and contour in meters and the air version shows them in feet. Both versions emphasize airlanding facilities, but the air version has additional symbols to identify aids and obstructions to air navigation. Each version is identified in the lower margin as either Joint Operations Graphic (Air) or Joint Operations Graphic (Ground).</ans>
    <ref>(para 2-6b(4))</ref>
</question>
<question num="19">
    <q>What are some examples of "special" militar maps?</q>
    <ans>Maps designed specifically to show one or more of the following:
        <ul>
            <li>Drainage characteristics</li>
            <li>Climate</li>
            <li>Coasts and landing beaches</li>
            <li>Urban areas</li>
            <li>Electric power</li>
            <li>Fuels</li>
            <li>Water Resources</li>
            <li>Natural construction materials</li>
        </ul>
    </ans>
    <ref>(para 2-6b(8))</ref>
</question>

JavaScript:

$.get("landnav.xml",{},function(xml){
                $('question', xml).each(function(){
                    questions.push( $(this).find('q').text() );
                    answers.push( $(this).find('ans').contents() );
                });
            });

later:

$('#answer').click(function(){
                if(sentinal !== undefined){
                    $('#question').html( answers[sentinal] );
                }
            });

What’s contained in contents seems only to be the 1 and 2, without any < li> or < ul> tags.

Any thoughts on how I might keep the structure of the node?

  • 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-30T19:12:26+00:00Added an answer on May 30, 2026 at 7:12 pm

    Try

    // Isolate the XML.
    var xmlNode = $(this).find('node');
    // Convert the XML structurally to HTML.
    // The (true) causes a deep copy.
    var htmlFromXml = document.importNode(xmlNode[0], true);
    // Append the resulting HTML to the DOM.
    $(htmlFromXml).appendTo($('#content'));
    

    document.importNode takes a DOM sub-tree from one document, such as an XML document received via XHR, and creates a structural copy in another document, such as an HTML document.

    document.importNode

    Summary

    Creates a copy of a node from an external document that can be inserted into the current document.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am currently running into a problem where an element is coming back from
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

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.