[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reading XML from a byte[]
I did it with InputSource.
Amazing how many ways to do something.
InputSource is = new InputSource(new StringReader(new String(data)));
> > DocumentBuilder builder = factory.newDocumentBuilder();
> > Document doc = builder.parse(new File(Globals.getProfileFileName
()));
> >
> > But in this new case I need to read XML from a byte array.
>
> Try this:
> buf = /* The byte[] you want to read*/
> DocumentBuilder builder = factory.newDocumentBuilder();
> ByteArrayInputStream bais = new ByteArrayInputStream(buf);
> Document doc = builder.parse(bais);
>
> Hope that helps!
>
> Later,
> Jamil Karim
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
>