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/14 17:55:06 UTC

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

Author: jmsnell
Date: Fri Jul 14 08:55:05 2006
New Revision: 421928

URL: http://svn.apache.org/viewvc?rev=421928&view=rev
Log:
RFC4287 states that all of the metadata elements in atom:feed should come before the list of atom:entry elements.  
Before this change, if I did feed.addEntry(); feed.addCategory("foo");, it would produce invalid atom.  Now it checks
to make sure that the category is being inserted before the list of entries.

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

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java?rev=421928&r1=421927&r2=421928&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java Fri Jul 14 08:55:05 2006
@@ -32,6 +32,7 @@
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
 
@@ -123,6 +124,18 @@
       }
     }
     return source;
+  }
+
+  @Override
+  public void addChild(OMNode node) {
+    if (isComplete() && node instanceof OMElement && !(node instanceof Entry)) {
+      OMElement el = this.getFirstChildWithName(ENTRY);
+      if (el != null) {
+        el.insertSiblingBefore(node);
+        return;
+      }
+    }
+    super.addChild(node);
   }
  
 }



Re: svn commit: r421928 - /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 7/14/06, James M Snell <ja...@gmail.com> wrote:
> Other case?

Never mind, I misread the diff.

-garrett

Re: svn commit: r421928 - /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java

Posted by James M Snell <ja...@gmail.com>.
Other case?

Garrett Rooney wrote:
> On 7/14/06, jmsnell@apache.org <jm...@apache.org> wrote:
>> Author: jmsnell
>> Date: Fri Jul 14 08:55:05 2006
>> New Revision: 421928
>>
>> URL: http://svn.apache.org/viewvc?rev=421928&view=rev
>> Log:
>> RFC4287 states that all of the metadata elements in atom:feed should
>> come before the list of atom:entry elements.
>> Before this change, if I did feed.addEntry();
>> feed.addCategory("foo");, it would produce invalid atom.  Now it checks
>> to make sure that the category is being inserted before the list of
>> entries.
> 
> What does it do in the other case?  It looks to me like it just
> silently does nothing, which doesn't seem right...
> 
> -garrett
> 

Re: svn commit: r421928 - /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 7/14/06, jmsnell@apache.org <jm...@apache.org> wrote:
> Author: jmsnell
> Date: Fri Jul 14 08:55:05 2006
> New Revision: 421928
>
> URL: http://svn.apache.org/viewvc?rev=421928&view=rev
> Log:
> RFC4287 states that all of the metadata elements in atom:feed should come before the list of atom:entry elements.
> Before this change, if I did feed.addEntry(); feed.addCategory("foo");, it would produce invalid atom.  Now it checks
> to make sure that the category is being inserted before the list of entries.

What does it do in the other case?  It looks to me like it just
silently does nothing, which doesn't seem right...

-garrett

Re: svn commit: r421928 - /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 7/14/06, jmsnell@apache.org <jm...@apache.org> wrote:
> Author: jmsnell
> Date: Fri Jul 14 08:55:05 2006
> New Revision: 421928
>
> URL: http://svn.apache.org/viewvc?rev=421928&view=rev
> Log:
> RFC4287 states that all of the metadata elements in atom:feed should come before the list of atom:entry elements.
> Before this change, if I did feed.addEntry(); feed.addCategory("foo");, it would produce invalid atom.  Now it checks
> to make sure that the category is being inserted before the list of entries.

What does it do in the other case?  It looks to me like it just
silently does nothing, which doesn't seem right...

-garrett