Bug Tracker


Ticket #3811 (closed bug: invalid)

Opened 5 years ago

Last modified 2 years ago

jQuery doesn't create proper case-sensitive XML elements

Reported by: SineSwiper Owned by:
Priority: major Milestone: 1.3
Component: core Version: 1.2.6
Keywords: XML uppercase create Cc:
Blocking: Blocked by:


When creating new elements with the core method, jQuery will only create UPPERCASE tags. Specifying the XML ownerDocument doesn't help. Using append with a on-the-fly element won't create it, either.

For example:

xml = xmlDoc();  // method varies on browsers
root = xml.documentElement;  // contains first root tag

el = $('<xml_el>');  // creates "<XML_EL/>"
el = $('<xml_el/>');  // same problem
el = $('<xml_el></xml_el>');  // same problem

el = $('<xml_el>', xml);  // returns an empty set
el = $('<xml_el>', root);  // also returns an empty set

el = $(xml.createElement('xml_el'))  // this works, but is kinda cumbersome

subEl = el.append('<xml_qqq>');   // doesn't work
subEl = el.append('<xml_qqq/>');  // doesn't work
subEl = el.append('<xml_qqq>42</xml_qqq>');  // doesn't work

This was tested on Firefox 3.0.5, though I haven't tried IE yet. (I always assume IE is just going to be worse, anyway...)


xml.js Download (2.5 KB) - added by SineSwiper 5 years ago.
Example XML code

Change History

comment:1 Changed 5 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

jQuery doesn't have an XML parser. You're using its HTML parser. The strings passed in there are sent to a div's .innerHTML to parse them. See this thread:


comment:2 Changed 5 years ago by SineSwiper

Okay, maybe I'm asking more for an enhancement. Just about everything else in jQuery works for XML: searching for tags in the tree, grabbing text within a tag, setting attributes. The only things not in jQuery is a proper way to create an XML document, serialization (to strings), and creating a tag. I thinking this could be achieved without the need for a plug-in, especially considering that XML parsing is already available in $.ajax, and the creation of XML trees for POST submission is very much an AJAX function.

I can attach some example code to be adapted for the missing pieces.

Changed 5 years ago by SineSwiper

Example XML code

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.