[Yanel-commits] rev 23214 -
public/yanel/trunk/src/core/java/org/wyona/yanel/core/serialization
josias at wyona.com
josias at wyona.com
Fri Mar 9 17:48:48 CET 2007
Author: josias
Date: 2007-03-09 17:48:47 +0100 (Fri, 09 Mar 2007)
New Revision: 23214
Modified:
public/yanel/trunk/src/core/java/org/wyona/yanel/core/serialization/HTMLSerializer.java
Log:
fixed namespace handling by not copying namespace attributes: this transformer drops all namespace info and the output is always in the xhtml namespace, which is used without prefix.
Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/serialization/HTMLSerializer.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/serialization/HTMLSerializer.java 2007-03-09 15:12:57 UTC (rev 23213)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/serialization/HTMLSerializer.java 2007-03-09 16:48:47 UTC (rev 23214)
@@ -71,9 +71,14 @@
StringBuffer element = new StringBuffer();
element.append("<" + eName);
for(int i = 0; i < attrs.getLength(); i++) {
- String aName = attrs.getQName(i);
- String aValue = replaceEntities(attrs.getValue(i));
- element.append(" " + aName + "=\"" + aValue + "\"");
+ String aLocalName = attrs.getLocalName(i);
+ String aQName = attrs.getQName(i);
+ String aName = ("".equals(aLocalName)) ? aQName : aLocalName;
+ String aURI = attrs.getURI(i);
+ if (!aName.equals("xmlns") || !aURI.equals("http://www.w3.org/2000/xmlns/")) {
+ String aValue = replaceEntities(attrs.getValue(i));
+ element.append(" " + aName + "=\"" + aValue + "\"");
+ }
}
// NOTE: the element will not be closed yet because we don't know if the
// element has to be collapsed.
More information about the Yanel-commits
mailing list