• 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
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.
 
It sure was nice of your sister to lend us her car. Let's show our appreciation by sharing this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic