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
vnbhargavivnbhargavi 

CREATING LIST OF DOM

hi all,

 

i am tryng write XMl message using xml classes and i want to break the XMl message into different chunks ..so i want to repeat the root element  as well .. how can i do this using the DOM classes there am using DOM class and cretaed the root element........

 

here is my code:

 

DOM.Document[] doc = new list<DOM.Document>();
        dom.XmlNode envelope = doc[batchsize].createRootElement('\nEnvelope', soapNS, 'soapenv');
          envelope.setNamespace('\nxsi', xsi);
          envelope.setAttributeNS('\nschemaLocation', soapNS, xsi, null);
          dom.XmlNode body = envelope.addChildElement('\nBody', soapNS, null);

 

           for(Integer i=0;i<acc.size()/5;i++)
          {         
          for(Account loopvar: acc)
         {
         dom.XmlNode accountList = body.addChildElement('accountList',xsi,null);
          dom.XmlNode AccountName = accountList.addChildElement('Name', xsi, null).addTextNode(loopvar.Name);
          accountList.addChildElement('Id', xsi, null).addTextNode(loopvar.Id);
          if(loopvar.TOMID__c!=null)
          accountList.addChildElement('TOMID\t\t', xsi, null).addTextNode(String.Valueof(loopvar.TOMID__c));
         }
         }