You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by jm...@apache.org on 2006/07/22 04:18:20 UTC

svn commit: r424509 - /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java

Author: jmsnell
Date: Fri Jul 21 19:18:20 2006
New Revision: 424509

URL: http://svn.apache.org/viewvc?rev=424509&view=rev
Log:
When calling entry.getContent() for the Atom tests at [1], the serialized XHTML content incorrectly 
omitted the xlink namespace declaration.  Now it works.  I'll be adding these tests into our test 
suite in the next day or so.

[1] http://feedparser.cvs.sourceforge.net/feedparser/feedparser/tests/wellformed/namespace/

Modified:
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java?rev=424509&r1=424508&r2=424509&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java Fri Jul 21 19:18:20 2006
@@ -30,6 +30,7 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Base;
@@ -287,7 +288,7 @@
       OMOutputFormat outputFormat = new OMOutputFormat();
       if (getDocument() != null && getDocument().getCharset() != null)
         outputFormat.setCharSetEncoding(getDocument().getCharset());
-      serializeAndConsume(writer, outputFormat);
+      serialize(writer, outputFormat);
     } catch (XMLStreamException e) {
       throw new FOMException(e);
     }
@@ -537,5 +538,20 @@
   
   public Factory getFactory() {
     return (Factory) this.factory;
+  }
+
+  @Override
+  protected void internalSerialize(
+    XMLStreamWriter writer, 
+    boolean bool) throws XMLStreamException {
+    if (this.getNamespace() != null)
+      this.declareNamespace(this.getNamespace());
+    Iterator i = this.getAllAttributes();
+    while (i.hasNext()) {
+      OMAttribute attr = (OMAttribute) i.next();
+      if (attr.getNamespace() != null)
+        this.declareNamespace(attr.getNamespace());
+    }
+    super.internalSerialize(writer, bool);
   }
 }