[jdom-interest] help XMLOutputter

Mark Bennett mbennett at ideaeng.com
Fri Oct 26 07:28:06 PDT 2001


Hello William,

No problem on the question; newbies unite!  :)

Where you have:
String file = "c:/Documents and Settings/xzs3h2/jbproject/DTDMap/" + newTime
+ "_acceptance.xml";

Could you check the value of the file variable after this command?  Either
in your debugger or maybe with:

System.out.println( "file name ='" + file + "'" );

That might be helpful for debugging.

Mark

-----Original Message-----
From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org]On
Behalf Of Lopez, William
Sent: Friday, October 26, 2001 6:54 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] help XMLOutputter

The issue I'm having is probably more of a "basic" coding issue than a JDOM
issue but I'll try my luck here first.

I'm attempting to use the XMLOutputter class to create XML files from a JDOM
object that is retrieving Clob files from a database so I can see the test
data. Here's the code for that piece:

      inputsource = new InputSource(is);
      doc = builder.build(inputsource);

      StringBuffer sb = new StringBuffer();
      String wholeTime = new
java.sql.Timestamp(System.currentTimeMillis()).toString();
      String date = wholeTime.substring(0, 10);
      sb.append(date).append("_");
      sb.append(wholeTime.substring(11,19));
      String newTime = sb.toString();

      String file = "c:/Documents and
Settings/xzs3h2/jbproject/DTDMap/acceptance.xml";
      OutputStream os = new FileOutputStream(file, true);
      XMLOutputter xo = new XMLOutputter("   ", true, "UTF-8");
      xo.setTextNormalize(true);
      xo.output(doc, os);

This works but I don't want to append [new FileOutputStream(file, true);]
each XML image in the one acceptance.xml file. I was trying to use the
following code to create different file names: String file = "c:/Documents
and Settings/xzs3h2/jbproject/DTDMap/" + newTime + "_acceptance.xml"; but I
was receiving a "bad parameter" error message at: OutputStream os = new
FileOutputStream(file, true);

Sorry for the newbie question but any suggestions would be appreciated.

Thanks,

William Lopez
EDS - Health and Insurance Solution Centre
MS C3-1C-37
5400 Legacy Drive
Plano, TX 75024

* phone: +01-972-604-3372 (834-3372)
* mailto:william.lopez at eds.com
www.eds.com


_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com




More information about the jdom-interest mailing list