Modify ↓
Ticket #4266 (closed bug: invalid)
title tag ignored in xml
| Reported by: | surangini | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.3.2 |
| Component: | core | Version: | 1.3.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
If an xml has a title tag, jquery ignores it while navigating through it.
var val = '<values><title>some title value</title><rightscode>G</rightscode><rights>Rights value</rights></values>';
val is an example else its a valid xml.
$.each($(val).children(), function(){
alert('ret: ' + $(this).text() + ' node: ' + this.tagName );
});
Everything get's printed well except title tag. No matter where title tag exists in the xml.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

$(htmlstring) parses html using the browser's html parser. jQuery cannot determine that the string you gave is xml. If you parse a string with an xml parser you can pass that to $() and jQuery can process it.
http://docs.jquery.com/Core/jQuery#htmlownerDocument
http://markmail.org/message/i2kytvrcn7cvdegn