1

I am consuming a web service that has an apostrophe contained within the namespace, which is causing problems for simplexml.

eg. xmlns="Apostrophe's here/Foo/Bar"

I've tried addslashes but it doesn't seem to work because the string has already been returned containing the unescaped/encoded apostrophes and causes an error before addslashes can be run.

It strikes me as being a bit of a flaw within the web service itself. Am I right to think that? I do like a correctly placed apostrophe but it would seem as if it's more trouble than it's worth in this instance.

bcmcfc
  • 25,966
  • 29
  • 109
  • 181
  • 2
    Interesting question. My understanding, though I'm definitely open to correction, would be that the namespace name should be a [generic URI](http://tools.ietf.org/html/rfc3986#page-11), and that "Apostrophe's here/Foo/Bar" isn't a generic URI. Even if it were technically legal, I'd certainly never use a string like that as a namespace name if I were designing a web service, just because most consumers would expect a namespace name to be a more "normal" URI, including having apostrophes percent-encoded. I'll leave an authoritative answer to the many SO users who know more about XML than I do :) – Matt Gibson Mar 17 '11 at 09:40

0 Answers0