[jdom-interest] Removing default encoding.

Tasso Angelidis TassoA at trustmarque.ca
Thu Aug 9 11:47:27 PDT 2001


Hi I am creating a document...

  public String createErrorMessage(String code, String message)
  {
      Element root = new Element("TMSTN");
      Element error = new Element("Error");
      Element errCode = new Element("Code");
      Element errMessage = new Element("Message");

      root.addContent(error);
      error.addContent(errCode);
      error.addContent(errMessage);
      errCode.addContent(code);
      errMessage.addContent(message);

      Document doc = new Document(root);


      XMLOutputter output = new XMLOutputter();
      StringWriter writer = new StringWriter();

      try
      {
        output.output(doc, writer);
      }
      catch(Exception e)
      {}

      return(writer.toString());
  }

The output...

<?xml version="1.0" encoding="UTF-8" ?> 
<TMSTN>
	<Error>
		<Code>100</Code> 
		<Message>Insert successfull.</Message>
	</Error>
</TMSTN>

Is it possible to not print the default encoding >>>> encoding="UTF-8" 



More information about the jdom-interest mailing list