I am trying to use jQuery for XML processing. One of the problem that I am stuck with jQuery is it is case insensitive in processing tags and attribute.
For e.g., consider the following code:
$("<div><Book ISBN='1234'>Some title</Book></div>").html()
the output we get is:
<book isbn="1234">Some title</book>
whereas the output i am looking for is:
<Book ISBN="1234">Some title</Book>
Any possibility? (Note that "B" is capital letter, and the whole attribute name "ISBN" is also in capital case, whereas the jQuery html output is completely lower case) Please help.
According to http://www.w3.org/TR/CSS21/selector.html, in HTML element names are case-insensitive, but in XML they are case- sensitive. The same is true for attribute names.
So, the HTML output you are getting is correct. To my knowledge, jQuery core can't create an HTML document, where case sensitivity matters for element and attribute names.
EDIT: See below. I had originally said jQuery can't create an XML document where case sensitivity matters. Clearly, it can. But it can't preserve the case if you're injecting into HTML. For a solution, see: jQuery converting XML tags to uppercase
the problem would be the .html() ... html in itself should be lowercase so jquery jsut return the "Valid" html format. if u need to parse xml i am sure theres librairy to do it that will keep the Case of your Xml.
personally i would try parsexml or any of the library you could find with a quick search
http://api.jquery.com/jQuery.parseXML/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With