• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

xml as byte array

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm new to this.

Is it possible to parse xml that is passed as byte[]?

Another question. Can I create a XML with DOM and then convert it to a byte array?

I want to create two methods. One that receives a byte array that represents xml. And, one method that converts xml to a byte array.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Karin Paola Illuminate:
Is it possible to parse xml that is passed as byte[]?


Yes. See ByteArrayToDocument on our FAQ server for example code.

Originally posted by Karin Paola Illuminate:
Another question. Can I create a XML with DOM and then convert it to a byte array?

Yes. See DocumentToByteArray on our FAQ server for example code.
 
Karin Paola Illuminate
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I use ByteArrayToDocument. Is it possible to parse the XML with SAX?
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Karin Paola Illuminate:
If I use ByteArrayToDocument. Is it possible to parse the XML with SAX?


Sure. You pass "new ByteArrayInputStream(myByteArray)" or "new InputSource(new ByteArrayInputStream(myByteArray))" to the parse() method of the SAXParser.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic