Sponsored Content
Full Discussion: Output to a file in java
Top Forums Programming Output to a file in java Post 302362008 by varontron on Wednesday 14th of October 2009 05:31:14 PM
Old 10-14-2009
not entirely sure, but I think you can't transform a DOM Document into a stream result without serializing it first.

look at the docs for org.apache.xml.serializer.DOMSerializer;

here's some code fragments that may be helpful.

Code:
public static Serializer getSerializer()
	{
		Properties props = OutputPropertiesFactory.getDefaultMethodProperties("xml");
		ser = SerializerFactory.getSerializer(props);
		return ser;
	}

os = new ByteArrayOutputStream();
ros = new ByteArrayOutputStream();
getSerializer().setOutputStream(os);
DOMSerializer dser = getSerializer().asDOMSerializer();
dser.serialize(document);
is = new ByteArrayInputStream(os.toByteArray());
source = new StreamSource(is);
result = new StreamResult(ros);

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

lslpp output for Java package

Hi , in the process of installing HBA's(IBM 6228's) for AIX 6F1 which was recently upgdared to 5.3 ML1 after the upgrade lppchk -v output displays the following. >lppchk -v lppchk: The following filesets need to be installed or corrected to bring the system to a consistent state: ... (1 Reply)
Discussion started by: Student37
1 Replies

2. UNIX for Dummies Questions & Answers

Interpreting java output stream as system commands in Solaris

Hi there again, Running Solaris 10 with built-in Java. Seems to compile and run fine. Problem is: Say I want to see contents of current directory. In a shell, I'd just write "ls" and it outputs the content. When I write a Java file, I have the following line: System.out.println("ls"); ... (1 Reply)
Discussion started by: EugeneG
1 Replies

3. Shell Programming and Scripting

Dynamic output file generation using a input text file with predefined output format

Hi, I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format. Example: File.txt AP|{SSHA}VEEg42CNCghUnGhCVg== APVG3|{SSHA}XK|"password" AP3|{SSHA}XK|"This is test" .... etc --------- test.sh has... (1 Reply)
Discussion started by: hudson03051nh
1 Replies

4. Shell Programming and Scripting

Logging Remote SSH command (cannot log a java output)

Hi all I'm creating a script that runs a few commands on some boxes and everything can be logged EXCEPT the java -version command, there doesn't seem to be any output... Can anyone help explain why this does not work? Do I need to do something extra to append the output from the java... (3 Replies)
Discussion started by: Keepcase
3 Replies

5. Shell Programming and Scripting

Problem with call of Java Programm & return code handling & output to several streams.

Hello Everybody, thanks in advance for spending some time in my problem. My problem is this: I want to call a java-Programm out of my shell skript, check if die return code is right, and split the output to the normal output and into a file. The following code doesn't work right, because in... (2 Replies)
Discussion started by: danifunny
2 Replies

6. AIX

Any file to differentiate JAVA JRE and JAVA JDK

Folks, Any idea of where can I find a specific file to differentiate JRE and Java JDK installed on AIX platform :cool: (3 Replies)
Discussion started by: dellcisco
3 Replies

7. Shell Programming and Scripting

Reading output returned to OS from java program.

I am writing one shell script in which there is one Java program call. I want to stop execution of shell script ahead of java program if the java program returns 1 . How to read that value of java program from OS ? (3 Replies)
Discussion started by: ParthThakkar
3 Replies

8. Programming

Running java script from piped output

to run most other scripts through a pipe, something similar to the following is usually enough: cat script.sh | sh cat perl.pl | perl -- "<arguments" However, for javascript command line scripts, i cant seem to get this to work. Any ideas? cat hull.js #!/usr/bin/js ... (3 Replies)
Discussion started by: SkySmart
3 Replies

9. Shell Programming and Scripting

Supress java error output to shell

Hello, I know this isn't exactly a shell script question but I'm not sure where else to post it. I am running a java program out of a shell script. There are times when I get an error like, "java.lang.ArrayIndexOutOfBoundsException: 22 at blah, blah at blah, blah ... (3 Replies)
Discussion started by: LMHmedchem
3 Replies
props(1)                                                      General Commands Manual                                                     props(1)

NAME
props - Change OpenWindows settings SYNOPSIS
props [ generic-tool-arguments ] DESCRIPTION
props can be used to change certain settings for OpenWindows/XView programs using a GUI. As most of these settings are stored in OpenWin- dows-specific X resources, they won't have an influence on non-OpenWindows programs. These are the settings that can be modified using props (their meaning is explained in xview (7)): OpenWindows.Beep OpenWindows.DragRightDistance OpenWindows.IconLocation OpenWindows.MultiClickTimeout OpenWindows.PopupJumpCursor OpenWindows.ScrollbarPlacement OpenWindows.SelectDisplaysMenu OpenWindows.SetInput OpenWindows.WindowColor OpenWindows.WorkspaceColor Scrollbar.JumpCursor *displayLang: C *timeFormat: C *basicLocale: C *inputLang: C *numeric: C OPTIONS
generic-tool-arguments props accepts the XView generic tool arguments described in xview (7). FILES
~/.Xdefaults Stores user's resource values. Modified by props when new settings are applied. AUTHOR
This manual page was written by Martin Buck <mbuck@debian.org> for Debian GNU/Linux. SEE ALSO
xview(7) BUGS
props saves all resources currently defined in the X server to ~/.Xdefaults, overwriting its current contents. This will remove comments and conditionals, reorder resources and also save resources which were originally loaded into the server by other means. The color selector is available only on display classes GrayScale, PseudoColor and DirectColor. XView Version 3.2p1 props(1)
All times are GMT -4. The time now is 05:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy