File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes byte[ ] - xml - byte[ ] Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "byte[ ] - xml - byte[ ] " Watch "byte[ ] - xml - byte[ ] " New topic
Author

byte[ ] - xml - byte[ ]

e vanduffel
Greenhorn

Joined: Nov 04, 2003
Posts: 12
hey guys,
i got the following problem:
I receive an array of bytes, which represent an XML.
i read this byte array and i put it in a Document Object.
Now I want to change some values in the Document object, and put
it back in to a byte array...
Anybody an idea ?

greetz,
Wout
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
How far have you gotten with XML? If you have a good tutorial or example in hand, look for a call to DocumentBuilderFactory. This will return the appropriate DocumentBuilder (parse) for the XML package you have installed. Then hit the JavaDoc for DocumentBuilder. The parse methods can take a File parameter, a URL-string parameter, or an InputStream. The last one sounds like a good bet. See if you can construct a new InputStream that will work with your ByteArray.
That gets a byte array into a DOM ... about the first third of your challenge. I don't know how much you know so I'm giving pretty vague hints about where to look for things, hoping you'll enjoy hunting them down. If you need more specific help, or if you get through the first third and want talk about the next - modifying the DOM - just holler.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Oh, and I forgot to say - scroll down to the XML forum for real expert answers. Folks there do this in their sleep.
e vanduffel
Greenhorn

Joined: Nov 04, 2003
Posts: 12
Stan,
well i got the first and the second of three challenges
under control
the only issue is the conversion of the Document object
to a byte array...
greetz,
wout
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: byte[ ] - xml - byte[ ]
 
Similar Threads
Remove Indentation during Transformation
binary to String conversion
Xml Element to Byte Array
From Document Object to a byte array
writing byte array into a file