abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r584339 - in /incubator/abdera/java/trunk/parser/src: main/java/org/apache/abdera/parser/stax/ test/java/org/apache/abdera/test/parser/stax/
Date Fri, 12 Oct 2007 23:56:39 GMT
Author: jmsnell
Date: Fri Oct 12 16:56:33 2007
New Revision: 584339

URL: http://svn.apache.org/viewvc?rev=584339&view=rev
Log:
Automatically complete the parse for FOM objects when modifications are attempted.

Modified:
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategories.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMControl.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDateTime.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
    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/FOMExtensibleElement.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMProcessingInstruction.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java
    incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/EntryLinkTest.java

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategories.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategories.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategories.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategories.java
Fri Oct 12 16:56:33 2007
@@ -22,10 +22,10 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Categories;
 import org.apache.abdera.model.Category;
 import org.apache.abdera.parser.stax.util.FOMHelper;
-import org.apache.abdera.i18n.iri.IRI;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
@@ -91,10 +91,12 @@
   }
   
   public void addCategory(Category category) {
+    complete();
     addChild((OMElement)category);
   }
 
   public Category addCategory(String term) {
+    complete();
     FOMFactory factory = (FOMFactory) this.factory;
     Category category = factory.newCategory(this);
     category.setTerm(term);
@@ -105,6 +107,7 @@
     String scheme, 
     String term, 
     String label) {
+    complete();
     FOMFactory factory = (FOMFactory) this.factory;
     Category category = factory.newCategory(this);
     category.setTerm(term);
@@ -154,6 +157,7 @@
   }
 
   public void setFixed(boolean fixed) {
+    complete();
     if (fixed && !isFixed())
       setAttributeValue(FIXED, YES);
     else if (!fixed && isFixed())
@@ -161,6 +165,7 @@
   }
 
   public void setScheme(String scheme) {
+    complete();
     if (scheme != null)
       setAttributeValue(SCHEME, new IRI(scheme).toString());
     else 
@@ -176,6 +181,7 @@
   }
   
   public void setHref(String href) {
+    complete();
     if (href != null)
       setAttributeValue(HREF, (new IRI(href)).toString());
     else 

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java
Fri Oct 12 16:56:33 2007
@@ -19,9 +19,9 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Category;
 import org.apache.abdera.util.Constants;
-import org.apache.abdera.i18n.iri.IRI;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
@@ -96,6 +96,7 @@
   }
 
   public void setTerm(String term) {
+    complete();
     if (term != null)
       setAttributeValue(TERM, term);
     else
@@ -108,6 +109,7 @@
   }
 
   public void setScheme(String scheme) {
+    complete();
     if (scheme != null)
       setAttributeValue(SCHEME, new IRI(scheme).toString());
     else 
@@ -119,6 +121,7 @@
   }
 
   public void setLabel(String label) {
+    complete();
     if (label != null)
       setAttributeValue(LABEL, label);
     else
@@ -130,6 +133,7 @@
   }
 
   public void setValue(String value) {
+    complete();
     if (value != null)
       setText(value);
     else

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
Fri Oct 12 16:56:33 2007
@@ -24,6 +24,7 @@
 import javax.activation.MimeType;
 import javax.xml.namespace.QName;
 
+import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Categories;
 import org.apache.abdera.model.Category;
 import org.apache.abdera.model.Collection;
@@ -31,7 +32,6 @@
 import org.apache.abdera.model.Text;
 import org.apache.abdera.util.Constants;
 import org.apache.abdera.util.MimeTypeHelper;
-import org.apache.abdera.i18n.iri.IRI;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
@@ -105,6 +105,7 @@
   }
 
   private Text setTitle(String title, Text.Type type) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) factory;
     Text text = fomfactory.newText(PREFIXED_TITLE,type);
     text.setValue(title);
