[jdom-interest] help XMLOutputter

Wes Rood Wes_Rood at mgic.com
Fri Oct 26 07:49:02 PDT 2001


I think it may have something to do with your file separator slash.

Try either a double backslash in your string - \\ or try explicitly using 
File.separator, that will take the correct file separator for your 
platform.

I've also had problems using spaces in filenames occasionally.  This is 
less likely, but if the slash change doesn't work, try renaming your 
subdirectory to one without spaces.

Wes




Mark Bennett <mbennett at ideaeng.com>
Sent by: jdom-interest-admin at jdom.org
10/26/2001 09:28 AM
Please respond to mbennett

 
        To:     "Lopez, William" <william.lopez at eds.com>, jdom-interest at jdom.org
        cc: 
        Subject:        RE: [jdom-interest] help XMLOutputter


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

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20011026/56153c04/attachment.htm


More information about the jdom-interest mailing list