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
Rakesh RRakesh R 

System.XmlException: Failed to parse XML due to: expected = after attribute name (position: START_TAG seen <?xml version="1.0" encoding="UTF-8"?><Employee><Company Name>... @1:62)

hello professionals,
I am getting such type of error when i trying to convert XML To TEXT
Apex class code
--------------------------
public class Convert_XML_2Strin {
    public String xmlString {set;get;}
    public String result    {set;get;}
    public void convertXML(){
        Dom.Document doc=new Dom.Document();
        doc.load(xmlString);
        Dom.XMLNode root= doc.getRootElement();
        result=result+root.getName();
        List<Dom.XMLNOde> childs =root.getChildElements();
        if(childs.size()>0){
            for(Dom.XMLNode c :childs){
                result=result+'\n'+c.getName()+':'+c.getText();
            }
        }
    }
}

Visual force CODE
-------------------------
<apex:page controller="Convert_XML_2Strin">
    <apex:form id="fm">
        <apex:panelGrid columns="3">
             <apex:inputTextArea rows="10" cols="40" value="{!xmlString}" />
             <apex:panelGrid columns="1">
                 <br/>
                 <br/>
                 <br/>
                  <apex:commandButton value="Convert" action="{!convertXML}" reRender="fm"/>
             </apex:panelGrid>
           
            <apex:inputTextArea rows="10" cols="40" value="{!result}" />
        </apex:panelGrid>
       
    </apex:form>
</apex:page>