abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r443009 - in /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax: FOMEntry.java FOMSource.java
Date Wed, 13 Sep 2006 16:08:29 GMT
Author: jmsnell
Date: Wed Sep 13 09:08:28 2006
New Revision: 443009

URL: http://svn.apache.org/viewvc?view=rev&rev=443009
Log:
When calling addCategory(Category), make sure that if the Category is from a Categories
element, we clone it before adding it to the entry or feed/source, otherwise Axiom will
remove the category element from the categories parent.

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

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java?view=diff&rev=443009&r1=443008&r2=443009
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
Wed Sep 13 09:08:28 2006
@@ -28,6 +28,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.abdera.model.AtomDate;
+import org.apache.abdera.model.Categories;
 import org.apache.abdera.model.Category;
 import org.apache.abdera.model.Content;
 import org.apache.abdera.model.Control;
@@ -138,6 +139,16 @@
   }
 
   public void addCategory(Category category) {
+    if (category.getParentElement() instanceof Categories) {
+      Categories cats = category.getParentElement();
+      category = (Category) category.clone();
+      try {
+        if (category.getScheme() == null && cats.getScheme() != null) 
+          category.setScheme(cats.getScheme().toString());
+      } catch (Exception e) {
+        // Do nothing, shouldn't happen
+      }
+    }
     addChild((OMElement)category);
   }
 

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java?view=diff&rev=443009&r1=443008&r2=443009
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java
Wed Sep 13 09:08:28 2006
@@ -26,6 +26,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.abdera.model.AtomDate;
+import org.apache.abdera.model.Categories;
 import org.apache.abdera.model.Category;
 import org.apache.abdera.model.DateTime;
 import org.apache.abdera.model.Div;
@@ -133,6 +134,16 @@
   }
   
   public void addCategory(Category category) {
+    if (category.getParentElement() instanceof Categories) {
+      Categories cats = category.getParentElement();
+      category = (Category) category.clone();
+      try {
+        if (category.getScheme() == null && cats.getScheme() != null) 
+          category.setScheme(cats.getScheme().toString());
+      } catch (Exception e) {
+        // Do nothing, shouldn't happen
+      }
+    }
     addChild((OMElement)category);
   }
 



Mime
View raw message