DOM.Document xmlDOC = new DOM.Document();
xmlDOC.load(xmlstring);
DOM.XMLNode rootElement = xmlDOC.getRootElement();
for(DOM.XMLNode xmlnodeobj:xmlDOC.getRootElement().getChildElements()){
For(Quote_line_item__c q:q1){
if(q.Name==xmlnodeobj.getChildElement('REF',null).getText()){
q.Current_Stock__c= xmlnodeobj.getChildElement('QUANTITY',null).getText();
}
}
}
Sample XML string:
XMLString='<RESULT><LINE><REF>12600</REF><QUANTITY>980</QUANTITY></LINE><LINE><REF>12601</REF><QUANTITY>3254</QUANTITY></LINE></RESULT>';
Exception : Visualforce Error Help for this Page
System.NullPointerException: Attempt to de-reference a null object Class.createorder.: line 128, column 1 xmlnodeobj.getChildElement('REF',null).getText()
Null pointer exception coming from this statement.
Can any body help me regarding this?