This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes JSP outputs xml - xml parse error - page directives insert blank lines?! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP outputs xml - xml parse error - page directives insert blank lines?!" Watch "JSP outputs xml - xml parse error - page directives insert blank lines?!" New topic
Author

JSP outputs xml - xml parse error - page directives insert blank lines?!

John Brown
Ranch Hand

Joined: Dec 01, 2004
Posts: 35
Hi all,
I'm trying to output xml with this jsp page:


But the browser complains:

XML Parsing Error: xml declaration not at start of external entity
Location: http://127.0.0.1:8080/bla
Line Number 5, Column 1:
<?xml version="1.0" encoding="UTF-8"?>
^

The source of the page is:

Notice the 4 blank lines in the output? They're cause by the 4 directives I've put in the jsp:



These 4 blank lines are the cause of the xml parse error. So why do I get them in the output?

Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

This article explains the whitespace.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JSP outputs xml - xml parse error - page directives insert blank lines?!
 
Similar Threads
Duplicate code
jsp:param not working inside jsp:include and JSF
JSF Tag Problem
TLDs not working on Tomcat 5.5, but working on Tomcat 6
problem when working with selectOneListbox