Pranav
Pranav

Reputation: 143

How to avoid & in XML ?

I am trying to send all data to xml through php. But somehow XML parses the data and in Password it finds & and replaces it with & after that data is posted through Curl. So is there any method / technique to avoid & in xml. Or it goes as it is. I am tried almost all encoding functions.

Upvotes: 0

Views: 184

Answers (2)

Michael Kay
Michael Kay

Reputation: 163549

In the normal course of events, & in the data is encoded as & in the XML, and the XML parser decodes this and presents it as & to the application. If the application (curl?) is seeing it as & this is either because it has been double-escaped in the XML (as &) or because it is not being read using a real XML parser.

Upvotes: 0

Trogvar
Trogvar

Reputation: 856

Use the CDATA Section to make it leave the ampersand unchanged.

Upvotes: 3

Related Questions