function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CharlieLangCharlieLang 

XML Ampersand issue

We are working on a project that has an XML import routine written. Would anyone know why below is not allowing special characters to be inserted into salesforce fields. Would anyone be able to identify quickly why this is not working properly?

this is a sample of the xml
<company>before &amp; after</company>
<job-function>&lt;inbrackets&gt;</job-function>

We are pulling the data from a server . Once we get the XML data we parse this data using Xmlstreamreader . But we are getting issues with spacial character .  Xmlstreamreader not accepting these spacial characters

here is the code
Xmlstreamreader reader = new Xmlstreamreader(getxml);

while(reader.hasNext()) {
      if (reader.getEventType() == XmlTag.START_ELEMENT) {
         if ('event' == reader.getLocalName()) {
           
          event.N200_Event_Code__c=reader.getAttributeValue(null, 'code');
            //eventdetails(reader);
          }
         else if('name' == reader.getLocalName()){     
           event.name=eventdetails(reader);
      //     system.debug('%%%%%%%%event.name'+event.name);         
         }
        else if('description' == reader.getLocalName()){     
           event.Description__c=eventdetails(reader);
        //   system.debug('%%%%%%%%event.name'+event.name);         
         }