Hi
I am having problem to understand how to implement a solution to a problem I have. My goal is to validate a set of xhtml documents that also includes facelet, jsf tags.
A sample xhtml document can look like this.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:j="http://swedbank.com/application/jsf">
<body>
<!-- Everything above will be removed at runtime -->
<ui:composition template="../common/application-template.xhtml">
<ui:define name="heading">
#{messageSource.title_pageHeading}
</ui:define>
<ui:define name="main">
<h:form id="form">
<h:inputText id="textInput" size="9" maxlength="8" title="#{messageSource.tooltip_enter_text}" value="#{myBean.text}"/>
<h:commandButton id="theButton" type="submit" value="#{messageSource.button}" title="#{messageSource.tooltip_button}" action="ok"/>
</h:form>
</ui:composition>
<!-- Everything below will be removed at runtime -->
</body>
</html>
So how can I use SAX or possible StAX to validate this? The problems I have encountered are
I need to run this offline (so no schemas or DTD can be downloaded on runtime). (I usually just get a UnknownHostException www.w3c.org).
There doesn't exists offical schemas for facelet, jsf but I found xsd for them (http://relation.to/Bloggers/ItsTimeForFaceletsToStartUsingXSD#attachment1) (has been generated from the TLDs).
When using SAX I can't get it to validate both the DTD and the xsd simulationsly.
I don't want to use DOM as the validation should be run for a large number of xhtml files.
So is there any XML validation experts out there that can help me solve this problem? Any resources that can point me in the right direction?
Best Regards,
Markus
Edited by: Backmask on May 6, 2010 10:37 AM