• Post Reply Bookmark Topic Watch Topic
  • New Topic

byte[ ] - xml - byte[ ]  RSS feed

 
e vanduffel
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!