Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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.
 
rubbery bacon. rubbery tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic