I am making an external call to a Server and returning XML (HTTPResponse). I then use a DOM parser to get a list of items.
How can I add the list of items to a DataTable/DataList?
How can I parse the XML structure into a Salesforce structure within the class itself?
Thank you
Hi eyesscream. All is working fine, except one thing. I needed to get deep in XML
Dom.XMLNode rootElement = doc.getRootElement();
for (Dom.XmlNode assets : rootElement.getChildElements()) {
if (assets.getName().trim() == 'models') {
for (Dom.XmlNode asset : assets.getChildElements()) {
if (asset.getName().trim() == 'model') {
for (Dom.XmlNode serial : asset.getChildElements()) {
if (serial.getName().trim() == 'modelNumber') {
text = serial.getText().trim();
allOptons.add(new SelectOption(text, text));
}
}
}
}
}
}
on VF page it duplicates the results. Why?
Go through your XML adding elements to a list of strings of wrapper objects if you need to store more than 1 parameter. Then such list can be assigned to dataTable, pageBlockTable, repeat etc tags without any problems. It’s not like these tags work only on standard sObjects.
For a simple list of Strings with checkboxes you don’t even need any helper classes.