S
S
sanphir2014-12-22 13:34:01
JavaScript
sanphir, 2014-12-22 13:34:01

How to parse an XML string with an attribute on the client?

People help, who knows how to parse a string with an attribute on the xml client?
this works: $.parseXML('<foo><bar1>Stuff</bar1><bar2>Stuff</bar2></foo>')
this doesn't work: $.parseXML('<foo xsi:type="SendAnswerViewModel "><bar1>Stuff</bar1><bar2>Stuff</bar2></foo>')
Via DOMParser.parseFromString the same story.
Tried escaping the quotes in the attribute, doesn't help either.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
krypt3r, 2014-12-22
@sanphir

<foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SendAnswerViewModel"><bar1>Stuff1</bar1><bar2>Stuff2</bar2></foo>

Not?

S
sanphir, 2014-12-22
@sanphir Asker

I figured it out, the fact is that the namespace for xsi was not specified

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question