Bug Tracker

Modify

Ticket #4519 (closed bug: invalid)

Opened 5 years ago

Last modified 2 years ago

XML parsing error with IE

Reported by: nico87 Owned by: john
Priority: critical Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: Cc:
Blocking: Blocked by:

Description

This function works well in FF, but not in IE6.

$(xml).find("[name=\"societa\"]").children().each(function() {

menu1+="<span class=\"inline-div padding20\"><a href='"+$(this).attr("href")+"'\">"+$(this).text()+"</a></span>";

});

Also I've tried to do this:

alert($(xml).find("[name=\"societa\"]").html())

and FF returns the correct XML code inside <item name='societa'> </item>. IE returns a empty string.

Follows the XML code:

<?xml version="1.0" encoding="UTF-8"?> <menu>

<item name="societa" href="#">

<voice href="#">Storia</voice> <voice href="#">Certificazioni</voice> <voice href="#">Contatti</voice> <voice href="#">Dove siamo</voice>

</item> <item name="flotta" href="#">

<voice href="#">PZL M18B Dromader</voice> <voice href="#">PZL 104-80 Wilga</voice>

</item>

</menu>

Thank you so much.

Change History

comment:1 Changed 5 years ago by dmethvin

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

It looks like you are trying to parse XML with the $("htmlstring") method. That won't work in general, unless the XML is also valid HTML.

 http://docs.jquery.com/Core/jQuery

If you need to parse XML, use an XML parser.

 http://markmail.org/message/i2kytvrcn7cvdegn

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

View

Add a comment

Modify Ticket

Action
as closed
Author


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

 
Note: See TracTickets for help on using tickets.