[Home] [By Thread] [By Date] [Recent Entries]


Brian OBrien wrote:
> So what does one pass to XPath in order
> to extract an element?
> Are you supposed to know what prefix is going to be
> used?

No. if you had something like this:

   dom = toDom("<u:response xmlns:u='foobar'>resp</u:response>");

then you could use something like this:

  xpath = ...
  xpath.addPrefix("foobar", "x")
  responseText = xpath.eval(dom, "/x:response/text()")

ie, prefixes are relative to namespace bindings.

cheers
Bill

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member