@@ -137,6 +138,7 @@
   }
   
   public void setHref(String href) {
+    complete();
     if (href != null)
       setAttributeValue(HREF, (new IRI(href).toString()));
     else 
@@ -167,6 +169,7 @@
   }
   
   public void setAccept(String... mediaRanges) {
+    complete();
     if (mediaRanges != null && mediaRanges.length > 0) {
       _removeChildren(ACCEPT, true);
       _removeChildren(PRE_RFC_ACCEPT, true);
@@ -197,6 +200,7 @@
   }
   
   public void addAccepts(String... mediaRanges) {
+    complete();
     if (mediaRanges != null) {
       for (String type : mediaRanges) {
         if (!accepts(type)) {
@@ -242,15 +246,18 @@
   }
 
   public Categories addCategories() {
+    complete();
     return ((FOMFactory)factory).newCategories(this);
   }
   
   public void addCategories(Categories categories) {
+    complete();
     addChild((OMElement)categories);
   }
 
   public Categories addCategories(
     String href) {
+    complete();
     Categories cats = ((FOMFactory)factory).newCategories();
     cats.setHref(href);
     addCategories(cats);
@@ -261,6 +268,7 @@
     List<Category> categories, 
     boolean fixed, 
     String scheme) {
+      complete();
       Categories cats = ((FOMFactory)factory).newCategories();
       cats.setFixed(fixed);
       if (scheme != null) cats.setScheme(scheme);

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
Fri Oct 12 16:56:33 2007
@@ -22,13 +22,13 @@
 import javax.activation.URLDataSource;
 import javax.xml.namespace.QName;
 
+import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Content;
 import org.apache.abdera.model.Div;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.ElementWrapper;
 import org.apache.abdera.util.Constants;
 import org.apache.abdera.util.Messages;
-import org.apache.abdera.i18n.iri.IRI;
 import org.apache.axiom.attachments.utils.DataHandlerUtils;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
@@ -118,6 +118,7 @@
   }
 
   public void setContentType(Type type) {
+    complete();
     init(type);
   }
   
@@ -127,6 +128,7 @@
   }
 
   public <T extends Element> void setValueElement(T value) {
+    complete();
     if (value != null) {
       if (this.getFirstElement() != null)
         this.getFirstElement().discard();
@@ -166,6 +168,7 @@
   }
   
   public void setMimeType(String type) {
+    complete();
     try {
       if (type != null)
         setAttributeValue(TYPE, (new MimeType(type)).toString());
@@ -185,6 +188,7 @@
   }
   
   public void setSrc(String src) {
+    complete();
     if (src != null)
       setAttributeValue(SRC, (new IRI(src)).toString());
     else 
@@ -212,6 +216,7 @@
   }
   
   public void setDataHandler(DataHandler dataHandler) {
+    complete();
     if (!Type.MEDIA.equals(type)) throw new IllegalArgumentException();
     if (dataHandler.getContentType() != null) {
       try {
@@ -241,11 +246,13 @@
   }
 
   public void setText(String value) {
+    complete();
     init(Content.Type.TEXT);
     super.setText(value);
   }
   
   public void setValue(String value) {
+    complete();
     if (value != null) removeAttribute(SRC);
     if (value != null) {
       if (Type.TEXT.equals(type)) {
@@ -299,6 +306,7 @@
   }
 
   public void setWrappedValue(String wrappedValue) {
+    complete();
     if (Type.XHTML.equals(type)) {
       IRI baseUri = null;
       Element element = null;

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMControl.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMControl.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMControl.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMControl.java
Fri Oct 12 16:56:33 2007
@@ -22,7 +22,6 @@
 import org.apache.abdera.model.Control;
 import org.apache.abdera.util.Constants;
 import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
@@ -84,11 +83,13 @@
   }
 
   public void setDraft(boolean draft) {
+    complete();
     _removeChildren(PRE_RFC_DRAFT, true);
     _setElementValue(DRAFT, (draft) ? YES:NO);
   }
   
   public void unsetDraft() {
+    complete();
     _removeChildren(PRE_RFC_DRAFT, true);
     _removeChildren(DRAFT, true);
   }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDateTime.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDateTime.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDateTime.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDateTime.java
Fri Oct 12 16:56:33 2007
@@ -103,6 +103,7 @@
   }
 
   public void setValue(AtomDate dateTime) {
+    complete();
     value = null;
     if (dateTime != null)
       setText(dateTime.getValue());
@@ -111,6 +112,7 @@
   }
 
   public void setDate(Date date) {
+    complete();
     value = null;
     if (date != null)
       setText(AtomDate.valueOf(date).getValue());
@@ -119,6 +121,7 @@
   }
 
   public void setCalendar(Calendar date) {
+    complete();
     value = null;
     if (date != null)
       setText(AtomDate.valueOf(date).getValue());
@@ -127,11 +130,13 @@
   }
 
   public void setTime(long date) {
+    complete();
     value = null;
     setText(AtomDate.valueOf(date).getValue());
   }
 
   public void setString(String date) {
+    complete();
     value = null;
     if (date != null)
       setText(AtomDate.valueOf(date).getValue());

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
Fri Oct 12 16:56:33 2007
@@ -24,9 +24,9 @@
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Div;
 import org.apache.abdera.util.Constants;
-import org.apache.abdera.i18n.iri.IRI;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
@@ -89,6 +89,7 @@
   }
 
   public void setId(String id) {
+    complete();
     if (id != null)
       setAttributeValue(AID, id);
     else 
@@ -96,6 +97,7 @@
   }
   
   public void setTitle(String title) {
+    complete();
     if (title != null)
       setAttributeValue(ATITLE, title);
     else 
@@ -103,6 +105,7 @@
   }
   
   public void setXhtmlClass(String[] classes) {
+    complete();
     if (classes != null) {
       StringBuffer val = new StringBuffer();
       for (String s : classes) {
@@ -119,6 +122,7 @@
   }
 
   public void setValue(String value) {
+    complete();
     _removeAllChildren();
     if (value != null) {
       IRI baseUri = null;

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=584339&r1=584338&r2=584339&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 Oct 12 16:56:33 2007
@@ -262,6 +262,7 @@
   }
   
   public void setBaseUri(IRI base) {
+    complete();
     setAttributeValue(BASE,_getStringValue(base));
   }
   
@@ -424,6 +425,7 @@
   }
   
   protected void _setElementValue(QName qname, String value) {
+    complete();
     OMElement element = this.getFirstChildWithName(qname);
     if (element != null && value != null) {
       element.setText(value);
@@ -453,6 +455,7 @@
   }
 
   protected <T extends Text>void setTextElement(QName qname, T text, boolean many)
{
+    complete();
     if (text != null) {
       _setChild(qname, (OMElement)text);
     } else _removeChildren(qname, false);
@@ -509,6 +512,14 @@
     return text;
   }
   
+  public void setText(String text) {
+    complete();
+    if (text != null)
+      super.setText(text);
+    else 
+      _removeAllChildren();
+  }
+
   public String getText() {
     StringBuffer buf = new StringBuffer();
     Iterator i = getChildren();
@@ -577,6 +588,7 @@
   }
   
   protected void _removeChildren(QName qname, boolean many) {
+    complete();
     if (many) {
       for (Iterator i = getChildrenWithName(qname); i.hasNext();) {
         OMElement element = (OMElement) i.next();
@@ -589,6 +601,7 @@
   }
   
   protected void _removeAllChildren() {
+    complete();
     for (Iterator i = getChildren(); i.hasNext();) {
       OMNode node = (OMNode) i.next();
       node.discard();
@@ -810,6 +823,6 @@
    * that particular element has been completely parsed.
    */
   public void complete() {
-    super.build();
+    if (!isComplete() && builder != null) super.build();
   }
 }

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?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- 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
Fri Oct 12 16:56:33 2007
@@ -113,10 +113,12 @@
   }
 
   public void addAuthor(Person person) {
+    complete();
     addChild((OMElement)person);
   }
   
   public Person addAuthor(String name) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) this.factory;
     Person person = fomfactory.newAuthor(this);
     person.setName(name);
@@ -124,6 +126,7 @@
   }
 
   public Person addAuthor(String name, String email, String uri) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) this.factory;
     Person person = fomfactory.newAuthor(this);
     person.setName(name);
@@ -141,6 +144,7 @@
   }
 
   public void addCategory(Category category) {
+    complete();
     Element el = category.getParentElement();
     if (el != null && el instanceof Categories) {
       Categories cats = category.getParentElement();
@@ -156,6 +160,7 @@
   }
 
   public Category addCategory(String term) {
+    complete();
     FOMFactory factory = (FOMFactory) this.factory;
     Category category = factory.newCategory(this);
     category.setTerm(term);
@@ -163,6 +168,7 @@
   }
 
   public Category addCategory(String scheme, String term, String label) {
+    complete();
     FOMFactory factory = (FOMFactory) this.factory;
     Category category = factory.newCategory(this);
     category.setTerm(term);
@@ -176,6 +182,7 @@
   }
 
   public void setContentElement(Content content) {
+    complete();
     if (content != null) {
       _setChild(CONTENT, (OMElement)content);
     } else {
@@ -187,6 +194,7 @@
    * Sets the content for this entry as @type="text"
    */
   public Content setContent(String value) {
+    complete();
     FOMFactory factory = (FOMFactory) this.factory;
     Content content = factory.newContent();
     content.setValue(value);
@@ -319,10 +327,12 @@
   }
 
   public void addContributor(Person person) {
+    complete();
     addChild((OMElement)person);
   }
 
   public Person addContributor(String name) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) this.factory;
     Person person = fomfactory.newContributor(this);
     person.setName(name);
@@ -332,8 +342,8 @@
   public Person addContributor(
     String name, 
     String email, 
-    String uri) 
-      {
+    String uri) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) this.factory;
     Person person = fomfactory.newContributor(this);
     person.setName(name);
@@ -347,6 +357,7 @@
   }
 
   public void setIdElement(IRIElement id) {
+    complete();
     if (id != null)
       _setChild(ID, (OMElement)id);
     else
@@ -367,6 +378,7 @@
   }
   
   public IRIElement setId(String value, boolean normalize) {
+    complete();
     if (value == null) {
       _removeChildren(ID, false);
       return null;
@@ -397,14 +409,17 @@
   }
 
   public void addLink(Link link) {
+    complete();
     addChild((OMElement)link);
   }
 
   public Link addLink(String href) {
+    complete();
     return addLink(href, null);
   }
   
   public Link addLink(String href, String rel) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) factory;
     Link link = fomfactory.newLink(this);
     link.setHref(href);
@@ -418,8 +433,8 @@
     String type, 
     String title, 
     String hreflang, 
-    long length) 
-     {
+    long length) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) factory;
     Link link = fomfactory.newLink(this);
     link.setHref(href);
@@ -436,6 +451,7 @@
   }
 
   public void setPublishedElement(DateTime dateTime) {
+    complete();
     if (dateTime != null)
       _setChild(PUBLISHED, (OMElement)dateTime);
     else
@@ -448,6 +464,7 @@
   }
   
   private DateTime setPublished(AtomDate value) {
+    complete();
     if (value == null) {
       _removeChildren(PUBLISHED, false);
       return null;
@@ -477,10 +494,12 @@
   }
 
   public void setRightsElement(Text text) {
+    complete();
     setTextElement(RIGHTS, text, false);
   }
   
   public Text setRights(String value) {
+    complete();
     FOMFactory factory = (FOMFactory)this.factory;
     Text text = factory.newRights();
     text.setValue(value);
@@ -520,6 +539,7 @@
   }
 
   public void setSource(Source source) {
+    complete();
     if (source != null) {
       if (source instanceof Feed)
         source = ((Feed)source).getAsSource();
@@ -534,10 +554,12 @@
   }
 
   public void setSummaryElement(Text text) {
+    complete();
     setTextElement(SUMMARY, text, false);
   }
   
   public Text setSummary(String value) {
+    complete();
     FOMFactory factory = (FOMFactory)this.factory;
     Text text = factory.newSummary();
     text.setValue(value);
@@ -577,10 +599,12 @@
   }
 
   public void setTitleElement(Text title) {
+    complete();
     setTextElement(TITLE, title, false);
   }
 
   public Text setTitle(String value) {
+    complete();
     FOMFactory factory = (FOMFactory)this.factory;
     Text text = factory.newTitle();
     text.setValue(value);
@@ -620,6 +644,7 @@
   }
 
   public void setUpdatedElement(DateTime updated) {
+    complete();
     if (updated != null)
       _setChild(UPDATED, (OMElement)updated);
     else 
@@ -632,6 +657,7 @@
   }
   
   private DateTime setUpdated(AtomDate value) {
+    complete();
     if (value == null) {
       _removeChildren(UPDATED, false);
       return null;
@@ -663,6 +689,7 @@
   }
 
   public void setEditedElement(DateTime updated) {
+    complete();
     declareNamespace(APP_NS, "app");
     _removeChildren(PRE_RFC_EDITED,false);
     if (updated != null)
@@ -677,6 +704,7 @@
   }
   
   private DateTime setEdited(AtomDate value) {
+    complete();
     declareNamespace(APP_NS, "app");
     if (value == null) {
       _removeChildren(PRE_RFC_EDITED, false);
@@ -719,6 +747,7 @@
   }
 
   public void setControl(Control control) {
+    complete();
     _removeChildren(PRE_RFC_CONTROL,true);
     if (control != null) 
       _setChild(CONTROL, (OMElement)control);
@@ -850,6 +879,7 @@
   }
   
   public void setDraft(boolean draft) {
+    complete();
     Control control = getControl();
     if (control == null && draft) {
       control = ((FOMFactory)factory).newControl(this);

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java
Fri Oct 12 16:56:33 2007
@@ -93,6 +93,7 @@
   }
   
   public void addExtension(Element extension) {
+    complete();
     if (extension instanceof ElementWrapper) {
       ElementWrapper wrapper = (ElementWrapper) extension;
       extension = wrapper.getInternal();
@@ -104,6 +105,7 @@
   }
   
   public <T extends Element>T addExtension(QName qname) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) factory;
     String prefix = qname.getPrefix();
     declareIfNecessary(qname.getNamespaceURI(), prefix);
@@ -111,6 +113,7 @@
   }
   
   public <T extends Element>T addExtension(String namespace, String localpart, String
prefix) {
+    complete();
     declareIfNecessary(namespace, prefix);
     return (prefix != null) ? 
       (T)addExtension(new QName(namespace, localpart, prefix)) :
@@ -118,6 +121,7 @@
   }
   
   public Element addSimpleExtension(QName qname, String value) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) factory;
     Element el = fomfactory.newElement(qname, this);
     el.setText(value);
@@ -131,6 +135,7 @@
     String localPart, 
     String prefix, 
     String value) {
+      complete();
       declareIfNecessary(namespace,prefix);
       return addSimpleExtension(
         (prefix != null) ?
@@ -191,6 +196,7 @@
   }
   
   public void addExtension(Element extension, Element before) {
+    complete();
     extension = getInternal(extension);
     before = getInternal(before);
     if (before instanceof ElementWrapper) {
@@ -206,6 +212,7 @@
   }
 
   public <T extends Element> T addExtension(QName qname, QName before) {
+    complete();
     OMElement el = getFirstChildWithName(before);
     T element = (T)getFactory().newElement(qname);
     if (el == null) {

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=584339&r1=584338&r2=584339&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 Oct 12 16:56:33 2007
@@ -25,11 +25,11 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.Feed;
 import org.apache.abdera.model.Source;
 import org.apache.abdera.util.Constants;
-import org.apache.abdera.i18n.iri.IRI;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
@@ -93,15 +93,18 @@
   }
 
   public void addEntry(Entry entry) {
+    complete();
     addChild((OMElement)entry);
   }
 
   public Entry addEntry() {
+    complete();
     FOMFactory fomfactory = (FOMFactory) factory;
     return fomfactory.newEntry(this);
   }
   
   public void insertEntry(Entry entry) {
+    complete();
     OMElement el = getFirstChildWithName(ENTRY);
     if (el == null) {
       addEntry(entry);
@@ -112,6 +115,7 @@
   }
   
   public Entry insertEntry() {
+    complete();
     FOMFactory fomfactory = (FOMFactory) factory;
     Entry entry = fomfactory.newEntry((Feed)null);
     insertEntry(entry);
@@ -147,14 +151,17 @@
   }
  
   public void sortEntriesByUpdated(boolean new_first) {
+    complete();
     sortEntries(new UpdatedComparator(new_first));
   }
   
   public void sortEntriesByEdited(boolean new_first) {
+    complete();
     sortEntries(new EditedComparator(new_first));
   }
   
   public void sortEntries(Comparator<Entry> comparator) {
+    complete();
     if (comparator == null) return;
     List<Entry> entries = this.getEntries();
     Entry[] a = entries.toArray(new Entry[entries.size()]);

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java
Fri Oct 12 16:56:33 2007
@@ -19,9 +19,9 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Generator;
 import org.apache.abdera.util.Constants;
-import org.apache.abdera.i18n.iri.IRI;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
@@ -98,6 +98,7 @@
   }
 
   public void setUri(String uri) {
+    complete();
     if (uri != null)
       setAttributeValue(AURI, (new IRI(uri)).toString());
     else 
@@ -109,6 +110,7 @@
   }
 
   public void setVersion(String version) {
+    complete();
     if (version != null)
       setAttributeValue(VERSION, version);
     else

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java
Fri Oct 12 16:56:33 2007
@@ -19,9 +19,9 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.IRIElement;
 import org.apache.abdera.util.URIHelper;
-import org.apache.abdera.i18n.iri.IRI;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
@@ -74,6 +74,7 @@
   }
 
   public void setValue(String iri) {
+    complete();
     if (iri != null)
       setText((new IRI(iri)).toString());
     else

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java
Fri Oct 12 16:56:33 2007
@@ -23,10 +23,10 @@
 import javax.activation.MimeType;
 import javax.xml.namespace.QName;
 
+import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Link;
 import org.apache.abdera.util.Constants;
 import org.apache.abdera.util.URIHelper;
-import org.apache.abdera.i18n.iri.IRI;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
@@ -109,6 +109,7 @@
   }
   
   public void setHref(String href) {
+    complete();
     if (href != null)
       setAttributeValue(HREF, (new IRI(href)).toString());
     else 
@@ -120,6 +121,7 @@
   }
 
   public void setRel(String rel) {
+    complete();
     setAttributeValue(REL, rel);
   }
 
@@ -133,10 +135,12 @@
   }
   
   public void setMimeType(MimeType type) {
+    complete();
     setAttributeValue(TYPE, (type != null) ? type.toString() : null);
   }
 
   public void setMimeType(String type) {
+    complete();
     try {
       if (type != null) 
         setAttributeValue(TYPE, (new MimeType(type)).toString());
@@ -152,6 +156,7 @@
   }
 
   public void setHrefLang(String lang) {
+    complete();
     if (lang != null)
       setAttributeValue(HREFLANG, lang);
     else 
@@ -163,6 +168,7 @@
   }
 
   public void setTitle(String title) {
+    complete();
     if (title != null)
       setAttributeValue(ATITLE, title);
     else 
@@ -175,6 +181,7 @@
   }
 
   public void setLength(long length) {
+    complete();
     if (length > -1)
       setAttributeValue(LENGTH, (length >= 0) ? String.valueOf(length) : "0");
     else
@@ -213,6 +220,7 @@
   }
 
   public void setValue(String value) {
+    complete();
     if (value != null)
       setText(value);
     else

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java
Fri Oct 12 16:56:33 2007
@@ -19,10 +19,10 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.IRIElement;
 import org.apache.abdera.model.Person;
-import org.apache.abdera.i18n.iri.IRI;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
@@ -91,6 +91,7 @@
   }
 
   public void setNameElement(Element element) {
+    complete();
     if (element != null)
       _setChild(NAME, (OMElement)element);
     else 
@@ -98,6 +99,7 @@
   }
 
   public Element setName(String name) {
+    complete();
     if (name != null) {
       FOMFactory fomfactory = (FOMFactory) factory;
       Element el = fomfactory.newName(null);
@@ -120,6 +122,7 @@
   }
 
   public void setEmailElement(Element element) {
+    complete();
     if (element != null)
       _setChild(EMAIL, (OMElement)element);
     else 
@@ -127,6 +130,7 @@
   }
 
   public Element setEmail(String email) {
+    complete();
     if (email != null) {
       FOMFactory fomfactory = (FOMFactory) factory;
       Element el = fomfactory.newEmail(null);
@@ -149,6 +153,7 @@
   }
 
   public void setUriElement(IRIElement uri) {
+    complete();
     if (uri != null) 
       _setChild(URI, (OMElement)uri);
     else 
@@ -156,6 +161,7 @@
   }
 
   public IRIElement setUri(String uri) {
+    complete();
     if (uri != null) {
       FOMFactory fomfactory = (FOMFactory) factory;
       IRIElement el = fomfactory.newUri(null);

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMProcessingInstruction.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMProcessingInstruction.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMProcessingInstruction.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMProcessingInstruction.java
Fri Oct 12 16:56:33 2007
@@ -59,6 +59,7 @@
   }
 
   public void setText(String text) {
+    if (!isComplete() && builder != null) build();
     setValue(text);
   }
 

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java
Fri Oct 12 16:56:33 2007
@@ -113,10 +113,12 @@
   }
 
   public void addWorkspace(Workspace workspace) {
+    complete();
     addChild((OMElement) workspace);
   }
   
   public Workspace addWorkspace(String title) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) factory;
     Workspace workspace = fomfactory.newWorkspace(this);
     workspace.setTitle(title);

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?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- 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
Fri Oct 12 16:56:33 2007
@@ -23,6 +23,7 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.AtomDate;
 import org.apache.abdera.model.Categories;
 import org.apache.abdera.model.Category;
@@ -40,7 +41,6 @@
 import org.apache.abdera.parser.stax.util.FOMHelper;
 import org.apache.abdera.util.Constants;
 import org.apache.abdera.util.URIHelper;
-import org.apache.abdera.i18n.iri.IRI;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
@@ -110,10 +110,12 @@
   }
 
   public void addAuthor(Person person) {
+    complete();
     addChild((OMElement)person);
   }
   
   public Person addAuthor(String name) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) this.factory;
     Person person = fomfactory.newAuthor(this);
     person.setName(name);
@@ -121,6 +123,7 @@
   }
 
   public Person addAuthor(String name, String email, String uri) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) this.factory;
     Person person = fomfactory.newAuthor(this);
     person.setName(name);
@@ -138,6 +141,7 @@
   }
   
   public void addCategory(Category category) {
+    complete();
     Element el = category.getParentElement();
     if (el != null && el instanceof Categories) {
       Categories cats = category.getParentElement();
@@ -153,6 +157,7 @@
   }
 
   public Category addCategory(String term) {
+    complete();
     FOMFactory factory = (FOMFactory) this.factory;
     Category category = factory.newCategory(this);
     category.setTerm(term);
@@ -160,6 +165,7 @@
   }
 
   public Category addCategory(String scheme, String term, String label) {
+    complete();
     FOMFactory factory = (FOMFactory) this.factory;
     Category category = factory.newCategory(this);
     category.setTerm(term);
@@ -173,10 +179,12 @@
   }
 
   public void addContributor(Person person) {
+    complete();
     addChild((OMElement)person);
   }
 
   public Person addContributor(String name) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) this.factory;
     Person person = fomfactory.newContributor(this);
     person.setName(name);
@@ -184,6 +192,7 @@
   }
 
   public Person addContributor(String name, String email, String uri) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) this.factory;
     Person person = fomfactory.newContributor(this);
     person.setName(name);
@@ -197,6 +206,7 @@
   }
 
   public void setIdElement(IRIElement id) {
+    complete();
     if (id != null)
       _setChild(ID, (OMElement)id);
     else 
@@ -209,6 +219,7 @@
   }
   
   public IRIElement setId(String value) {
+    complete();
     return setId(value, false);
   }
   
@@ -217,6 +228,7 @@
   }
     
   public IRIElement setId(String value, boolean normalize) {
+    complete();
     if (value == null) {
       _removeChildren(ID, false);
       return null;
@@ -247,6 +259,7 @@
   }
 
   public void addLink(Link link) {
+    complete();
     addChild((OMElement)link);
   }
 
@@ -255,6 +268,7 @@
   }
   
   public Link addLink(String href, String rel) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) factory;
     Link link = fomfactory.newLink(this);
     link.setHref(href);
@@ -263,6 +277,7 @@
   }
   
   public Link addLink(String href, String rel, String type, String title, String hreflang,
long length) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) factory;
     Link link = fomfactory.newLink(this);
     link.setHref(href);
@@ -279,10 +294,12 @@
   }
 
   public void setRightsElement(Text text) {
+    complete();
     setTextElement(RIGHTS, text, false);
   }
 
   public Text setRights(String value) {
+    complete();
     FOMFactory factory = (FOMFactory)this.factory;
     Text text = factory.newRights();
     text.setValue(value);
@@ -322,10 +339,12 @@
   }
 
   public void setSubtitleElement(Text text) {
+    complete();
     setTextElement(SUBTITLE, text, false);
   }
 
   public Text setSubtitle(String value) {
+    complete();
     FOMFactory factory = (FOMFactory)this.factory;
     Text text = factory.newSubtitle();
     text.setValue(value);
@@ -365,10 +384,12 @@
   }
 
   public void setTitleElement(Text text) {
+    complete();
     setTextElement(TITLE, text, false);
   }
 
   public Text setTitle(String value) {
+    complete();
     FOMFactory factory = (FOMFactory)this.factory;
     Text text = factory.newTitle();
     text.setValue(value);
@@ -408,6 +429,7 @@
   }
 
   public void setUpdatedElement(DateTime updated) {
+    complete();
     if (updated != null)
       _setChild(UPDATED, (OMElement)updated);
     else 
@@ -425,6 +447,7 @@
   }
   
   private DateTime setUpdated(AtomDate value) {
+    complete();
     if (value == null) {
       _removeChildren(UPDATED, false);
       return null;
@@ -454,6 +477,7 @@
   }
 
   public void setGenerator(Generator generator) {
+    complete();
     if (generator != null)
       _setChild(GENERATOR, (OMElement) generator);
     else 
@@ -463,8 +487,8 @@
   public Generator setGenerator(
     String uri, 
     String version, 
-    String value) 
-      {
+    String value) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) factory;
     Generator generator = fomfactory.newGenerator(this);
     if (uri != null) generator.setUri(uri);
@@ -478,6 +502,7 @@
   }
 
   public void setIconElement(IRIElement iri) {
+    complete();
     if (iri != null)
       _setChild(ICON, (OMElement) iri);
     else 
@@ -485,6 +510,7 @@
   }
 
   public IRIElement setIcon(String value) {
+    complete();
     if (value == null) {
       _removeChildren(ICON, false);
       return null;
@@ -507,6 +533,7 @@
   }
 
   public void setLogoElement(IRIElement iri) {
+    complete();
     if (iri != null)
       _setChild(LOGO, (OMElement)iri);
     else 
@@ -514,6 +541,7 @@
   }
 
   public IRIElement setLogo(String value) {
+    complete();
     if (value == null) {
       _removeChildren(LOGO, false);
       return null;
@@ -581,6 +609,7 @@
   }
   
   public void setCollection(Collection collection) {
+    complete();
     if (collection != null) {
       _removeChildren(PRE_RFC_COLLECTION, true);
       _setChild(COLLECTION, (OMElement)collection);

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java
Fri Oct 12 16:56:33 2007
@@ -19,11 +19,11 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Div;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.Text;
 import org.apache.abdera.util.Constants;
-import org.apache.abdera.i18n.iri.IRI;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
@@ -92,6 +92,7 @@
   }
 
   public void setTextType(Type type) {
+    complete();
     init(type);
   }
   
@@ -99,7 +100,8 @@
     return (Div)this.getFirstChildWithName(Constants.DIV);
   }
 
-  public void setValueElement(Div value) {    
+  public void setValueElement(Div value) {
+    complete();
     if (value != null) {
       if (this.getFirstChildWithName(Constants.DIV) != null)
         this.getFirstChildWithName(Constants.DIV).discard();
@@ -123,11 +125,13 @@
   }
 
   public void setText(String value) {
+    complete();
     init(Text.Type.TEXT);
     super.setText(value);
   }
   
   public void setValue(String value) {
+    complete();
     if (value != null) {
       if (Type.TEXT.equals(type)) {
         super.setText(value);
@@ -157,6 +161,7 @@
   }
 
   public void setWrappedValue(String wrappedValue) {
+    complete();
     if (Type.XHTML.equals(type)) {
       IRI baseUri = null;
       Element element = null;

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java
Fri Oct 12 16:56:33 2007
@@ -96,6 +96,7 @@
   }
 
   private Text setTitle(String title, Text.Type type) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) factory;
     Text text = fomfactory.newText(PREFIXED_TITLE,type);
     text.setValue(title);
@@ -138,10 +139,12 @@
   }
 
   public void addCollection(Collection collection) {
+    complete();
     addChild((OMElement)collection);
   }
 
   public Collection addCollection(String title, String href) {
+    complete();
     FOMFactory fomfactory = (FOMFactory) factory;
     Collection collection = fomfactory.newCollection(this);
     collection.setTitle(title);

Modified: incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/EntryLinkTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/EntryLinkTest.java?rev=584339&r1=584338&r2=584339&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/EntryLinkTest.java
(original)
+++ incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/EntryLinkTest.java
Fri Oct 12 16:56:33 2007
@@ -35,6 +35,9 @@
      * Link in entry disappears after adding entry to a feed.
      * 
      * @see https://issues.apache.org/jira/browse/ABDERA-70
+     * 
+     * FOM Objects should automatically complete the parse 
+     * when modifications are made
      */
     public void testEntryLinkInFeed() throws Exception {
         Abdera abdera = new Abdera();
@@ -45,12 +48,6 @@
         Parser parser = abdera.getParser();
         Document<Entry> doc = parser.parse(this.getClass().getResourceAsStream("/entry.xml"));
         Entry entry = doc.getRoot();
-        
-        // Workaround for ABDERA-70 suggested by James Snell.
-        //entry = (Entry) entry.clone();
-        // End workaround
-        // first step to a better solution that does not require cloning
-        entry.complete();
         
         Link link = factory.newLink();
         link.setHref(entry.getId().toString());



Mime
View raw message