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 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 a function which returns a certain ammount of data triggered in AJAX
I have an AJAX request on a php file, which returns some data, like
I have a simple jquery/ajax request to the server which returns the structure and
i send ajax requests with jquery, and i have a function: $('input').ajaxSuccess(function(e, xhr, settings)
So I have this javascript function, it sends an ajax requests to fetch a
I have a WCF Service which returns a string. I am trying to call
I basically have an ajax function which gets the latest posts from a database,
I have a webservice function that returns something like the following: New Orleans, Louisiana
Greetings I have an ajax call which: Gets an xml file of posts Populates
I have written a view which responds to ajax requests from browser. It's written

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.