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

  • Home
  • SEARCH
  • 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 3451682
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:10:19+00:00 2026-05-18T09:10:19+00:00

I have a AJAX requests which returns a string of XML which I’d like

  • 0

I have a AJAX requests which returns a string of XML which I’d like to inject into the DOM. My function looks like

  $.ajax({
    type: 'POST',
    url: "myrequest",
    data: postdata,
    datatype: 'json',
    success: function (arguments) {
        newxmlstring = arguments.newxml;
        oldnode = $("someselector specified in the arguments passed");
        oldnode.replaceWith(newxmlstring);
    }
  });

This works but it appears that the replaceWith function maps all nodeName into capitalized versions of the response sent by the server. I’m assuming this is some quirk with trying to use jQuery to handle XML?

So for example if the response string is <data>asdf</data> when I access $(newnode)[0].nodeName I get 'DATA'.

Does anybody know how to handle the new XML while preserving the nodeName in lower case?

EDIT: My response is JSON since it contains the new xml string and a bit of other data about where to attach the new xml node. So I’d prefer to keep datatype: 'json' if at all possible.

  • 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-18T09:10:19+00:00Added an answer on May 18, 2026 at 9:10 am

    From this answer:

    In XML (and XML-based languages such
    as XHTML), tagName preserves case. In
    HTML, tagName returns the element name
    in the canonical uppercase form. The
    value of tagName is the same as that
    of nodeName.

    A bit of searching shows that a lot of people experience this problem, especially with selectors and XML (jQuery’s find() is case sensitive and selectors used in find() are lowercased).

    Here’s a function someone else is using to convert a string into XML that may work for you:

    $.text2xml = function(sXML) { 
        // NOTE: I'd like to use jQuery for this, but jQuery makes all 
        // tags uppercase 
        //return $(xml)[0]; 
        var out; 
        try{ 
            var dXML = ($.browser.msie)?new ActiveXObject("Microsoft.XMLDOM"):new DOMParser(); 
            dXML.async = false; 
        }catch(e){ throw new Error("XML Parser could not be instantiated"); }; 
        try{ 
            if($.browser.msie) out = (dXML.loadXML(sXML))?dXML:false; 
            else out = dXML.parseFromString(sXML, "text/xml"); 
        } 
        catch(e){ throw new Error("Error parsing XML string"); }; 
        return out;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a web app in PHP which makes use of Ajax requests
I have an application in which most requests are submitted via AJAX, though some
I have $.ajax({ url: identity, success: function(data) { ProcessIdentityServer(data) } }); When 'data' is
I have the following javascript function which i call on the submit button click....
I have a simple ajax call: $.ajax({url: my_url_here, dataType: 'text', success: function(data, textStatus) {
I have the following code which is trying to post xml constructed data to
I have an ajax request that returns some JSON formatted data. I'm building out
I have a page which shows a Google map. I'd like to use Javascript
Is it possible that using jQuery, I cancel/abort an Ajax request that I have
Several of my ajax applications in the past have used GET request but now

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.