开发者

jQuery - case insensitive tag selector

开发者 https://www.devze.com 2023-01-25 07:04 出处:网络
I\'ve got a XML document looking like this: <Xmlpp Version=\"0.3\"><meta><Id>123456789</Id></meta></Xmlpp>

I've got a XML document looking like this:

<Xmlpp Version="0.3"><meta><Id>123456789</Id></meta></Xmlpp>

开发者_开发知识库And this is how jQuery behaves:

// theDocument is a reference to the XML document
$("meta id", theDocument).size(); // Will return 0
$("meta Id", theDocument).size(); // Will return 1

Is there a way to do a case insensitive search?


Alternatively - write a schema. Make that XML to comply with your schema. I think that it's easier to be consistent rather than code around inconsistancies.


Assuming your xml is exactly as you described, the easiest way should be

$("meta > *", theDocument).size(); 
0

精彩评论

暂无评论...
验证码 换一张
取 消