Author: alexsmirnov
Date: 2007-06-27 19:12:00 -0400 (Wed, 27 Jun 2007)
New Revision: 288
Modified:
branches/version_1_0_7/src/framework/java/org/ajax4jsf/framework/ajax/xmlfilter/nekko/HtmlCorrectionFilter.java
branches/version_1_0_7/src/framework/java/org/ajax4jsf/framework/ajax/xmlfilter/nekko/HtmlCorrectionState.java
Log:
Fix AJSF-88
Modified:
branches/version_1_0_7/src/framework/java/org/ajax4jsf/framework/ajax/xmlfilter/nekko/HtmlCorrectionFilter.java
===================================================================
---
branches/version_1_0_7/src/framework/java/org/ajax4jsf/framework/ajax/xmlfilter/nekko/HtmlCorrectionFilter.java 2007-06-27
22:59:21 UTC (rev 287)
+++
branches/version_1_0_7/src/framework/java/org/ajax4jsf/framework/ajax/xmlfilter/nekko/HtmlCorrectionFilter.java 2007-06-27
23:12:00 UTC (rev 288)
@@ -1,7 +1,7 @@
/**
* License Agreement.
*
- * Ajax4jsf 1.0 - Natural Ajax for Java Server Faces (JSF)
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
*
* Copyright (C) 2007 Exadel, Inc.
*
@@ -26,6 +26,8 @@
import org.apache.xerces.xni.QName;
import org.apache.xerces.xni.XMLAttributes;
import org.apache.xerces.xni.XNIException;
+import org.apache.xerces.xni.parser.XMLComponentManager;
+import org.apache.xerces.xni.parser.XMLConfigurationException;
import org.cyberneko.html.HTMLAugmentations;
import org.cyberneko.html.filters.DefaultFilter;
@@ -46,6 +48,12 @@
super();
_state = new BaseHtmlCorrectionState(null);
}
+
+ public void reset(XMLComponentManager componentManager)
+ throws XMLConfigurationException {
+ super.reset(componentManager);
+ _state = new BaseHtmlCorrectionState(null);
+ }
/* (non-Javadoc)
* @see org.cyberneko.html.filters.DefaultFilter#endElement(org.apache.xerces.xni.QName,
org.apache.xerces.xni.Augmentations)
@@ -63,17 +71,28 @@
super.startElement(element, attributes, augs);
}
- void insertStartElement(String name) {
- QName element = new QName(null,name,name,null);
+ void insertStartElement(String name, QName base) {
+ QName element = createQName(name, base);
XMLAttributes attrs = new XMLAttributesImpl();
Augmentations augs = new HTMLAugmentations();
super.startElement(element,attrs,augs);
}
+
+ /**
+ * @param name
+ * @param base
+ * @return
+ */
+ private QName createQName(String name, QName base) {
+ String prefix = base.prefix;
+ String rawname = null != prefix && (!"".equals(prefix))?
prefix+':'+name:name;
+ QName element = new QName(prefix,name,rawname,base.uri);
+ return element;
+ }
- void insertEndElement(String name) {
- QName element = new QName(null,name,name,null);
-// XMLAttributes attrs = new XMLAttributesImpl();
+ void insertEndElement(String name, QName base) {
+ QName element = createQName(name, base);
Augmentations augs = new HTMLAugmentations();
super.endElement(element,augs);
}
@@ -99,8 +118,9 @@
public void startElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {
if(element.rawname.equalsIgnoreCase("table")){
_state = new TableHtmlCorrectionState(this);
+ } else {
+ depth++;
}
- depth++;
}
@@ -120,7 +140,7 @@
public void endElement(QName element, Augmentations augs) throws XNIException {
if (inTbody) {
- insertEndElement("tbody");
+ insertEndElement("tbody", element);
}
_state = previsiosState;
}
@@ -129,11 +149,11 @@
if(element.rawname.equalsIgnoreCase("tr")){
if(!inTbody){
inTbody = true;
- insertStartElement("tbody");
+ insertStartElement("tbody", element);
}
} else {
if (inTbody) {
- insertEndElement("tbody");
+ insertEndElement("tbody", element);
inTbody = false;
}
}
Modified:
branches/version_1_0_7/src/framework/java/org/ajax4jsf/framework/ajax/xmlfilter/nekko/HtmlCorrectionState.java
===================================================================
---
branches/version_1_0_7/src/framework/java/org/ajax4jsf/framework/ajax/xmlfilter/nekko/HtmlCorrectionState.java 2007-06-27
22:59:21 UTC (rev 287)
+++
branches/version_1_0_7/src/framework/java/org/ajax4jsf/framework/ajax/xmlfilter/nekko/HtmlCorrectionState.java 2007-06-27
23:12:00 UTC (rev 288)
@@ -1,7 +1,7 @@
/**
* License Agreement.
*
- * Ajax4jsf 1.0 - Natural Ajax for Java Server Faces (JSF)
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
*
* Copyright (C) 2007 Exadel, Inc.
*