Parsing XML with tag names containing hyphens

Parsing XML with tag names containing hyphens

Hi,

I am using jQuery for XML parsing and editing, but there seems to be issues with tag names containing a hyphen (with jQuery 1.4.2, in FF & Safari):

  1. var doc = jQuery("<root><title-1/><title-2/></root>");
    doc.find("title-2").parent()[0].tagName;
    //=> expected: 'ROOT'
    //   got: 'TITLE-2'
    jQuery('<div>').append(doc).remove().html();
    //=> expected: "<root><title-1/><title-2/></root>"
    //   got: "<root><title-1><title-2></title-2></title-1></root>"






Does somebody have a workaround for parsing XML documents correctly with jQuery?

Thx!