& in XML

I have a requirement to present an XML page to a user, and for various reasons we’ve decided to build the XML in a view (embeded view on a page, actually) rather than go with ?readviewentries.

I have one document witha field that contains an ampersand (&). When I display a view containing this field using ?readviewentires, everything displays fine. When I use the page I’ve created, however, my browser displays the error “Whitespace is not allowed at this location”. I’ve narrowed the issue down to the ampersand - when I change it to another character my view works fine - and I can’t understand why it renders fine with ?readviewentries but not with my view.

Does anyone have any tips for getting the “&” to render correctly in my XML?

Subject: & in XML

Ampersand is THE reserved character of XML, a real pain in the ass anything you do with XML.

You have to check that the character is replaced with “&” when used in a XML flow. There are other XML tricks for this issue, but maybe less convenient for you.

Hope it helps.

Subject: RE: & in XML

Edit - never mind, I’m an idiot. I had tried to do that and screwed something up. Thanks for the input.

Subject: RE: & in XML

Are there any other special characters - I’m getting the opposite problem - DOM parser reports “unexpected whitespace” for some content, but the input it very big (>30K), and I haven’t been able to find what triggers it.

Thanks for any help.

Subject: RE: & in XML

I tried keying in all the special characters on my keyboard, and the only ones that seemed to cause a problem were “&”, “<”, and “>”.

Subject: RE: & in XML

Off the top of my head, replace">" with >

“<” with <

You may also have to replace " with " but not sure about that. If you do then also ’ with ' ?

Anyhow, you can look em up on the Internet thingie.

Subject: RE: & in XML

Copy your xml output in another parser (like Bonfire) that can tell you the line and the character where is the fault.