Author: alexsmirnov
Date: 2007-07-12 19:46:02 -0400 (Thu, 12 Jul 2007)
New Revision: 308
Modified:
trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/xmlfilter/ConfigurableXMLFilter.java
trunk/framework/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java
Log:
Fix empty attributes output in the Neko parser
Modified:
trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/xmlfilter/ConfigurableXMLFilter.java
===================================================================
---
trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/xmlfilter/ConfigurableXMLFilter.java 2007-07-10
18:27:37 UTC (rev 307)
+++
trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/xmlfilter/ConfigurableXMLFilter.java 2007-07-12
23:46:02 UTC (rev 308)
@@ -15,7 +15,6 @@
import org.ajax4jsf.framework.ajax.xmlfilter.nekko.NekkoParser;
import org.ajax4jsf.framework.ajax.xmlfilter.tidy.TidyParser;
-import org.ajax4jsf.framework.ajax.xmlfilter.tidy.TidyXMLFilter;
import org.ajax4jsf.framework.util.message.Messages;
import org.ajax4jsf.io.parser.FastHtmlParser;
import org.apache.commons.collections.ArrayStack;
@@ -28,13 +27,23 @@
*/
public class ConfigurableXMLFilter extends BaseXMLFilter {
- private static final Log log = LogFactory
+ public static final String NONE = "NONE";
+
+ public static final String NEKO = "NEKO";
+
+ public static final String TIDY = "TIDY";
+
+ private static final Log log = LogFactory
.getLog(ConfigurableXMLFilter.class);
- private static final String PARSERS_LIST_PARAMETER =
"org.ajax4jsf.xmlparsers";
+ private static final String PARSERS_LIST_PARAMETER =
"org.ajax4jsf.xmlparser.ORDER";
private static final String VIEW_ID_PATTERN_PARAMETER =
"org.ajax4jsf.xmlparser.";
+ public static final String TEXT_HTML = "text/html";
+
+ public static final String APPLICATION_XHTML_XML =
"application/xhtml+xml";
+
/**
* map of the parsers names and viewId patterns for all parser type.
*/
@@ -63,11 +72,11 @@
for (int i = parsersNames.length - 1; i >= 0; i--) {
String parserName = parsersNames[i];
ParserConfig parserConfig;
- if ("TIDY".equals(parserName)) {
+ if (TIDY.equals(parserName)) {
parserConfig = new TidyParserConfig();
- } else if ("NEKO".equals(parserName)) {
+ } else if (NEKO.equals(parserName)) {
parserConfig = new NekoParserConfig();
- } else if ("PASS".equals(parserName)) {
+ } else if (NONE.equals(parserName)) {
parserConfig = new PassParserConfig();
} else {
throw new ServletException(
@@ -94,7 +103,7 @@
/*
* (non-Javadoc)
*
- * @see
org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter#getParser(java.lang.String,
+ * @see org.ajax4jsf.webapp.BaseXMLFilter#getParser(java.lang.String,
* boolean, java.lang.String)
*/
protected HtmlParser getParser(String mimetype, boolean isAjax,
@@ -102,8 +111,8 @@
HtmlParser parser = null;
if (isAjax || isForcexml()) {
parser = parsers.getParser(viewId, mimetype);
- } else if (mimetype.startsWith("text/html")
- || mimetype.startsWith("application/xhtml+xml")) {
+ } else if (mimetype.startsWith(TEXT_HTML)
+ || mimetype.startsWith(APPLICATION_XHTML_XML)) {
parser = new FastHtmlParser();
}
return parser;
@@ -112,7 +121,7 @@
/*
* (non-Javadoc)
*
- * @see
org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter#reuseParser(org.ajax4jsf.framework.ajax.xmlfilter.HtmlParser)
+ * @see
org.ajax4jsf.webapp.BaseXMLFilter#reuseParser(org.ajax4jsf.webapp.HtmlParser)
*/
protected void reuseParser(HtmlParser parser) {
parsers.reuseParser(parser);
@@ -139,6 +148,7 @@
// If tidy not handle all requests, disable reorganising
// of html
// parser.setMoveElements(isForcexml());
+// parser.init();
}
// TODO - set header scripts/styles filter.
return parser;
Modified: trunk/framework/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java
===================================================================
---
trunk/framework/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java 2007-07-10
18:27:37 UTC (rev 307)
+++
trunk/framework/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java 2007-07-12
23:46:02 UTC (rev 308)
@@ -1084,11 +1084,14 @@
{
writer.write(' ');
- if ( ((value.length() == 0) || value.equalsIgnoreCase(name))
+ if ( ((value.length() == 0) )
&& elemDesc != null
&& elemDesc.isAttrFlagSet(name, ElemDesc.ATTREMPTY))
{
writer.write(name);
+ writer.write("=\"");
+ writeAttrString(writer, name, this.getEncoding());
+ writer.write('"');
}
else
{