> Hello all,
> 
> i am trying to parse an xml file in a servlet an get the result as a pdf
> in the browser.
> The file i'm trying to parse is "Chap0701.xml" from examples.
> I tried two solutions to parse the file but each one gives an
> "UnknownHostException : www.lowagie.com"
> Here is the code of my doGet method:
> 
> 
>     public void doGet(HttpServletRequest request, HttpServletResponse
> response) throws ServletException, IOException {
>         try {
>             // create simple doc and write to a ByteArrayOutputStream
>             Document document = new Document();
>             ByteArrayOutputStream baos = new ByteArrayOutputStream();
>             PdfWriter.getInstance(document, baos);
> 
>             //XmlParser.parse(document,
> "E:\\projet\\DarwinRepository\\src\\web\\Chap0701.xml");
>             SAXParser parser =
> SAXParserFactory.newInstance().newSAXParser();
>  
> parser.parse("E:\\projet\\DarwinRepository\\src\\web\\Chap0701.xml", new
> SAXiTextHandler(document));
> 
>             // write ByteArrayOutputStream to the ServletOutputStream
>             response.setContentType("application/pdf");
>             response.setContentLength(baos.size());
>             ServletOutputStream out = response.getOutputStream();
>             baos.writeTo(out);
>             out.flush();
> 
>         }
>         catch (Exception e2) {
>             System.out.println("Error in
> "+getClass().getName()+"\n"+e2+"\n\n");
>             e2.printStackTrace();
>         }
>     }
> 
> If you have any idea it would be great.
> Thank's in advance,
> Jyves



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to