Move this topic
[jQuery] namespaces XML parsing
in Using jQuery
•
3 years ago
I have had a look at jQuery mailinglist and I have googled, and I have
not found a solution to this problem.
For example, in FF, if a look for a tag, I have to write "ns\\:tag" ,
but if a look for an attribute I have to write "ns:attribute". In
google Chrome (WebKit), I have to write "tag" or "attribute" and it
works.
Has this problem been solved, or is there any plugin to deal with it?
It is veri tedious to code a parsing case for each browser (IE, FF,
Webkit, etc..)
Thanks in advanced.
Replies(3)
Re: [jQuery] namespaces XML parsing
3 years ago
<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div><div>On Mar 18, 2009, at 5:52 PM, David wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">For example, in FF, if a look for a tag, I have to write "ns\\:tag" ,</font> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">but if a look for an attribute I have to write "ns:attribute". In</font> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">google Chrome (WebKit), I have to write "tag" or "attribute" and it</font> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">works.</font> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px">
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Has this problem been solved, or is there any plugin to deal with it?</font> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">It is veri tedious to code a parsing case for each browser (IE, FF,</font> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Webkit, etc..)</font> </blockquote></div>
<div>AFAIK, this problem has not been solved yet, jQuery does not handle namespaces at all. The ns\\:field is more of a hack and does not work in IE when parsing to XML (through the AJAX option dataType: "xml").</div><div>
</div><div>What you might want to try is removing the dataType option (so that it is passed as a string), then replace the : character with something else (e.g. a dash). This way the XML parser will leave the namespaces alone.</div><div>
</div><div>Please note that I have not tried this, it's based on the things I have read about it.</div><div>
</div><div>Regards,</div><div>-- </div><div>Martijn.</div><div>
</div></body></html>
<div><div>On Mar 18, 2009, at 5:52 PM, David wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">For example, in FF, if a look for a tag, I have to write "ns\\:tag" ,</font> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">but if a look for an attribute I have to write "ns:attribute". In</font> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">google Chrome (WebKit), I have to write "tag" or "attribute" and it</font> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">works.</font> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px">
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Has this problem been solved, or is there any plugin to deal with it?</font> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">It is veri tedious to code a parsing case for each browser (IE, FF,</font> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Webkit, etc..)</font> </blockquote></div>
<div>AFAIK, this problem has not been solved yet, jQuery does not handle namespaces at all. The ns\\:field is more of a hack and does not work in IE when parsing to XML (through the AJAX option dataType: "xml").</div><div>
</div><div>What you might want to try is removing the dataType option (so that it is passed as a string), then replace the : character with something else (e.g. a dash). This way the XML parser will leave the namespaces alone.</div><div>
</div><div>Please note that I have not tried this, it's based on the things I have read about it.</div><div>
</div><div>Regards,</div><div>-- </div><div>Martijn.</div><div>
</div></body></html>
Leave a comment on martijn.houtman's reply
Re: [jQuery] namespaces XML parsing
3 years ago
<html><body>
We were running into a similar problem with an AJAX application and here is what we did to get around namespaces:
jQuery(entries).find("[@nodeName=namespace:elementName]");
cheers
Michael Lawson
Content Tools Developer, Global Solutions, ibm.com
Phone: 1-828-355-5544
E-mail: mjlawson@us.ibm.com
'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.'
<img width="16" height="16" src="cid:1__=08BBFFEEDFCCD5988f9e8a93df938@us.ibm.com" border="0" alt="Inactive hide details for Martijn Houtman ---03/18/2009 01:06:07 PM---On Mar 18, 2009, at 5:52 PM, David wrote: For example, in"><font color="#424282">Martijn Houtman ---03/18/2009 01:06:07 PM---On Mar 18, 2009, at 5:52 PM, David wrote: For example, in FF, if a look for a tag, I have to write "ns\\:tag" ,</font>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=08BBFFEEDFCCD5988f9e8a93df938@us.ibm.com" border="0" alt="">
<font size="2" color="#5F5F5F">From:</font></td><td width="100%"><img width="1" height="1" src="cid:2__=08BBFFEEDFCCD5988f9e8a93df938@us.ibm.com" border="0" alt="">
<font size="2">Martijn Houtman <martijn.houtman@gmail.com></font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=08BBFFEEDFCCD5988f9e8a93df938@us.ibm.com" border="0" alt="">
<font size="2" color="#5F5F5F">To:</font></td><td width="100%"><img width="1" height="1" src="cid:2__=08BBFFEEDFCCD5988f9e8a93df938@us.ibm.com" border="0" alt="">
<font size="2">jquery-en@googlegroups.com</font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=08BBFFEEDFCCD5988f9e8a93df938@us.ibm.com" border="0" alt="">
<font size="2" color="#5F5F5F">Date:</font></td><td width="100%"><img width="1" height="1" src="cid:2__=08BBFFEEDFCCD5988f9e8a93df938@us.ibm.com" border="0" alt="">
<font size="2">03/18/2009 01:06 PM</font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=08BBFFEEDFCCD5988f9e8a93df938@us.ibm.com" border="0" alt="">
<font size="2" color="#5F5F5F">Subject:</font></td><td width="100%"><img width="1" height="1" src="cid:2__=08BBFFEEDFCCD5988f9e8a93df938@us.ibm.com" border="0" alt="">
<font size="2">[jQuery] Re: namespaces XML parsing</font></td></tr>
</table>
<hr width="100%" size="2" align="left" noshade style="color:#8091A5; ">
<font size="4">On Mar 18, 2009, at 5:52 PM, David wrote:</font>
<ul>
<ul><font size="4">For example, in FF, if a look for a tag, I have to write "ns\\:tag" ,</font>
<font size="4">but if a look for an attribute I have to write "ns:attribute". In</font>
<font size="4">google Chrome (WebKit), I have to write "tag" or "attribute" and it</font>
<font size="4">works.</font>
<font size="4">Has this problem been solved, or is there any plugin to deal with it?</font>
<font size="4">It is veri tedious to code a parsing case for each browser (IE, FF,</font>
<font size="4">Webkit, etc..)</font></ul>
</ul>
<font size="4">AFAIK, this problem has not been solved yet, jQuery does not handle namespaces at all. The ns\\:field is more of a hack and does not work in IE when parsing to XML (through the AJAX option dataType: "xml").</font>
<font size="4">What you might want to try is removing the dataType option (so that it is passed as a string), then replace the : character with something else (e.g. a dash). This way the XML parser will leave the namespaces alone.</font>
<font size="4">Please note that I have not tried this, it's based on the things I have read about it.</font>
<font size="4">Regards,</font>
<font size="4">-- </font>
<font size="4">Martijn.</font>
</body></html>
Attachments
- graycol.gifSize : 144 Bytes Download : 630
Leave a comment on mjlawson1's reply
Re: [jQuery] namespaces XML parsing
3 years ago
Just a quick note: If you use this with 1.3.x then you'll need to drop
the "@", it's been removed from 1.3+.
Karl Rudd
Leave a comment on karl.rudd's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic
Reply to garcia.narbona's discussion
Statistics
- 3 Replies
- 2212 Views
- 0 Followers



