Bug Tracker

Opened 14 years ago

Closed 14 years ago

Last modified 11 years ago

#3811 closed bug (invalid)

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:
Blocked by: Blocking:


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...)

Attachments (1)

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

Download all attachments as: .zip

Change History (3)

comment:1 Changed 14 years ago by dmethvin

Resolution: invalid
Status: newclosed

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 14 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 14 years ago by SineSwiper

Attachment: xml.js added

Example XML code

Note: See TracTickets for help on using tickets.