title: I want to parse a string to xml in java and write that to a xml file
body: <p>the file should be like this</p>
  
  <pre><code>&lt;root&gt;
       &lt;node label="ValueFromDatabase"/&gt;        
  &lt;/root&gt;;
  </code></pre>
  
  <p>and there will be more node labels that i will take form database the label is variable.</p>
  
  <p>Actually I should have made the question more clear. I used the string like this</p>
  
  <pre><code>String xmlSourceResource =
               "&lt;?xml version='1.0' encoding='UTF-8'?&gt;\n"+
               "&lt;root&gt;\n"+
               xmlString+
               "&lt;/root&gt;";
  </code></pre>
  
  <p>the xmlString variable contains the nodes with label.Now, I'm parsing it to xml like this</p>
  
  <pre><code>StringWriter xmlResultResource = new StringWriter();
  Transformer xmlTransformer=TransformerFactory.newInstance().newTransformer();    
  xmlTransformer.transform(new StreamSource(new StringReader(xmlSourceResource)),new StreamResult(xmlResultResource));
  </code></pre>
  
  <p>and I need this in an Flex action script class in an XML variable.So, how should I parse it or send the XML to flex if it is possible.I dont want to make a XML file.</p>
  
  <p>Thanks for your answers though.</p>