My main (parser) code looks like this:
public class pFormasDePagamento {
public static void parseXML(String xml)
throws ParserConfigurationException, SAXException, IOException {
InputSource is = new InputSource(new StringReader(xml));
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(is);
doc.getDocumentElement().normalize();
String valFormaOutros = doc.getElementsByTagName("VALOR").item(0)
.getTextContent();
String descForma = doc.getElementsByTagName("DESCRICAO").item(0)
.getTextContent();
String valForma = doc.getElementsByTagName("VALOR").item(1)
.getTextContent();
String descForma1 = doc.getElementsByTagName("DESCRICAO").item(1)
.getTextContent();
String valForma1 = doc.getElementsByTagName("VALOR").item(2)
.getTextContent();
String descForma2 = doc.getElementsByTagName("DESCRICAO").item(2)
.getTextContent();
String valForma2 = doc.getElementsByTagName("VALOR").item(3)
.getTextContent();
String descForma3 = doc.getElementsByTagName("DESCRICAO").item(3)
.getTextContent();
String valForma3 = doc.getElementsByTagName("VALOR").item(4)
.getTextContent();
String descForma4 = doc.getElementsByTagName("DESCRICAO").item(4)
.getTextContent();
String valForma4 = doc.getElementsByTagName("VALOR").item(5)
.getTextContent();
String descForma5 = doc.getElementsByTagName("DESCRICAO").item(5)
.getTextContent();
String valForma5 = doc.getElementsByTagName("VALOR").item(6)
.getTextContent();
}}
I would like to save all of these strings (valForma1 ... 5) to be reused in other .java
How can I resolve this?