aspose file tools*
The moose likes JSF and the fly likes Error:The XML page cannot be displayed Cannot view XML input using style sheet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Error:The XML page cannot be displayed Cannot view XML input using style sheet" Watch "Error:The XML page cannot be displayed Cannot view XML input using style sheet" New topic
Author

Error:The XML page cannot be displayed Cannot view XML input using style sheet

bilal haider
Ranch Hand

Joined: Feb 08, 2011
Posts: 47

Hi,
I have a templatepage.xhtml



and my index page is

<html>
<head> </head>
<body>
<%-- <jsp:forward page="faces/ICEfacesPage1.xhtml" /> --%>
<jsp:forward page="faces/templatepage.xhtml" />
</body>
</html>

contents of ICEfacesPage1.xhtml



When i run the application i get following error.

The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Cannot have multiple DOCTYPE declarations. Error processing resource 'http://localhost:8080/test/'. Line 3, Position 11

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&...


I set the ie security settings Internet options -> Security, you'll see an option
"access data sources across domains".
as mentioned in a post http://in.answers.yahoo.com/question/index?qid=20060812193550AAv5emQ
But it did not work.

Please suggest me what could be possible fixes.
bilal haider
Ranch Hand

Joined: Feb 08, 2011
Posts: 47

If I add

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> in templatepage.xhtml

a file is generated with the name of project containing the code written in templatepage.xhtml. Image Attached

and if I remove

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

from all the xhtml page. and leave only in headerpage.xhtml it shows the right behavior.

I am unable to understand this phenomena.



[Thumbnail for message.JPG]

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15665
    
  15

JSF doesn't work with HTML (or xhtml). It works with JSF View templates. Depending on how things are set up, JSF may generate HTML or XHTML, but one of the advantages of JSF is that the renderers are plug-replaceable components. You could just as easily render a PDF.

The confusion here is because ".xhtml" is the popular file extension for Facelets templates, but Facelets templates aren't (X)HTML, they're JSF XML.

The Facelets renderer is generating an XHTML doctype and you're providing one manually, and that's one more DOCTYPE than the web browser wants to see.


Customer surveys are for companies who didn't pay proper attention to begin with.
bilal haider
Ranch Hand

Joined: Feb 08, 2011
Posts: 47

Thank you tim for the reply .

I only got this .
The Facelets renderer is generating an XHTML doctype and you're providing one manually, and that's one more DOCTYPE than the web browser wants to see.


Other points have gone over my head.

I removed all the the doctype line and added



in web.xml

and problem is fixed. But i am interested to understand other points as well. i am new to jsf,icefacses.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15665
    
  15

A lot of what I say goes over people's heads. Don't worry about it, as long as you get your problem solved.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error:The XML page cannot be displayed Cannot view XML input using style sheet
 
Similar Threads
JSF 2.0 Login
JSF2 Page not loading on Redirect
Problem! Styles not applied on the controls in icefaces
Trying to change <ui:include> src tag dinamically
Why events are not fired when value changes in h:selectOneMenu? I am stuck!