[jQuery] XML parsing problem

[jQuery] XML parsing problem


Hi everyone,
I'm trying to build a tempalte engine based on jQuery. XML grammer is
chosen as the flow controlling work. Naturally I want to use jQuery to
parse XML doc, but the result is disappointing.
For example:
$('<for>

<if><a/><img/></if>

<while/><div><img/></div></for>')
it returns:
[for, p, while, div]
I went back to the source code and found jQuery uses regex to do the
parsing work. I understand it's good for high speed breadth first
scaning. My argument is that if we can use DOMParser in some
scenario, e.g. when given the XML header.