title: How to remove the white spaces between tags in XML
body: <p>I created an XML document using Java in my android application. I have to call a web service in my application and pass this XML as an argument there. But my problem is there created a white space between each tag in the XML.   </p>
  
  <pre><code>DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
  DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
  Document doc = docBuilder.newDocument();
  
  Element root = doc.createElement("subscriber");
  doc.appendChild(root);
  
  //creating child node for username
  EditText txtusername=(EditText)findViewById(R.id.txtUserName);
  subscriber[0]=String.valueOf(txtusername.getText());
  Element UserName=doc.createElement("UserName");             
  UserName.setTextContent(subscriber[0]);
  root.appendChild(UserName);
  
  //creating child node for PASSWORD 
  EditText txtPassword=(EditText)findViewById(R.id.txtPassword);
  subscriber[1]=String.valueOf(txtPassword.getText());
  Element Password=doc.createElement("Password");
  Password.setTextContent(subscriber[1]);
  root.appendChild(Password);
  
  //set up a transformer
  TransformerFactory transfac = TransformerFactory.newInstance();
  Transformer trans = transfac.newTransformer();
  trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
  trans.setOutputProperty(OutputKeys.INDENT, "yes");
  
  //create string from xml tree
  StringWriter sw = new StringWriter();
  StreamResult result = new StreamResult(sw);
  DOMSource source = new DOMSource(doc);
  trans.transform(source, result);
  String xmlString =sw.toString();
  
  url = new URL("http://192.168.70.14/NewsLetter/subscribing.php?register= " + xmlString);
  
  conn = (HttpURLConnection) url.openConnection();
  conn.addRequestProperty("Content-Type", "text/xml; charset=UTF-8"); 
  dis = conn.getInputStream();
  </code></pre>
  
  <p>The XML is:</p>
  
  <pre><code>&lt;subscriber&gt; &lt;UserName&gt;miya&lt;/UserName&gt; &lt;Password&gt;today&lt;/Password&gt; &lt;/subscriber&gt;
  </code></pre>
  
  <p>Please give the solution for how to remove the white spaces between the <code>UserName</code> and <code>Password</code> tags.</p>