Take the 2-minute tour ×

What are some recommended ways of dealing with namespace heavy xml documents without having to rely on the browser?

Background: I am handling wsdl/soap documents from Web Services with ajax. It is very frustrating when something like doc.getElementsByTagName("xs:complexType") behaves differently on a mobile cordova app in a tablet, and a chrome browser on the desktop. On some of the devices you have to strip the prefix, and on others you must include it. Another example of a problem is getElementsByTagNameNS on older browsers.

JQuery out of the box seems to make you use the prefix in the selectors as opposed to the actual namespace. This is a bit of a pain, because it is very common for the documents to use multiple prefixes for the same namespace.

Dojox.xml would require me to bring an entire framework to use alongside my existing JQuery code just to handle xml.

I am currently dealing with these issues on a case-by-case basis, but I am wondering if there is a better way.

share|improve this question
If you're stripping prefixes, you're almost certainly doing something wrong, but since you've not posted any code, it's hard to say what. Please show how you are loading and using the wsdl/soap in the Chrome browser. –  Alohci Oct 4 '12 at 8:17
I am only stripping the prefix on browsers that have a broken getElementsByTagName() method that won't find the tag if i put the prefix in. Everything works fine in desktop chrome without the prefix stripped. The point was, I am trying to find good ways to parse and walk xml in js without the browser's "help". A library that eluded my searches before was xml for <script>, so I am looking into that now. –  insipid Oct 4 '12 at 13:01
add comment


Your Answer



Browse other questions tagged or ask your own question.