the first answer work perfectly! I didn't try the other solution yet.
PS I'm using inputsource too:
ByteArrayInputStream in = new ByteArrayInputStream(fileXML.getBytes());
InputSource source = new InputSource(in);
r.setErrorHandler(new XMLErrorHandler());
r.parse( source );
thanks a lot,
both of you
jc
"Andy Fish" <> wrote in message news:<vKPrb.1110$>...
> in retrospect I concur with sudsy
>
> your original comment that it only accepts inputStream was not quite
> correct. You can also construct a sax InputSource from a reader, so a
> StringReader would be the most appropriate solution.
>
> "Sudsy" <> wrote in message
> news:...
> > curwen wrote:
> >
> > > Hi all
> > > I'm trying to use the .parse method accepting only inpustream as
> parameter,
> > > but I have he xml file in a String (is quite short)
> > >
> > > how can I do to pass a string to the xmlreader.parse method?
> > >
> > > thanxs in avance
> > > jc
> > >
> >
> > See java.io.StringReader class.
> >
|