abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r414893 [7/11] - in /incubator/abdera/java/trunk: ./ build/ core/ core/src/ core/src/main/ core/src/main/java/ core/src/main/java/org/ core/src/main/java/org/apache/ core/src/main/java/org/apache/abdera/ core/src/main/java/org/apache/abdera...
Date Fri, 16 Jun 2006 20:10:56 GMT
Added: 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=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,1119 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.parser.stax;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import javax.activation.DataHandler;
+import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.model.Category;
+import org.apache.abdera.model.Content;
+import org.apache.abdera.model.Control;
+import org.apache.abdera.model.DateTime;
+import org.apache.abdera.model.Div;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.ExtensionElement;
+import org.apache.abdera.model.IRI;
+import org.apache.abdera.model.InReplyTo;
+import org.apache.abdera.model.Link;
+import org.apache.abdera.model.Person;
+import org.apache.abdera.model.Source;
+import org.apache.abdera.model.Text;
+import org.apache.abdera.model.Content.Type;
+import org.apache.abdera.util.URIHelper;
+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;
+import org.apache.axiom.om.OMXMLParserWrapper;
+
+
+public class FOMEntry
+  extends FOMExtensibleElement 
+  implements Entry {
+
+  private static final long serialVersionUID = 1L;
+
+  public FOMEntry(
+    String name,
+    OMNamespace namespace,
+    OMContainer parent,
+    OMFactory factory)
+      throws OMException {
+    super(name, namespace, parent, factory);
+  }
+  
+  public FOMEntry(
+    QName qname,
+    OMContainer parent,
+    OMFactory factory) {
+      super(qname, parent, factory);
+  }
+  
+  public FOMEntry(
+    QName qname,
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) {
+      super(qname, parent, factory, builder);
+  }
+  
+  public FOMEntry(
+    OMContainer parent, 
+    OMFactory factory) 
+      throws OMException {
+    super(ENTRY, parent, factory);
+  }
+
+  public FOMEntry(
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(ENTRY, parent, factory, builder);
+  }
+  
+  public Person getAuthor() {
+    return (Person) getFirstChildWithName(AUTHOR);
+  }
+  
+  public List<Person> getAuthors() {
+    return _getChildrenAsSet(AUTHOR);
+  }
+
+  public void setAuthors(List<Person> people) {
+    _setChildrenFromSet(AUTHOR, people);
+  }
+
+  public void addAuthor(Person person) {
+    addChild((OMElement)person);
+  }
+  
+  public Person addAuthor(String name) {
+    FOMFactory fomfactory = (FOMFactory) this.factory;
+    Person person = fomfactory.newAuthor(this);
+    person.setName(name);
+    return person;
+  }
+
+  public Person addAuthor(String name, String email, String uri) throws URISyntaxException {
+    FOMFactory fomfactory = (FOMFactory) this.factory;
+    return fomfactory.newAuthor(name, email, uri, this);
+  }
+  
+  public Person addAuthor(String name, String email, URI uri) {
+    FOMFactory fomfactory = (FOMFactory) this.factory;
+    return fomfactory.newAuthor(name, email, uri, this);    
+  }
+
+  public List<Category> getCategories() {
+    return _getChildrenAsSet(CATEGORY);
+  }
+
+  public List<Category> getCategories(URI scheme) {
+    List<Category> categories = getCategories();
+    List<Category> matching = new ArrayList<Category>();
+    for (Category category : categories) {
+      try {
+        URI uri = category.getScheme();
+        if ((uri != null && uri.equals(scheme)) ||
+            (uri == null && scheme == null)) {
+          matching.add(category);
+        }
+      } catch (Exception e) {}
+    }
+    return matching;
+  }
+  
+  public List<Category> getCategories(String scheme) throws URISyntaxException {
+    return getCategories((scheme != null) ? new URI(scheme) : null);
+  }
+
+  public void setCategories(List<Category> categories) {
+    _setChildrenFromSet(CATEGORY, categories);
+  }
+
+  public void addCategory(Category category) {
+    addChild((OMElement)category);
+  }
+
+  public Category addCategory(String term) {
+    FOMFactory factory = (FOMFactory) this.factory;
+    Category category = factory.newCategory(this);
+    category.setTerm(term);
+    return category;
+  }
+
+  public Category addCategory(URI scheme, String term, String label) {
+    FOMFactory factory = (FOMFactory) this.factory;
+    return factory.newCategory(scheme, term, label, this);
+  }
+  
+  public Category addCategory(String scheme, String term, String label) throws URISyntaxException {
+    FOMFactory factory = (FOMFactory) this.factory;
+    return factory.newCategory(new URI(scheme), term, label, this);    
+  }
+  
+  @SuppressWarnings("unchecked")
+  public Content getContentElement() {
+    return (Content)getFirstChildWithName(CONTENT);
+  }
+
+  public void setContentElement(Content content) {
+    if (content != null) {
+      Content element = getContentElement();
+      if (element != null) element.discard();
+      _setChild(CONTENT, (OMElement)content);
+    } else {
+      _removeElement(CONTENT, false);
+    }
+  }
+
+  public Content setContentAsText(String value) {
+    if (value == null) {
+      setContentElement(null);
+      return null;
+    }
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Content content = fomfactory.newTextContent(value, null);
+    setContentElement(content);
+    return content;
+  }
+
+  public Content setContentAsHtml(String value, URI baseUri) {
+    if (value == null) {
+      setContentElement(null);
+      return null;
+    }
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Content content = fomfactory.newHtmlContent(value, null);
+    if (baseUri != null) content.setBaseUri(baseUri);
+    setContentElement(content);
+    return content;
+  }
+  
+  public Content setContentAsXhtml(String value, URI baseUri) {
+    if (value == null) {
+      setContentElement(null);
+      return null;
+    }
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Content content = 
+      (Content) fomfactory.newContent(
+        Content.Type.XHTML, null);
+    if (baseUri != null) content.setBaseUri(baseUri);
+    content.setValue(value);
+    return content;
+  }
+  
+  public Content setContentAsXhtml(Div value, URI baseUri) {
+    if (value == null) {
+      setContentElement(null);
+      return null;
+    }
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Content content = fomfactory.newXhtmlContent(value, null);
+    if (baseUri != null) content.setBaseUri(baseUri);
+    setContentElement(content);
+    return content;
+  }
+
+  public Content setContentAsXml(
+    String value, 
+    MimeType type, 
+    URI baseUri) {
+      if (value == null) {
+        setContentElement(null);
+        return null;
+      }
+      FOMFactory fomfactory = (FOMFactory) factory;
+      Content content = 
+        (Content) fomfactory.newContent(Content.Type.XML, null);
+      if (type != null) content.setMimeType(type);
+      if (baseUri != null) content.setBaseUri(baseUri);
+      content.setValue(value);
+      setContentElement(content);
+      return content;    
+  }
+
+  public Content setContentAsXml(
+    String value, 
+    String type, 
+    URI baseUri) 
+      throws MimeTypeParseException {
+    return setContentAsXml(
+      value, 
+      (type != null) ? new MimeType(type) : null, 
+       baseUri);
+  }
+  
+  public Content setContentAsXml(
+    ExtensionElement value, 
+    MimeType type, 
+    URI baseUri) {
+      if (value == null) {
+        setContentElement(null);
+        return null;
+      }
+      FOMFactory fomfactory = (FOMFactory) factory;
+      Content content = 
+        fomfactory.newXmlContent(
+          type, null, value, null);
+      if (baseUri != null) content.setBaseUri(baseUri);
+      setContentElement(content);
+      return content;    
+  }
+
+  public Content setContentAsXml(
+    ExtensionElement value, 
+    String type, 
+    URI baseUri) 
+      throws MimeTypeParseException {
+    return setContentAsXml(
+      value, 
+      (type != null) ? new MimeType(type) : null, 
+      baseUri);
+  }
+
+  /**
+   * Sets the content for this entry
+   */
+  public Content setContentAsMedia(
+    MimeType type, 
+    URI src, 
+    DataHandler dataHandler) {
+      if (dataHandler == null) {
+        setContentElement(null);
+        return null;
+      }
+      FOMFactory fomfactory = (FOMFactory) factory;
+      Content content = fomfactory.newMediaContent(type, src, dataHandler, null);
+      setContentElement(content);
+      return content;
+  }
+
+  /**
+   * Sets the content for this entry
+   * @throws URISyntaxException 
+   */
+  public Content setContentAsMedia(
+    MimeType type, 
+    String src, 
+    DataHandler dataHandler) 
+      throws URISyntaxException {
+    return setContentAsMedia(
+      type, (src != null) ? new URI(src):null,
+      dataHandler);
+  }
+  
+  /**
+   * Sets the content for this entry
+   * @throws MimeTypeParseException 
+   */
+  public Content setContentAsMedia(
+    String type, 
+    URI src, 
+    DataHandler dataHandler) 
+      throws MimeTypeParseException {
+    return setContentAsMedia(
+      (type != null) ? new MimeType(type) : null, 
+      src,dataHandler);
+  }
+
+  /**
+   * Sets the content for this entry
+   * @throws URISyntaxException 
+   * @throws MimeTypeParseException 
+   */
+  public Content setContentAsMedia(
+    String type, 
+    String src, 
+    DataHandler dataHandler) 
+      throws MimeTypeParseException, URISyntaxException {
+    return setContentAsMedia(
+      (type != null) ? new MimeType(type) : null, 
+      (src != null) ? new URI(src) : null,
+      dataHandler);
+  }
+  
+  /**
+   * Sets the content for this entry
+   */
+  public Content setContentAsMedia(
+    MimeType type, 
+    URI src, 
+    String value) {
+      if (value == null) {
+        setContentElement(null);
+        return null;
+      }
+      FOMFactory fomfactory = (FOMFactory) factory;
+      Content content = fomfactory.newMediaContent(type, src, null, null);
+      content.setValue(value);
+      setContentElement(content);
+      return content;
+  }
+
+  /**
+   * Sets the content for this entry
+   * @throws URISyntaxException 
+   */
+  public Content setContentAsMedia(
+    MimeType type, 
+    String src, 
+    String value) 
+      throws URISyntaxException {
+    return setContentAsMedia(
+      type, (src != null) ? new URI(src):null,
+      value);
+  }
+  
+  /**
+   * Sets the content for this entry
+   * @throws MimeTypeParseException 
+   */
+  public Content setContentAsMedia(
+    String type, 
+    URI src, 
+    String value) 
+      throws MimeTypeParseException {
+    return setContentAsMedia(
+      (type != null) ? new MimeType(type) : null, 
+      src,value);
+  }
+
+  /**
+   * Sets the content for this entry
+   * @throws URISyntaxException 
+   * @throws MimeTypeParseException 
+   */
+  public Content setContentAsMedia(
+    String type, 
+    String src, 
+    String value) 
+      throws MimeTypeParseException, URISyntaxException {
+    return setContentAsMedia(
+      (type != null) ? new MimeType(type) : null, 
+      (src != null) ? new URI(src) : null,
+      value);
+  }
+  
+  public List<Person> getContributors() {
+    return _getChildrenAsSet(CONTRIBUTOR);
+  }
+
+  public void setContributors(List<Person> people) {
+    _setChildrenFromSet(CONTRIBUTOR, people);
+  }
+
+  public void addContributor(Person person) {
+    addChild((OMElement)person);
+  }
+
+  public Person addContributor(String name) {
+    FOMFactory fomfactory = (FOMFactory) this.factory;
+    Person person = fomfactory.newContributor(this);
+    person.setName(name);
+    return person;
+  }
+
+  public Person addContributor(
+    String name, 
+    String email, 
+    String uri) 
+      throws URISyntaxException {
+    FOMFactory fomfactory = (FOMFactory) this.factory;
+    return fomfactory.newContributor(name, email, uri, this);
+  }
+  
+  public Person addContributor(
+    String name, 
+    String email, 
+    URI uri) {
+      FOMFactory fomfactory = (FOMFactory) this.factory;
+      return fomfactory.newContributor(name, email, uri, this);    
+  }
+  
+  public IRI getIdElement() {
+    return (IRI)getFirstChildWithName(ID);
+  }
+
+  public void setIdElement(IRI id) {
+    if (id != null)
+      _setChild(ID, (OMElement)id);
+    else
+      _removeElement(ID, false);
+  }
+
+  public URI getId() throws URISyntaxException {
+    IRI id = getIdElement();
+    return (id != null) ? id.getValue() : null;
+  }
+  
+  public IRI setId(URI value) throws URISyntaxException {
+    return setId(value, false);
+  }
+  
+  public IRI setId(String value) throws URISyntaxException {
+    return setId(value, false);
+  }
+  
+  public IRI setId(URI value, boolean normalize) throws URISyntaxException {
+    if (value == null) {
+      _removeElement(ID, false);
+      return null;
+    }
+    IRI id = getIdElement();
+    if (id != null) {
+      if (normalize) id.setNormalizedValue(value);
+      else id.setValue(value);
+      return id;
+    } else {
+      FOMFactory fomfactory = (FOMFactory) factory;
+      return fomfactory.newID(
+        (normalize) ? URIHelper.normalize(value) : value, this);
+    }
+  }
+  
+  public IRI setId(String value, boolean normalize) throws URISyntaxException {
+    return setId((value != null) ? new URI(value) : null, normalize);
+  }
+  
+  public List<Link> getLinks() {
+    return _getChildrenAsSet(LINK);
+  }
+
+  public List<Link> getLinks(String rel) {
+    if (rel == null) return getLinks();
+    List<Link> links = getLinks();
+    List<Link> matching = new ArrayList<Link>();
+    for (Link link : links) {
+      String value = FOMLink.getRelEquiv(link.getRel());
+      rel = FOMLink.getRelEquiv(rel);
+      if (rel.equalsIgnoreCase(Link.REL_ALTERNATE) && 
+          (value == null || 
+            value.equalsIgnoreCase(Link.REL_ALTERNATE))) {
+        matching.add(link);
+      } else if (rel.equalsIgnoreCase(value)) {
+        matching.add(link);
+      }
+    }
+    return matching;
+  }
+
+  public void setLinks(List<Link> links) {
+    _setChildrenFromSet(LINK, links);
+  }
+
+  public void addLink(Link link) {
+    addChild((OMElement)link);
+  }
+
+  public Link addLink(String href) throws URISyntaxException {
+    return addLink(href, null);
+  }
+  
+  public Link addLink(String href, String rel) throws URISyntaxException {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    return fomfactory.newLink(href, rel, null, null, null, -1, this);    
+  }
+  
+  public Link addLink(URI href) {
+    return addLink(href, null);
+  }
+  
+  public Link addLink(URI href, String rel) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    return fomfactory.newLink(href, rel, null, null, null, -1, this);
+  }
+  
+  public Link addLink(
+    URI href, 
+    String rel, 
+    MimeType type, 
+    String title, 
+    String hreflang, 
+    long length) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    return fomfactory.newLink(
+      href, rel, type, title, hreflang, length, this);
+  }
+  
+  public Link addLink(
+    String href, 
+    String rel, 
+    MimeType type, 
+    String title, 
+    String hreflang, 
+    long length) 
+      throws URISyntaxException {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    return fomfactory.newLink(
+      href, rel, type, title, hreflang, length, this);
+  }
+  
+  public Link addLink(
+    URI href, 
+    String rel, 
+    String type, 
+    String title, 
+    String hreflang, 
+    long length) 
+      throws MimeTypeParseException {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    return fomfactory.newLink(
+      href, rel, new MimeType(type), title, hreflang, length, this);
+  }
+  
+  public Link addLink(
+    String href, 
+    String rel, 
+    String type, 
+    String title, 
+    String hreflang, 
+    long length) 
+      throws URISyntaxException, MimeTypeParseException {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    return fomfactory.newLink(
+      href, rel, new MimeType(type), title, hreflang, length, this);
+  }
+  
+  public DateTime getPublishedElement() {
+    return (DateTime)getFirstChildWithName(PUBLISHED);
+  }
+
+  public void setPublishedElement(DateTime dateTime) {
+    if (dateTime != null)
+      _setChild(PUBLISHED, (OMElement)dateTime);
+    else
+      _removeElement(PUBLISHED, false);
+  }
+
+  public String getPublishedString() {
+    DateTime dte = getPublishedElement();
+    return (dte != null) ? dte.getString() : null;
+  }
+  
+  public Date getPublished() {
+    DateTime dte = getPublishedElement();
+    return (dte != null) ? dte.getDate() : null;
+  }
+  
+  public DateTime setPublished(Date value) {
+    if (value == null) {
+      _removeElement(PUBLISHED, false);
+      return null;
+    }
+    DateTime dte = getPublishedElement();
+    if (dte != null) {
+      dte.setDate(value);
+      return dte;
+    } else {
+      FOMFactory fomfactory = (FOMFactory) factory;
+      return fomfactory.newPublished(value, this);
+    }
+  }
+  
+  public DateTime setPublished(Calendar value) {
+    if (value == null) {
+      _removeElement(PUBLISHED, false);
+      return null;
+    }
+    DateTime dte = getPublishedElement();
+    if (dte != null) {
+      dte.setCalendar(value);
+      return dte;
+    } else {
+      FOMFactory fomfactory = (FOMFactory) factory;
+      return fomfactory.newPublished(value, this);
+    }
+  }
+  
+  public DateTime setPublished(long value) {
+    DateTime dte = getPublishedElement();
+    if (dte != null) {
+      dte.setTime(value);
+      return dte;
+    } else {
+      FOMFactory fomfactory = (FOMFactory) factory;
+      return fomfactory.newPublished(value, this);
+    }
+  }
+  
+  public DateTime setPublished(String value) {
+    if (value == null) {
+      _removeElement(PUBLISHED, false);
+      return null;
+    }
+    DateTime dte = getPublishedElement();
+    if (dte != null) {
+      dte.setString(value);
+      return dte;
+    } else {
+      FOMFactory fomfactory = (FOMFactory) factory;
+      return fomfactory.newPublished(value, this);
+    }
+  }
+  
+  @SuppressWarnings("unchecked")
+  public Text getRightsElement() {
+    return getTextElement(RIGHTS);
+  }
+
+  public void setRightsElement(Text text) {
+    setTextElement(RIGHTS, text, false);
+  }
+
+  public Text setRightsAsText(String value) {
+    return setTextText(RIGHTS, value);
+  }  
+  
+  public Text setRightsAsHtml(String value, URI baseUri) {
+    return setHtmlText(RIGHTS, value, baseUri);
+  }
+  
+  public Text setRightsAsXhtml(String value, URI baseUri) {
+    return setXhtmlText(RIGHTS, value, baseUri);
+  }
+  
+  public Text setRightsAsXhtml(Div value, URI baseUri) {
+    return setXhtmlText(RIGHTS, value, baseUri);
+  }
+  
+  public String getRights() {
+    return getText(RIGHTS);
+  }
+  
+  public Source getSource() {
+    return (Source)getFirstChildWithName(SOURCE);
+  }
+
+  public void setSource(Source source) {
+    if (source != null)
+      _setChild(SOURCE, (OMElement)source);
+    else
+      _removeElement(SOURCE, false);
+  }
+
+  @SuppressWarnings("unchecked")
+  public Text getSummaryElement() {
+    return getTextElement(SUMMARY);
+  }
+
+  public void setSummaryElement(Text text) {
+    setTextElement(SUMMARY, text, false);
+  }
+  
+  public Text setSummaryAsText(String value) {
+    return setTextText(SUMMARY, value);
+  }  
+  
+  public Text setSummaryAsHtml(String value, URI baseUri) {
+    return setHtmlText(SUMMARY, value, baseUri);
+  }
+  
+  public Text setSummaryAsXhtml(String value, URI baseUri) {
+    return setXhtmlText(SUMMARY, value, baseUri);
+  }
+  
+  public Text setSummaryAsXhtml(Div value, URI baseUri) {
+    return setXhtmlText(SUMMARY, value, baseUri);
+  }
+    
+  public String getSummary() {
+    return getText(SUMMARY);
+  }
+
+  @SuppressWarnings("unchecked")
+  public Text getTitleElement() {
+    return getTextElement(TITLE);
+  }
+
+  public void setTitleElement(Text title) {
+    setTextElement(TITLE, title, false);
+  }
+
+  public Text setTitleAsText(String value) {
+    return setTextText(TITLE, value);
+  }  
+  
+  public Text setTitleAsHtml(String value, URI baseUri) {
+    return setHtmlText(TITLE, value, baseUri);
+  }
+  
+  public Text setTitleAsXhtml(String value, URI baseUri) {
+    return setXhtmlText(TITLE, value, baseUri);
+  }
+  
+  public Text setTitleAsXhtml(Div value, URI baseUri) {
+    return setXhtmlText(TITLE, value, baseUri);
+  }
+  
+  public String getTitle() {
+    return getText(TITLE);
+  }
+    
+  public DateTime getUpdatedElement() {
+    return (DateTime)getFirstChildWithName(UPDATED);
+  }
+
+  public void setUpdatedElement(DateTime updated) {
+    if (updated != null)
+      _setChild(UPDATED, (OMElement)updated);
+    else 
+      _removeElement(UPDATED, false);
+  }
+
+  public String getUpdatedString() {
+    DateTime dte = getUpdatedElement();
+    return (dte != null) ? dte.getString() : null;
+  }
+  
+  public Date getUpdated() {
+    DateTime dte = getUpdatedElement();
+    return (dte != null) ? dte.getDate() : null;
+  }
+  
+  public DateTime setUpdated(Date value) {
+    if (value == null) {
+      _removeElement(UPDATED, false);
+      return null;
+    }
+    DateTime dte = getUpdatedElement();
+    if (dte != null) {
+      dte.setDate(value);
+      return dte;
+    } else {
+      FOMFactory fomfactory = (FOMFactory) factory;
+      return fomfactory.newUpdated(value, this);
+    }
+  }
+  
+  public DateTime setUpdated(Calendar value) {
+    if (value == null) {
+      _removeElement(UPDATED, false);
+      return null;
+    }
+    DateTime dte = getUpdatedElement();
+    if (dte != null) {
+      dte.setCalendar(value);
+      return dte;
+    } else {
+      FOMFactory fomfactory = (FOMFactory) factory;
+      return fomfactory.newUpdated(value, this);
+    }
+  }
+  
+  public DateTime setUpdated(long value) {
+    DateTime dte = getUpdatedElement();
+    if (dte != null) {
+      dte.setTime(value);
+      return dte;
+    } else {
+      FOMFactory fomfactory = (FOMFactory) factory;
+      return fomfactory.newUpdated(value, this);
+    }
+  }
+  
+  public DateTime setUpdated(String value) {
+    if (value == null) {
+      _removeElement(UPDATED, false);
+      return null;
+    }
+    DateTime dte = getUpdatedElement();
+    if (dte != null) {
+      dte.setString(value);
+      return dte;
+    } else {
+      FOMFactory fomfactory = (FOMFactory) factory;
+      return fomfactory.newUpdated(value, this);
+    }
+  }
+
+  public Control getControl() {
+    return (Control)getFirstChildWithName(CONTROL);
+  }
+
+  public void setControl(Control control) {
+    if (control != null) 
+      _setChild(CONTROL, (OMElement)control);
+    else 
+      _removeElement(CONTROL, false);
+  }
+
+  public Link getLink(String rel) {
+    List<Link> links = getLinks(rel);
+    Link link = null;
+    if (links.size() > 0) link = links.get(0);
+    return link;
+  }
+
+  public Link getAlternateLink() {
+    return getLink(Link.REL_ALTERNATE);
+  }
+
+  public Link getEnclosureLink() {
+    return getLink(Link.REL_ENCLOSURE);
+  }
+  
+  public Link getEditLink() {
+    return getLink(Link.REL_EDIT);
+  }
+  
+  public String getContent() {
+    Content content = getContentElement();
+    return (content != null) ? content.getValue() : null;
+  }
+  
+  public Type getContentType() {
+    Content content = getContentElement();
+    return (content != null) ? content.getContentType() : null;
+  }
+
+  public Text.Type getRightsType() {
+    Text text = getRightsElement();
+    return (text != null) ? text.getTextType() : null;
+  }
+
+  public Text.Type getSummaryType() {
+    Text text = getSummaryElement();
+    return (text != null) ? text.getTextType() : null;
+  }
+
+  public Text.Type getTitleType() {
+    Text text = getTitleElement();
+    return (text != null) ? text.getTextType() : null;
+  }
+
+  public Content setContentAsHtml(String value, String baseUri) throws URISyntaxException {
+    return setContentAsHtml(value, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Content setContentAsXhtml(String value, String baseUri) throws URISyntaxException {
+    return setContentAsXhtml(value, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Content setContentAsXhtml(Div value, String baseUri) throws URISyntaxException {
+    return setContentAsXhtml(value, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Content setContentAsXml(String value, MimeType type, String baseUri) throws URISyntaxException {
+    return setContentAsXml(value, type, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Content setContentAsXml(String value, String type, String baseUri) throws MimeTypeParseException, URISyntaxException {
+    return setContentAsXml(value, type, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Content setContentAsXml(ExtensionElement value, MimeType type, String baseUri) throws URISyntaxException {
+    return setContentAsXml(value, type, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Content setContentAsXml(ExtensionElement value, String type, String baseUri) throws MimeTypeParseException, URISyntaxException {
+    return setContentAsXml(value, type, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Text setRightsAsHtml(String value, String baseUri) throws URISyntaxException {
+    return setRightsAsHtml(value, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Text setRightsAsXhtml(String value, String baseUri) throws URISyntaxException {
+    return setRightsAsXhtml(value, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Text setRightsAsXhtml(Div value, String baseUri) throws URISyntaxException {
+    return setRightsAsXhtml(value, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Text setSummaryAsHtml(String value, String baseUri) throws URISyntaxException {
+    return setSummaryAsHtml(value, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Text setSummaryAsXhtml(String value, String baseUri) throws URISyntaxException {
+    return setSummaryAsXhtml(value, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Text setSummaryAsXhtml(Div value, String baseUri) throws URISyntaxException {
+    return setSummaryAsXhtml(value, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Text setTitleAsHtml(String value, String baseUri) throws URISyntaxException {
+    return setTitleAsHtml(value, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Text setTitleAsXhtml(String value, String baseUri) throws URISyntaxException {
+    return setTitleAsXhtml(value, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Text setTitleAsXhtml(Div value, String baseUri) throws URISyntaxException {
+    return setTitleAsXhtml(value, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Content setContentAsHtml(String value) {
+    return setContentAsHtml(value, (URI)null);
+  }
+
+  public Content setContentAsXhtml(String value) {
+    return setContentAsXhtml(value, (URI)null);
+  }
+
+  public Content setContentAsXhtml(Div value) {
+    return setContentAsXhtml(value, (URI)null);
+  }
+
+  public Content setContentAsXml(
+    String value, 
+    MimeType type) {
+      return setContentAsXml(value, type, (URI)null);
+  }
+
+  public Content setContentAsXml(
+    String value, 
+    String type) 
+      throws MimeTypeParseException {
+    return setContentAsXml(value, type, (URI)null);
+  }
+
+  public Content setContentAsXml(
+    ExtensionElement value, 
+    MimeType type) {
+      return setContentAsXml(value, type, (URI)null);
+  }
+
+  public Content setContentAsXml(
+    ExtensionElement value, 
+    String type) 
+      throws MimeTypeParseException {
+    return setContentAsXml(value, type, (URI)null);
+  }
+
+  public Text setRightsAsHtml(String value) {
+    return setRightsAsHtml(value, (URI)null);
+  }
+
+  public Text setRightsAsXhtml(String value) {
+    return setRightsAsXhtml(value, (URI)null);
+  }
+
+  public Text setRightsAsXhtml(Div value) {
+    return setRightsAsXhtml(value, (URI)null);
+  }
+
+  public Text setSummaryAsHtml(String value) {
+    return setSummaryAsHtml(value, (URI)null);
+  }
+
+  public Text setSummaryAsXhtml(String value) {
+    return setSummaryAsXhtml(value, (URI)null);
+  }
+
+  public Text setSummaryAsXhtml(Div value) {
+    return setSummaryAsXhtml(value, (URI)null);
+  }
+
+  public Text setTitleAsHtml(String value) {
+    return setTitleAsHtml(value, (URI)null);
+  }
+
+  public Text setTitleAsXhtml(String value) {
+    return setTitleAsXhtml(value, (URI)null);
+  }
+
+  public Text setTitleAsXhtml(Div value) {
+    return setTitleAsXhtml(value, (URI)null);
+  }
+
+  public void addInReplyTo(InReplyTo replyTo) {
+    addChild((OMElement)replyTo);
+  }
+  
+  public InReplyTo addInReplyTo() {
+    FOMFactory fomfactory = (FOMFactory) this.factory;
+    InReplyTo replyTo = fomfactory.newInReplyTo(this);
+    return replyTo;
+  }
+
+  public InReplyTo addInReplyTo(Entry ref) {
+    if (ref.equals(this)) return null;
+    InReplyTo irt = addInReplyTo(); 
+    try {
+      irt.setRef(ref.getId());
+      Link altlink = ref.getAlternateLink();
+      if (altlink != null) {
+        irt.setHref(altlink.getResolvedHref());
+        if (altlink.getMimeType() != null) 
+          irt.setMimeType(altlink.getMimeType());
+      }
+      Source src = ref.getSource();
+      if (src != null) {
+        Link selflink = src.getSelfLink();
+        if (selflink != null)
+          irt.setSource(selflink.getResolvedHref());
+      }
+    } catch (Exception e) {}
+    return irt;
+  }
+
+  public InReplyTo addInReplyTo(URI ref) {
+    FOMFactory fomfactory = (FOMFactory) this.factory;
+    return fomfactory.newInReplyTo(ref, this);
+  }
+
+  public InReplyTo addInReplyTo(String ref) throws URISyntaxException {
+    FOMFactory fomfactory = (FOMFactory) this.factory;
+    return fomfactory.newInReplyTo(ref, this);
+  }
+
+  public InReplyTo addInReplyTo(
+    URI ref, 
+    URI source, 
+    URI href, 
+    MimeType type) {
+      FOMFactory fomfactory = (FOMFactory) this.factory;
+      return fomfactory.newInReplyTo(ref, source, href, type, this);
+  }
+
+  public InReplyTo addInReplyTo(
+    String ref, 
+    String source, 
+    String href, 
+    String type) 
+      throws URISyntaxException, 
+             MimeTypeParseException {
+    FOMFactory fomfactory = (FOMFactory) this.factory;
+    return fomfactory.newInReplyTo(ref, source, href, type, this);
+  }
+
+  public InReplyTo getInReplyTo() {
+    return (InReplyTo) getFirstChildWithName(IN_REPLY_TO);
+  }
+
+  public List<InReplyTo> getInReplyTos() {
+    return _getChildrenAsSet(IN_REPLY_TO);
+  }
+
+}

Added: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMException.java?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMException.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMException.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,42 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.parser.stax;
+
+import org.apache.abdera.parser.ParseException;
+
+public class FOMException extends ParseException {
+
+  private static final long serialVersionUID = 7631230122836829559L;
+
+  public FOMException() {
+    super();
+  }
+
+  public FOMException(String message) {
+    super(message);
+  }
+
+  public FOMException(String message, Throwable cause) {
+    super(message, cause);
+  }
+
+  public FOMException(Throwable cause) {
+    super(cause);
+  }
+
+}

Added: 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=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,165 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.parser.stax;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ExtensibleElement;
+import org.apache.abdera.model.ExtensionElement;
+import org.apache.abdera.model.StringElement;
+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;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMXMLParserWrapper;
+
+
+public abstract class FOMExtensibleElement 
+  extends FOMElement 
+  implements ExtensibleElement {
+
+  public FOMExtensibleElement(
+    String name,
+    OMNamespace namespace,
+    OMContainer parent,
+    OMFactory factory)
+      throws OMException {
+    super(name, namespace, parent, factory);
+  }
+  
+  public FOMExtensibleElement(
+    QName qname, 
+    OMContainer parent, 
+    OMFactory factory) 
+      throws OMException {
+    super(qname, parent, factory);
+  }
+
+  public FOMExtensibleElement(
+    QName qname, 
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(qname, parent, factory, builder);
+  }
+
+  @SuppressWarnings("unchecked")
+  protected <E extends Element>List<E> _getExtensionChildrenAsList() {
+    List<E> set = new ArrayList<E>();
+    for (Iterator i = getChildren();i.hasNext();) {
+      OMNode e = (OMNode) i.next();
+      if (e instanceof ExtensionElement &&
+          !((OMElement)e).getQName().getNamespaceURI().equals(
+            this.getQName().getNamespaceURI())) {
+        set.add((E) e);
+      }
+    }
+    return set;
+  }
+  
+  public List<ExtensionElement> getExtensions() {
+    return _getExtensionChildrenAsList();
+  }
+
+  public List<ExtensionElement> getExtensions(String uri) {
+    List<ExtensionElement> matching = new ArrayList<ExtensionElement>();
+    for (Iterator i = this.getChildElements(); i.hasNext();) {
+      OMElement e = (OMElement) i.next();
+      if ((uri == null)?
+            e.getQName().getNamespaceURI() == null: 
+            e.getQName().getNamespaceURI().equals(uri)) {
+        matching.add((ExtensionElement) e);
+      }
+    }
+    return matching;
+  }
+
+  public List<ExtensionElement> getExtensions(QName qname) {
+    List<ExtensionElement> matching = new ArrayList<ExtensionElement>();
+    for (Iterator i = this.getChildrenWithName(qname); i.hasNext();) {
+      matching.add((ExtensionElement) i.next());
+    }
+    return matching;
+  }
+
+  public ExtensionElement getExtension(QName qname) {
+    return (ExtensionElement) this.getFirstChildWithName(qname);
+  }
+  
+  public void addExtension(ExtensionElement extension) {
+    addChild((OMElement)extension);
+  }
+  
+  public ExtensionElement addExtension(QName qname) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    return fomfactory.newExtensionElement(qname, this);
+  }
+  
+  public ExtensionElement addExtension(String namespace, String localpart, String prefix) {
+    return addExtension(new QName(namespace, localpart, prefix));
+  }
+
+  public StringElement addSimpleExtension(QName qname, String value) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    return fomfactory.newStringElement(qname, value, this);
+  }
+  
+  public StringElement addSimpleExtension(
+    String namespace, 
+    String localPart, 
+    String prefix, 
+    String value) {
+      return addSimpleExtension(
+        new QName(
+          namespace, 
+          localPart, 
+          prefix), 
+        value);
+  }
+  
+  public void addExtensions(List<ExtensionElement> extensions) {
+    for (ExtensionElement e : extensions) {
+      addExtension(e);
+    }
+  }
+  
+  /**
+   * Trick using Generics to find an extension element without 
+   * having to pass in it's QName
+   */ 
+  @SuppressWarnings("unchecked")
+  public <T extends ExtensionElement> T getExtension(Class<T> _class) {
+    T t = null;
+    List<ExtensionElement> extensions = getExtensions();
+    for (ExtensionElement ext : extensions) {
+      if (_class.isAssignableFrom(ext.getClass())) {
+        t = (T)ext;
+        break;
+      }
+    }
+    return t;
+  }
+}

Added: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensionElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensionElement.java?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensionElement.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensionElement.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,62 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.parser.stax;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.model.ExtensionElement;
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+
+
+public class FOMExtensionElement 
+  extends FOMExtensibleElement 
+  implements ExtensionElement {
+
+  private static final long serialVersionUID = -1874496559841783615L;
+
+  public FOMExtensionElement(
+    String name,
+    OMNamespace namespace,
+    OMContainer parent,
+    OMFactory factory)
+      throws OMException {
+    super(name, namespace, parent, factory);
+  }
+  
+  public FOMExtensionElement(
+    QName qname, 
+    OMContainer parent, 
+    OMFactory factory) 
+      throws OMException {
+    super(qname, parent, factory);
+  }
+
+  public FOMExtensionElement(
+    QName qname, 
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(qname, parent, factory, builder);
+  }
+  
+}

Added: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensionFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensionFactory.java?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensionFactory.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensionFactory.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,43 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.parser.stax;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.ExtensionFactory;
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Document;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ExtensionElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+
+
+public interface FOMExtensionFactory extends ExtensionFactory {
+
+  public <T extends ExtensionElement>T newExtensionElement(
+    QName qname,
+    Element parent,
+    Factory factory,
+    OMXMLParserWrapper parserWrapper);
+
+  public <T extends ExtensionElement>T newExtensionElement(
+      QName qname,
+      Document parent,
+      Factory factory,
+      OMXMLParserWrapper parserWrapper);
+}

Added: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,1175 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.parser.stax;
+ 
+import javax.activation.MimeTypeParseException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import javax.activation.DataHandler;
+import javax.activation.MimeType;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.ExtensionFactory;
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.AtomDate;
+import org.apache.abdera.model.Base;
+import org.apache.abdera.model.Category;
+import org.apache.abdera.model.Collection;
+import org.apache.abdera.model.Content;
+import org.apache.abdera.model.Control;
+import org.apache.abdera.model.DateTime;
+import org.apache.abdera.model.Div;
+import org.apache.abdera.model.Document;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.ExtensibleElement;
+import org.apache.abdera.model.ExtensionElement;
+import org.apache.abdera.model.Feed;
+import org.apache.abdera.model.Generator;
+import org.apache.abdera.model.IRI;
+import org.apache.abdera.model.InReplyTo;
+import org.apache.abdera.model.Link;
+import org.apache.abdera.model.Person;
+import org.apache.abdera.model.Service;
+import org.apache.abdera.model.Source;
+import org.apache.abdera.model.StringElement;
+import org.apache.abdera.model.Text;
+import org.apache.abdera.model.Total;
+import org.apache.abdera.model.Workspace;
+import org.apache.abdera.model.Content.Type;
+import org.apache.abdera.parser.Parser;
+import org.apache.abdera.util.Constants;
+import org.apache.abdera.util.Version;
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory;
+
+
+public class FOMFactory 
+  extends OMLinkedListImplFactory 
+  implements Factory, Constants {
+
+  private List<QName> simpleExtensions = null;
+  
+  public Parser newParser() {
+    return new FOMParser();
+  }
+  
+  public <T extends Element>Document<T> newDocument() {
+    return new FOMDocument<T>(this);
+  }
+  
+  public <T extends Element>Document<T> newDocument(
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMDocument<T>(parserWrapper, this);
+  }
+  
+  public <T extends Element>Document<T> newDocument(
+    T root, 
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMDocument<T>((OMElement)root, parserWrapper, this);
+  }
+  
+  public Service newService(
+    QName qname,
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMService(qname,parent, this, parserWrapper);
+  }
+
+  public Service newService(
+    Base parent) {
+    return new FOMService((OMContainer)parent, this);
+  }
+
+  public Workspace newWorkspace(
+    QName qname,
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMWorkspace(qname,parent, this, parserWrapper);
+  }
+  
+  public Workspace newWorkspace(
+    Element parent) {
+    return new FOMWorkspace((OMContainer)parent, this);
+  }
+
+  public Collection newCollection(
+    QName qname,
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMCollection(qname, parent, this, parserWrapper);
+  }
+  
+  public Collection newCollection(
+    Element parent) {
+    return new FOMCollection((OMContainer)parent, this);
+  }
+
+  public Feed newFeed() {
+    Document<Feed> doc = newDocument();
+    return newFeed(doc);
+  }
+  
+  public Entry newEntry() {
+    Document<Entry> doc = newDocument();
+    return newEntry(doc);
+  }
+  
+  public Service newService() {
+    Document<Service> doc = newDocument();
+    return newService(doc);
+  }
+  
+  public Feed newFeed(
+    QName qname,
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMFeed(qname,parent, this, parserWrapper);
+  }
+  
+  public Feed newFeed(
+    Base parent) {
+    return new FOMFeed((OMContainer)parent, this);
+  }
+
+  public Entry newEntry(
+    QName qname,
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMEntry(qname,parent, this, parserWrapper);
+  }
+  
+  public Entry newEntry(
+    Base parent) {
+      return new FOMEntry((OMContainer)parent, this);
+  }
+
+  public Category newCategory(
+    QName qname,
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMCategory(qname,parent, this, parserWrapper);
+  }
+  
+  public Category newCategory(
+    Element parent) {
+      return new FOMCategory((OMContainer)parent, this);
+  }
+
+  public Category newCategory(
+    URI scheme, 
+    String term, 
+    String label, 
+    Element parent) {
+    Category category = new FOMCategory((OMContainer)parent, this);
+    if (scheme != null)
+      category.setScheme(scheme);
+    if (term != null)
+      category.setTerm(term);
+    if (label != null)
+    category.setLabel(label);
+    return category;
+  }
+
+  public Content newContent(
+    QName qname,
+    Type type, 
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+      Content content = null;
+      if (Type.TEXT.equals(type)) {
+        content = new FOMContent(qname,Content.Type.TEXT, parent, this, parserWrapper);
+      } else if (Type.HTML.equals(type)) {
+        content = new FOMContent(qname,Content.Type.HTML, parent, this, parserWrapper);
+      } else if (Type.XHTML.equals(type)) {
+        content = new FOMContent(qname,Content.Type.XHTML, parent, this, parserWrapper);
+      } else if (Type.XML.equals(type)) {
+        content = new FOMContent(qname,Content.Type.XML, parent, this, parserWrapper);
+      } else if (Type.MEDIA.equals(type)) {
+        content = new FOMContent(qname,Content.Type.MEDIA, parent, this, parserWrapper);
+      }
+      return content;
+  }
+  
+  public Content newContent(
+    Type type, 
+    Element parent) {
+      Content content = null;
+      if (Type.TEXT.equals(type)) {
+        content = new FOMContent(Content.Type.TEXT, (OMContainer)parent, this);
+      } else if (Type.HTML.equals(type)) {
+        content = new FOMContent(Content.Type.HTML, (OMContainer)parent, this);
+      } else if (Type.XHTML.equals(type)) {
+        content = new FOMContent(Content.Type.XHTML, (OMContainer)parent, this);
+      } else if (Type.XML.equals(type)) {
+        content = new FOMContent(Content.Type.XML, (OMContainer)parent, this);
+      } else if (Type.MEDIA.equals(type)) {
+        content = new FOMContent(Content.Type.MEDIA, (OMContainer)parent, this);
+      }
+      return content;
+  }
+  
+  public Content newHtmlContent(
+    String value, 
+    Element parent) {
+      Content content = newContent(Content.Type.HTML, parent);
+      content.setValue(value);
+      return content;
+  }
+
+  public Content newMediaContent(
+    MimeType mediaType, 
+    URI src, 
+    DataHandler dataHandler, 
+    Element parent) {
+      Content content = newContent(Content.Type.MEDIA, mediaType, parent);
+      if (src != null) content.setSrc(src);
+      if (dataHandler != null) content.setDataHandler(dataHandler);
+      return content;
+  }
+
+  public Content newTextContent(
+    String value, 
+    Element parent) {
+      Content content = newContent(Content.Type.TEXT, parent);
+      content.setValue(value);
+      return content;
+  }
+
+  public Content newXhtmlContent(
+    Div value, Element parent) {
+      Content content = 
+        newContent(
+          Content.Type.XHTML, 
+          parent);
+      if (value != null)
+        content.setValueElement(value);
+      return content;
+  }
+
+  public Content newXmlContent(
+    MimeType mediaType, 
+    URI src, 
+    ExtensionElement value, Element parent) {
+      Content content = 
+        newContent(
+          Content.Type.MEDIA, 
+          mediaType, 
+          parent);
+      if (src != null) content.setSrc(src);
+      if (value != null) content.setValueElement(value);
+      return content;
+  }
+
+  public Content newContent(
+    Type type, 
+    MimeType mediaType, 
+    Element parent) {
+    Content content = newContent(type, parent);
+    content.setMimeType(mediaType);
+    return content;
+  }
+
+  public DateTime newDateTimeElement(
+    QName qname,
+    OMContainer parent,
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMDateTime(
+          qname, parent, this, parserWrapper);
+  }
+  
+  public DateTime newDateTime(
+    QName qname, 
+    Element parent) {
+    return new FOMDateTime(qname, (OMContainer)parent, this);
+  }
+
+  public DateTime newDateTime(
+    QName qname, 
+    AtomDate dateTime, 
+    Element parent) {
+    DateTime dt = newDateTime(qname, parent);
+    dt.setValue(dateTime);
+    return dt;
+  }
+
+  public DateTime newDateTime(
+    QName qname, 
+    Date date, 
+    Element parent) {
+    DateTime dt = newDateTime(qname, parent);
+    dt.setValue(AtomDate.valueOf(date));
+    return dt;
+  }
+
+  public DateTime newDateTime(
+    QName qname, 
+    String date, 
+    Element parent) {
+    DateTime dt = newDateTime(qname, parent);
+    dt.setValue(AtomDate.valueOf(date));
+    return dt;
+  }
+
+  public DateTime newDateTime(
+    QName qname, 
+    Calendar date, 
+    Element parent) {
+    DateTime dt = newDateTime(qname, parent);
+    dt.setValue(AtomDate.valueOf(date));
+    return dt;
+  }
+
+  public DateTime newDateTime(
+    QName qname, 
+    long date, 
+    Element parent) {
+    DateTime dt = newDateTime(qname, parent);
+    dt.setValue(AtomDate.valueOf(date));
+    return dt;
+  }
+
+  public Generator newGenerator(
+    QName qname,
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMGenerator(qname,parent, this, parserWrapper);
+  }
+  
+  public Generator newDefaultGenerator(
+    Element parent) {
+      Generator generator = newDefaultGenerator(parent);
+      generator.setVersion(Version.VERSION);
+      generator.setValue(Version.APP_NAME);
+      return generator;
+  }
+  
+  public Generator newGenerator(
+      Element parent) {
+    return new FOMGenerator((OMContainer)parent, this);
+  }
+
+  public Generator newGenerator(
+    URI uri, 
+    String version, 
+    String value, 
+    Element parent) {
+    Generator generator = newGenerator(parent);
+    if (uri != null)
+      generator.setUri(uri);
+    if (version != null)
+      generator.setVersion(version);
+    if (value != null)
+      generator.setValue(value);
+    return generator;
+  }
+
+  public IRI newID(
+    QName qname,
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMIRI(qname, parent, this, parserWrapper);
+  }
+  
+  public IRI newID(
+    Element parent) {
+      return new FOMIRI(Constants.ID, (OMContainer)parent, this);
+  }
+
+  public IRI newID(
+    String id, 
+    Element parent) 
+      throws URISyntaxException {
+    IRI _id = newID(parent);
+    if (id != null)
+      _id.setValue(new URI(id));
+    return _id;
+  }
+
+  public IRI newID(
+    URI id, 
+    Element parent) {
+      IRI _id = newID(parent);
+      if (id != null)
+      _id.setValue(id);
+      return _id;
+  }
+
+  public IRI newURIElement(
+    QName qname,
+    OMContainer parent,
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMIRI(qname, parent, this, parserWrapper);
+  }
+  
+  public IRI newIRIElement(
+    QName qname, 
+    Element parent) {
+    return new FOMIRI(qname, (OMContainer)parent, this);
+  }
+
+  public IRI newIRIElement(
+    QName qname, 
+    URI uri, 
+    Element parent) {
+    IRI iri = newIRIElement(qname, parent);
+    if (uri != null)
+      iri.setValue(uri);
+    return iri;
+  }
+
+  public IRI newIRIElement(
+    QName qname, 
+    String URI, 
+    Element parent) 
+      throws URISyntaxException {
+    IRI iri = newIRIElement(qname, parent);
+    if (URI != null)
+      iri.setValue(new URI(URI));
+    return iri;
+  }
+
+  public Link newLink(
+    QName qname,
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMLink(qname,parent, this, parserWrapper);
+  }
+  
+  public Link newLink(
+    Element parent) {
+    return new FOMLink((OMContainer)parent, this);
+  }
+
+  public Link newLink(
+    String href, 
+    String rel, 
+    MimeType type, 
+    String title,
+    String hreflang, 
+    long length, 
+    Element parent) throws URISyntaxException {
+    Link link = newLink(parent);
+    if (href != null)
+      link.setHref(new URI(href));
+    if (rel != null)
+      link.setRel(rel);
+    if (title != null)
+      link.setTitle(title);
+    if (type != null)
+      link.setMimeType(type);
+    if (hreflang != null)
+      link.setHrefLang(hreflang);
+    if (length > -1)
+      link.setLength(length);
+    return link;
+  }
+
+  public Link newLink(
+    URI href, 
+    String rel, 
+    MimeType type, 
+    String title, 
+    String hreflang, 
+    long length, 
+    Element parent) {
+    Link link = newLink(parent);
+    if (href != null)
+      link.setHref(href);
+    if (rel != null)
+      link.setRel(rel);
+    if (title != null)
+      link.setTitle(title);
+    if (type != null)
+      link.setMimeType(type);
+    if (hreflang != null)
+      link.setHrefLang(hreflang);
+    if (length > -1)
+      link.setLength(length);
+    return link;
+  }
+
+  public Person newPerson(
+    QName qname,
+    OMContainer parent,
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMPerson(qname, parent, this, parserWrapper);
+  }
+  
+  public Person newPerson(
+    QName qname, 
+    Element parent) {
+      return new FOMPerson(qname, (OMContainer)parent, this);
+  }
+
+  public Person newPerson(
+    QName qname,
+    String name, 
+    String email, 
+    String uri, 
+    Element parent) throws URISyntaxException {
+    Person person = newPerson(qname, parent);
+    if (name != null)
+      person.setName(name);
+    if (email != null)
+      person.setEmail(email);
+    if (uri != null)
+      person.setUri(new URI(uri));
+    return person;
+  }
+
+  public Person newPerson(
+    QName qname, 
+    String name, 
+    String email,
+    URI uri, 
+    Element parent) {
+    Person person = newPerson(qname, parent);
+    if (name != null)
+      person.setName(name);
+    if (email != null)
+      person.setEmail(email);
+    if (uri != null)
+      person.setUri(uri);
+    return person;
+  }
+
+  public Source newSource(
+    QName qname, 
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMSource(qname, parent, this, parserWrapper);
+  }
+  
+  public Source newSource(
+      Element parent) {
+    return new FOMSource((OMContainer)parent, this);
+  }
+
+  public Text newText(
+    QName qname,
+    Text.Type type,
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+    Text text = null;
+    if (Text.Type.TEXT.equals(type)) {
+      text = new FOMText(Text.Type.TEXT, qname, parent, this, parserWrapper);
+    } else if (Text.Type.HTML.equals(type)) {
+      text = new FOMText(Text.Type.HTML, qname, parent, this, parserWrapper);
+    } else if (Text.Type.XHTML.equals(type)) {
+      text = new FOMText(Text.Type.XHTML, qname, parent, this, parserWrapper);
+    }
+    return text;  }
+  
+  public Text newText(
+    QName qname, 
+    Text.Type type, 
+    Element parent) {
+    Text text = null;
+    if (Text.Type.TEXT.equals(type)) {
+      text = new FOMText(Text.Type.TEXT, qname, (OMContainer)parent, this);
+    } else if (Text.Type.HTML.equals(type)) {
+      text = new FOMText(Text.Type.HTML, qname, (OMContainer)parent, this);
+    } else if (Text.Type.XHTML.equals(type)) {
+      text = new FOMText(Text.Type.XHTML, qname, (OMContainer)parent, this);
+    }
+    return text;
+  }
+  
+  public Text newHtmlText(
+    QName qname, 
+    String value, 
+    Element parent) {
+      Text text = newText(qname, Text.Type.HTML, parent);
+      text.setValue(value);
+      return text;
+  }
+
+  public Text newTextText(
+    QName qname, 
+    String value, 
+    Element parent) {
+      Text text = newText(qname, Text.Type.TEXT, parent);
+      text.setValue(value);
+      return text;
+  }
+
+  public Text newXhtmlText(
+    QName qname, 
+    Div value,
+    Element parent) {
+      Text text = newText(qname, Text.Type.XHTML, parent);
+      if (value != null)
+        text.setValueElement(value);
+      return text;
+  }
+
+  public StringElement newStringElement(
+    QName qname,
+    OMContainer parent,
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMStringElement(qname, parent, this, parserWrapper);
+  }
+  
+  public StringElement newStringElement(
+    QName qname, 
+    Element parent) {
+    return new FOMStringElement(qname, (OMContainer)parent, this);
+  }
+
+  public StringElement newStringElement(
+    QName qname, 
+    String value,
+    Element parent) {
+    StringElement el = newStringElement(qname, parent);
+    if (value != null)
+      el.setValue(value);
+    return el;
+  }
+
+  public ExtensionElement newExtensionElement(
+    QName qname, 
+    Base parent) {
+    return newExtensionElement(qname, (OMContainer)parent);
+  }
+  
+  private ExtensionElement newExtensionElement(
+    QName qname, 
+    OMContainer parent) {
+      ExtensionElement element = null;
+      if (!isSimpleExtension(qname)) {
+        List<ExtensionFactory> factories = 
+          org.apache.abdera.util.ServiceUtil.loadExtensionFactories(
+            "org.apache.abdera.factory.ExtensionFactory");
+        if (factories != null) {
+          for (ExtensionFactory factory : factories) {
+            if ((factory.getNamespace() == null) ? 
+                  qname.getNamespaceURI() == null : 
+                    factory.getNamespace().equals(
+                      qname.getNamespaceURI())) {
+              if (parent instanceof Element)
+                element = factory.newExtensionElement(qname, (Element)parent, this);
+              else if (parent instanceof Document)
+                element = factory.newExtensionElement(qname, (Document)parent, this);
+            }
+          }
+        }
+        if (element == null) {
+          element = 
+            new FOMExtensionElement(
+              qname, 
+              (OMElement)parent, 
+              this);
+        }
+      } else {
+        if (parent instanceof Element)
+          element = newStringElement(qname, (Element)parent);
+      }
+      return element;
+  }
+
+  public ExtensionElement newExtensionElement(
+    QName qname,
+    OMContainer parent,
+    OMXMLParserWrapper parserWrapper) {
+    ExtensionElement element = null;
+    List<ExtensionFactory> factories = 
+      org.apache.abdera.util.ServiceUtil.loadExtensionFactories(
+        "org.apache.abdera.factory.ExtensionFactory");
+    if (factories != null) {
+      for (ExtensionFactory factory : factories) {
+        if (factory instanceof FOMExtensionFactory &&
+            (factory.getNamespace() == null) ? 
+              qname.getNamespaceURI() == null : 
+                factory.getNamespace().equals(
+                  qname.getNamespaceURI())) {
+          if (parent instanceof Element)
+            element = 
+              ((FOMExtensionFactory)factory).newExtensionElement(
+                qname, (Element)parent, this, parserWrapper);
+          else if (parent instanceof Document)
+            element = 
+              ((FOMExtensionFactory)factory).newExtensionElement(
+                qname, (Document)parent, this, parserWrapper);
+        }
+      }
+    }
+    if (element == null) {
+      element = 
+        new FOMExtensionElement(qname, parent, this, parserWrapper);
+    }
+    return element;
+  }
+  
+  public Control newControl(Element parent) {
+    return new FOMControl((OMElement)parent, this);
+  }
+  
+  public Control newControl(
+    QName qname,
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+    return new FOMControl(qname, parent, this, parserWrapper);
+  }
+
+  public DateTime newPublished(Element parent) {
+    return newDateTime(Constants.PUBLISHED, parent);
+  }
+
+  public DateTime newPublished(AtomDate dateTime, Element parent) {
+    return newDateTime(Constants.PUBLISHED, dateTime, parent);
+  }
+
+  public DateTime newPublished(Date date, Element parent) {
+    return newDateTime(Constants.PUBLISHED, date, parent);
+  }
+
+  public DateTime newPublished(String date, Element parent) {
+    return newDateTime(Constants.PUBLISHED, date, parent);
+  }
+
+  public DateTime newPublished(Calendar date, Element parent) {
+    return newDateTime(Constants.PUBLISHED, date, parent);
+  }
+
+  public DateTime newPublished(long date, Element parent) {
+    return newDateTime(Constants.PUBLISHED, date, parent);
+  }
+
+  public DateTime newUpdated(Element parent) {
+    return newDateTime(Constants.UPDATED, parent);
+  }
+
+  public DateTime newUpdated(AtomDate dateTime, Element parent) {
+    return newDateTime(Constants.UPDATED, dateTime, parent);
+  }
+
+  public DateTime newUpdated(Date date, Element parent) {
+    return newDateTime(Constants.UPDATED, date, parent);
+  }
+
+  public DateTime newUpdated(String date, Element parent) {
+    return newDateTime(Constants.UPDATED, date, parent);
+  }
+
+  public DateTime newUpdated(Calendar date, Element parent) {
+    return newDateTime(Constants.UPDATED, date, parent);
+  }
+
+  public DateTime newUpdated(long date, Element parent) {
+    return newDateTime(Constants.UPDATED, date, parent);
+  }
+
+  public IRI newIcon(Element parent) {
+    return newIRIElement(Constants.ICON, parent);
+  }
+
+  public IRI newIcon(URI uri, Element parent) {
+    return newIRIElement(Constants.ICON, uri, parent);
+  }
+
+  public IRI newIcon(String URI, Element parent) throws URISyntaxException {
+    return newIRIElement(Constants.ICON, URI, parent);
+  }
+
+  public IRI newLogo(Element parent) {
+    return newIRIElement(Constants.LOGO, parent);
+  }
+
+  public IRI newLogo(URI uri, Element parent) {
+    return newIRIElement(Constants.LOGO, uri, parent);
+  }
+
+  public IRI newLogo(String URI, Element parent) throws URISyntaxException {
+    return newIRIElement(Constants.LOGO, URI, parent);
+  }
+
+  public IRI newUri(Element parent) {
+    return newIRIElement(Constants.URI, parent);
+  }
+
+  public IRI newUri(URI uri, Element parent) {
+    return newIRIElement(Constants.URI, uri, parent);
+  }
+
+  public IRI newUri(String URI, Element parent) throws URISyntaxException {
+    return newIRIElement(Constants.URI, URI, parent);
+  }
+
+  public Person newAuthor(Element parent) {
+    return newPerson(Constants.AUTHOR, parent);
+  }
+
+  public Person newAuthor(String name, String email, String uri, Element parent) throws URISyntaxException {
+    return newPerson(Constants.AUTHOR, name, email, uri, parent);
+  }
+
+  public Person newAuthor(String name, String email, URI uri, Element parent) {
+    return newPerson(Constants.AUTHOR, name, email, uri, parent);
+  }
+
+  public Person newContributor(Element parent) {
+    return newPerson(Constants.CONTRIBUTOR, parent);
+  }
+
+  public Person newContributor(String name, String email, String uri, Element parent) throws URISyntaxException {
+    return newPerson(Constants.CONTRIBUTOR, name, email, uri, parent);
+  }
+
+  public Person newContributor(String name, String email, URI uri, Element parent) {
+    return newPerson(Constants.CONTRIBUTOR, name, email, uri, parent);
+  }
+
+  public Text newTextTitle(String value, Element parent) {
+    return newTextText(Constants.TITLE, value, parent);
+  }
+
+  public Text newHtmlTitle(String value, Element parent) {
+    return newHtmlText(Constants.TITLE, value, parent);
+  }
+
+  public Text newXhtmlTitle(
+    Div value,
+    Element parent) {
+      return newXhtmlText(Constants.TITLE, value, parent);
+  }
+
+  public Text newTextSubtitle(String value, Element parent) {
+    return newTextText(Constants.SUBTITLE, value, parent);
+  }
+
+  public Text newHtmlSubtitle(String value, Element parent) {
+    return newHtmlText(Constants.SUBTITLE, value, parent);
+  }
+
+  public Text newXhtmlSubtitle(Div value, Element parent) {
+    return newXhtmlText(Constants.SUBTITLE, value, parent);
+  }
+
+  public Text newTextSummary(String value, Element parent) {
+    return newTextText(Constants.SUMMARY, value, parent);
+  }
+
+  public Text newHtmlSummary(String value, Element parent) {
+    return newHtmlText(Constants.SUMMARY, value, parent);
+  }
+
+  public Text newXhtmlSummary(Div value, Element parent) {
+    return newXhtmlText(Constants.SUMMARY, value, parent);
+  }
+
+  public Text newTextRights(String value, Element parent) {
+    return newTextText(Constants.RIGHTS, value, parent);
+  }
+
+  public Text newHtmlRights(String value, Element parent) {
+    return newHtmlText(Constants.RIGHTS, value, parent);
+  }
+
+  public Text newXhtmlRights(Div value, Element parent) {
+    return newXhtmlText(Constants.RIGHTS, value, parent);
+  }
+
+  public StringElement newName(Element parent) {
+    return newStringElement(Constants.NAME, parent);
+  }
+
+  public StringElement newName(String value, Element parent) {
+    return newStringElement(Constants.NAME, value, parent);
+  }
+
+  public StringElement newEmail(Element parent) {
+    return newStringElement(Constants.EMAIL, parent);
+  }
+
+  public StringElement newEmail(String value, Element parent) {
+    return newStringElement(Constants.EMAIL, value, parent);
+  }
+
+  public Control newControl(boolean draft, Element parent) {
+    Control control = newControl(parent);
+    control.setDraft(draft);
+    return control;
+  }
+
+  public Div newDiv(Base parent) {
+    return new FOMDiv(Constants.DIV, (OMContainer)parent, this);
+  }
+  
+  public Div newDiv(
+    QName qname,
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMDiv(qname, parent, this, parserWrapper);
+  }
+  
+  public Element newElement(
+    QName qname,
+    OMContainer parent,
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMElement(qname, parent, this, parserWrapper);
+  }
+
+  public Total newTotal(Element parent) {
+    return new FOMTotal((OMContainer)parent, this);
+  }
+  
+  public Total newTotal(int totalResponse, Element parent) {
+    Total total = newTotal(parent);
+    total.setValue(totalResponse);
+    return total;
+  }
+  
+  public Total newTotal(
+      QName qname, 
+      OMContainer parent, 
+      OMXMLParserWrapper parserWrapper) {
+    return new FOMTotal(qname, parent, this, parserWrapper);
+  }
+  
+  public InReplyTo newInReplyTo(
+    QName qname,
+    OMContainer parent, 
+    OMXMLParserWrapper parserWrapper) {
+      return new FOMInReplyTo(qname, parent, this, parserWrapper);
+  }
+  
+  public InReplyTo newInReplyTo(Element parent) {
+    return new FOMInReplyTo((OMContainer)parent, this);
+  }
+
+  public InReplyTo newInReplyTo(URI ref, Element parent) {
+    InReplyTo replyTo = newInReplyTo(parent);
+    if (ref != null) replyTo.setRef(ref);
+    return replyTo;
+  }
+
+  public InReplyTo newInReplyTo(String ref, Element parent) throws URISyntaxException {
+    return (ref != null) ? newInReplyTo(new URI(ref), parent) : newInReplyTo(parent);
+  }
+
+  public InReplyTo newInReplyTo(
+    URI ref, 
+    URI source, 
+    URI href, 
+    MimeType type, 
+    Element parent) {
+      InReplyTo replyTo = newInReplyTo(parent);
+      if (ref != null) replyTo.setRef(ref);
+      if (source != null) replyTo.setSource(source);
+      if (href != null) replyTo.setHref(href);
+      if (type != null) replyTo.setMimeType(type);
+      return replyTo;
+  }
+
+  public InReplyTo newInReplyTo(
+    String ref, 
+    String source, 
+    String href, 
+    String type, 
+    Element parent) 
+      throws URISyntaxException, 
+             MimeTypeParseException {
+    return newInReplyTo(
+      (ref != null) ? new URI(ref) : null,
+      (source != null) ? new URI(source) : null,
+      (href != null) ? new URI(href) : null,
+      (type != null) ? new MimeType(type) : null,
+      parent
+    );
+  }
+
+  protected OMElement createElement(
+      QName qname, 
+      OMContainer parent, 
+      OMFactory factory,
+      Object objecttype) {
+      OMElement element = null;
+      OMNamespace namespace = 
+        this.createOMNamespace(
+          qname.getNamespaceURI(), 
+          qname.getPrefix());
+      if (FEED.equals(qname)) {
+        element = (OMElement) new FOMFeed(qname.getLocalPart(), namespace, parent, factory);
+      } else if (SERVICE.equals(qname)) {
+        element = (OMElement) new FOMService(qname.getLocalPart(), namespace, parent, factory);
+      } else if (ENTRY.equals(qname)) {
+        element = (OMElement) new FOMEntry(qname.getLocalPart(), namespace, parent, factory);
+      } else if (AUTHOR.equals(qname)) {
+        element = (OMElement) new FOMPerson(qname.getLocalPart(), namespace, parent, factory);
+      } else if (CATEGORY.equals(qname)) {
+        element = (OMElement) new FOMCategory(qname.getLocalPart(), namespace, parent, factory);
+      } else if (CONTENT.equals(qname)) {
+        Content.Type type = (Content.Type) objecttype;
+        element = (OMElement) new FOMContent(qname.getLocalPart(), namespace, type, parent, factory);
+      } else if (CONTRIBUTOR.equals(qname)) {
+        element = (OMElement) new FOMPerson(qname.getLocalPart(), namespace, parent, factory);
+      } else if (GENERATOR.equals(qname)) {
+        element = (OMElement) new FOMGenerator(qname.getLocalPart(), namespace, parent, factory);
+      } else if (ICON.equals(qname)) {
+        element = (OMElement) new FOMIRI(qname.getLocalPart(), namespace, parent, factory);
+      } else if (ID.equals(qname)) {
+        element = (OMElement) new FOMIRI(qname.getLocalPart(), namespace, parent, factory);
+      } else if (LOGO.equals(qname)) {
+        element = (OMElement) new FOMIRI(qname.getLocalPart(), namespace, parent, factory);
+      } else if (LINK.equals(qname)) {
+        element = (OMElement) new FOMLink(qname.getLocalPart(), namespace, parent, factory);
+      } else if (PUBLISHED.equals(qname)) {
+        element = (OMElement) new FOMDateTime(qname.getLocalPart(), namespace, parent, factory);
+      } else if (RIGHTS.equals(qname)) {
+        Text.Type type = (Text.Type) objecttype;
+        element = (OMElement) new FOMText(type, qname.getLocalPart(), namespace, parent, factory);
+      } else if (SOURCE.equals(qname)) {
+        element = (OMElement) new FOMSource(qname.getLocalPart(), namespace, parent, factory);
+      } else if (SUBTITLE.equals(qname)) {
+        Text.Type type = (Text.Type) objecttype;
+        element = (OMElement) new FOMText(type, qname.getLocalPart(), namespace, parent, factory);
+      } else if (SUMMARY.equals(qname)) {
+        Text.Type type = (Text.Type) objecttype;
+        element = (OMElement) new FOMText(type, qname.getLocalPart(), namespace, parent, factory);
+      } else if (TITLE.equals(qname)) {
+        Text.Type type = (Text.Type) objecttype;
+        element = (OMElement) new FOMText(type, qname.getLocalPart(), namespace, parent, factory);
+      } else if (UPDATED.equals(qname)) {
+        element = (OMElement) new FOMDateTime(qname.getLocalPart(), namespace, parent, factory);          
+      } else if (WORKSPACE.equals(qname)) {
+        element = (OMElement) new FOMWorkspace(qname.getLocalPart(), namespace, parent, factory);
+      } else if (COLLECTION.equals(qname)) {
+        element = (OMElement) new FOMCollection(qname.getLocalPart(), namespace, parent, factory);
+      } else if (NAME.equals(qname)) {
+        element = (OMElement) new FOMStringElement(qname.getLocalPart(), namespace, parent, factory);
+      } else if (EMAIL.equals(qname)) {
+        element = (OMElement) new FOMStringElement(qname.getLocalPart(), namespace, parent, factory);
+      } else if (URI.equals(qname)) {
+        element = (OMElement) new FOMIRI(qname.getLocalPart(), namespace, parent, factory);
+      } else if (CONTROL.equals(qname)) {
+        element = (OMElement) new FOMControl(qname.getLocalPart(), namespace, parent, factory);
+      } else if (DIV.equals(qname)) {
+        element = (OMElement) new FOMDiv(qname.getLocalPart(), namespace, parent, factory);
+      } else if (IN_REPLY_TO.equals(qname)) {
+        element = (OMElement) new FOMInReplyTo(qname.getLocalPart(), namespace, parent, factory);
+      } else if (THRTOTAL.equals(qname)) {
+        element = (OMElement) new FOMTotal(qname.getLocalPart(), namespace, parent, factory);
+      } else if (parent instanceof ExtensibleElement || parent instanceof Document) {
+        if (isSimpleExtension(qname)) {
+          element = (OMElement) new FOMStringElement(qname.getLocalPart(), namespace, parent, factory);
+        } else {
+          element = (OMElement) newExtensionElement(qname, parent);
+        }
+      }
+      return element;
+    }
+  
+  protected OMElement createElement(
+    QName qname, 
+    OMContainer parent, 
+    FOMBuilder builder) {
+    OMElement element = null;
+    if (FEED.equals(qname)) {
+      element = (OMElement) newFeed(qname, parent, builder);
+    } else if (SERVICE.equals(qname)) {
+      element = (OMElement) newService(qname, parent, builder);
+    } else if (ENTRY.equals(qname)) {
+      element = (OMElement) newEntry(qname, parent, builder);
+    } else if (AUTHOR.equals(qname)) {
+      element = (OMElement) newPerson(qname, parent, builder);
+    } else if (CATEGORY.equals(qname)) {
+      element = (OMElement) newCategory(qname, parent, builder);
+    } else if (CONTENT.equals(qname)) {
+      Content.Type type = builder.getContentType();
+      element = (OMElement) newContent(qname, type, parent, builder);
+    } else if (CONTRIBUTOR.equals(qname)) {
+      element = (OMElement) newPerson(qname, parent, builder);
+    } else if (GENERATOR.equals(qname)) {
+      element = (OMElement) newGenerator(qname, parent, builder);
+    } else if (ICON.equals(qname)) {
+      element = (OMElement) newURIElement(qname, parent, builder);
+    } else if (ID.equals(qname)) {
+      element = (OMElement) newID(qname, parent, builder);
+    } else if (LOGO.equals(qname)) {
+      element = (OMElement) newURIElement(qname, parent, builder);
+    } else if (LINK.equals(qname)) {
+      element = (OMElement) newLink(qname, parent, builder);
+    } else if (PUBLISHED.equals(qname)) {
+      element = (OMElement) newDateTimeElement(qname, parent, builder);
+    } else if (RIGHTS.equals(qname)) {
+      Text.Type type = builder.getTextType();
+      element = (OMElement) newText(qname, type, parent, builder);
+    } else if (SOURCE.equals(qname)) {
+      element = (OMElement) newSource(qname, parent, builder);
+    } else if (SUBTITLE.equals(qname)) {
+      Text.Type type = builder.getTextType();
+      element = (OMElement) newText(qname, type, parent, builder);
+    } else if (SUMMARY.equals(qname)) {
+      Text.Type type = builder.getTextType();
+      element = (OMElement) newText(qname, type, parent, builder);
+    } else if (TITLE.equals(qname)) {
+      Text.Type type = builder.getTextType();
+      element = (OMElement) newText(qname, type, parent, builder);
+    } else if (UPDATED.equals(qname)) {
+      element = (OMElement) newDateTimeElement(qname, parent, builder);          
+    } else if (WORKSPACE.equals(qname)) {
+      element = (OMElement) newWorkspace(qname, parent, builder);
+    } else if (COLLECTION.equals(qname)) {
+      element = (OMElement) newCollection(qname, parent, builder);
+    } else if (NAME.equals(qname)) {
+      element = (OMElement) newStringElement(qname, parent, builder);
+    } else if (EMAIL.equals(qname)) {
+      element = (OMElement) newStringElement(qname, parent, builder);
+    } else if (URI.equals(qname)) {
+      element = (OMElement) newURIElement(qname, parent, builder);
+    } else if (CONTROL.equals(qname)) {
+      element = (OMElement) newControl(qname, parent, builder);
+    } else if (DIV.equals(qname)) {
+      element = (OMElement) newDiv(qname, parent, builder);
+    } else if (IN_REPLY_TO.equals(qname)) {
+      element = (OMElement) newInReplyTo(qname, parent, builder);
+    } else if (THRTOTAL.equals(qname)) {
+      element = (OMElement) newTotal(qname, parent, builder);
+    } else if (parent instanceof ExtensibleElement || parent instanceof Document) {
+      if (isSimpleExtension(qname)) {
+        element = (OMElement) newStringElement(qname, parent, builder);
+      } else {
+        element = (OMElement) newExtensionElement(qname, parent, builder);
+      }
+    }
+    return element;
+  }
+
+  public void registerAsSimpleExtension(QName qname) {
+    if (simpleExtensions == null) 
+      simpleExtensions = new ArrayList<QName>();
+    if (!simpleExtensions.contains(qname)) simpleExtensions.add(qname);
+  }
+    
+  public boolean isSimpleExtension(QName qname) {
+    if (simpleExtensions == null) 
+      simpleExtensions = new ArrayList<QName>();
+    return simpleExtensions.contains(qname);
+  }
+
+}

Added: 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=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,126 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.parser.stax;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.Feed;
+import org.apache.abdera.model.Source;
+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;
+import org.apache.axiom.om.OMXMLParserWrapper;
+
+
+public class FOMFeed 
+  extends FOMSource 
+  implements Feed {
+  
+  private static final long serialVersionUID = 4552921210185524535L;
+  
+  public FOMFeed(
+    String name,
+    OMNamespace namespace,
+    OMContainer parent,
+    OMFactory factory)
+      throws OMException {
+    super(name, namespace, parent, factory);
+  }
+  
+  public FOMFeed(
+    QName qname,
+    OMContainer parent,
+    OMFactory factory) {
+      super(qname, parent, factory);
+  }
+  
+  public FOMFeed(
+    QName qname,
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) {
+      super(qname, parent, factory, builder);
+  }
+  
+  public FOMFeed(
+    OMContainer parent, 
+    OMFactory factory) 
+      throws OMException {
+    super(FEED, parent, factory);
+  }
+
+  public FOMFeed(
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(FEED, parent, factory, builder);
+  }
+  
+  public List<Entry> getEntries() {
+    return _getChildrenAsSet(ENTRY);
+  }
+
+  public void setEntries(List<Entry> entries) {
+    _setChildrenFromSet(ENTRY, entries);
+  }
+
+  public void addEntry(Entry entry) {
+    addChild((OMElement)entry);
+  }
+
+  public Entry addEntry() {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    return fomfactory.newEntry(this);
+  }
+  
+  public void insertEntry(Entry entry) {
+    OMElement el = getFirstChildWithName(ENTRY);
+    if (el == null) {
+      addEntry(entry);
+    } else {
+      el.insertSiblingBefore((OMElement)entry);
+    }
+  }
+  
+  public Entry insertEntry() {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Entry entry = fomfactory.newEntry((Feed)null);
+    insertEntry(entry);
+    return entry;
+  }
+
+  public Source getAsSource() {
+    FOMSource source = (FOMSource) ((FOMFactory)factory).newSource(null);
+    OMElement _source = source;
+    for (Iterator i = this.getChildElements(); i.hasNext();) {
+      OMElement _child = (OMElement) i.next();
+      if (!_child.getQName().equals(ENTRY)) {
+        _source.addChild(_child.cloneOMElement());
+      }
+    }
+    return source;
+  }
+ 
+}



Mime
View raw message