title: XML parse error MalformedURLException: no protocol:
body: <p>I'm trying to modify a method from a program make it y JAVA 6.3 and I getting the following error "Malformed URL Exception".</p>
  
  <p>I'm using this code.</p>
  
  <pre><code>DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          try{
              DocumentBuilder builder = factory.newDocumentBuilder();
              DOMImplementation implementation = builder.getDOMImplementation();
              Document document=implementation.createDocument(null, "xml", null);
             //  Document document=implementation.;
              Element raiz = document.createElement("Correos");// creamos el elemento raiz
              Element elemento = document.createElement("Correo");//creamos un nuevo elemento
              Text text = document.createTextNode("pepito@email.com");//Ingresamos la info
  
              document.setXmlVersion("1.0");// asignamos la version de nuestro XML
              document.getDocumentElement().appendChild(raiz);  //pegamos la raiz al documento
              raiz.appendChild(elemento); //pegamos el elemento hijo a la raiz
              elemento.appendChild(text); //
  
              Source source = new DOMSource(document);
  
              String datos="";
  
              Result console= new StreamResult(System.out);
              Result result = new StreamResult(new java.io.File("resultado.xml"));//nombre del archivo
              Transformer transformer = TransformerFactory.newInstance().newTransformer();
              transformer.transform(source, result);
              transformer.transform(source, console);
              //transformer.t
             // DocumentBuilder db = new DocumentBuilder();
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              DocumentBuilder db =  dbf.newDocumentBuilder();
  
              //db.parse(datos) ;
              String xmlX =("&lt;?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?&gt;\n&lt;xml&gt;\n&lt;Correos&gt;\n&lt;Correo&gt;pepito@email.com&lt;/Correo&gt;\n&lt;/Correos&gt;\n&lt;/xml&gt;");
              db.parse(xmlX);
                      //document;
          }catch(Exception e){
              System.err.println("Error:" +e);
          }
  </code></pre>
  
  <p>As you can see on line 31 I'm "wiring" the XML sending an String.</p>
  
  <p>The XML that I'm using I already test it on several Web navigators and I never get such error as in JAVA.</p>
  
  <p>Basically what I need is to create a "<strong><em>Document</em></strong>" variable because is that type of variable that is returned by the method that I need to modify.</p>
  
  <p>In the original method, not in the upper code, that code(the upper one) is another project that I'm use in order to debug a bigger code, is a method that returns a "<strong><em>Document</em></strong>".</p>
  
  <p>Here the original code that I need to modify.(The following code is inside of a <strong><em>try catch</em></strong>)</p>
  
  <pre><code>DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  InputStream input = HTMLTools.inputStream_GET(url, timeoutMS);
  InputStreamReader reader = new InputStreamReader(input, ENCODING_UTF8);
  InputSource inSrc = new InputSource(reader);
  inSrc.setEncoding(ENCODING_UTF8);
  
  return db.parse(inSrc);
  </code></pre>
  
  <p>I don't understand very well the purpose of the method parse of the db variable.</p>
  
  <p>I thinking too that maybe I didn't need the db variable since I'm already have a variable type "<strong><em>Document</em></strong>" from the upper code.</p>
  
  <p>I already read the JavaDoc but I don't figure out how this codes works, basically the XML part.</p>
  
  <p>So basically I think that I'm getting messy, Can anyone clarify me what I doing wrong?</p>
  
  <p>Thanks.:-)</p>