title: Java / Android - Read, Manipulate and save XML file to internal Storage
body: <p>I'm developing an Android Application which will make use of an file System where Data will be stored in xml - files..</p>
  
  <p>I'm successfully reading the according file and altering the Nodes (the Values are changed - if viewing in debugger) but no changes are made to my locally saved file..</p>
  
  <p>Process:
  1. Read/open local file                //done
  2. Change DOM NODE                     //done
  3. Save changes in my local file       &lt;- fails</p>
  
  <p>So far I know that I will have to use the TransformerFactory after following some Tutorials and other code snippets the changes are still not saved to my file..</p>
  
  <p>Can someone tell me what I'm doing wrong?</p>
  
  <p>My Code:</p>
  
  <pre><code>try {
          File path = a.getFilesDir();
          DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
          DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
  
          Document doc = docBuilder.parse(path.getPath() + "/" + FILENAME_PERMISSIONS);
  
          NodeList myCourses = doc.getElementsByTagName(NODE_COURSE);
  
          for (int i = 0; i &lt; myCourses.getLength(); i++) {
              Node course = myCourses.item(i);
              Element e = (Element)myCourses.item(i);
  
              Node myPermission = course.getFirstChild();
              String name = e.getAttribute(ATTR_NAME);
  
              switch (name){
                  case FLAG_CrossCult:
                      myPermission.setTextContent(boolToString(crossCult));
                      break;
  
                  case FLAG_KAIROS:
                      myPermission.setTextContent(boolToString(kairos));
  
                      break;
  
                  case FLAG_UnfinStory:
                      myPermission.setTextContent(boolToString(unfinStory));
  
                      break;
  
                  case FLAG_EmpToInf:
                      myPermission.setTextContent(boolToString(empToInf));
  
                      break;
  
                  case FLAG_YouthKairos:
                      myPermission.setTextContent(boolToString(youthKairos));
  
                      break;
              }
  
              Transformer transformer = TransformerFactory.newInstance().newTransformer();
              DOMSource source = new DOMSource(doc);
  
              StreamResult streamResult = new StreamResult(new File(path.getPath() + "/" + FILENAME_PERMISSIONS));
              transformer.transform(source,streamResult);
  
  
  
  
  
          }
  
  
      }
      catch (ParserConfigurationException e){
  
      } catch (SAXException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }catch(TransformerConfigurationException e){
          e.printStackTrace();
      } catch (TransformerException e) {
          e.printStackTrace();
      }
  </code></pre>