abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r414893 [8/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/FOMGenerator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,103 @@
+/*
+* 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 javax.xml.namespace.QName;
+
+import org.apache.abdera.model.Generator;
+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 FOMGenerator 
+  extends FOMStringElement 
+  implements Generator {
+  
+  private static final long serialVersionUID = -8441971633807437976L;
+
+  public FOMGenerator(
+      String name,
+      OMNamespace namespace,
+      OMContainer parent,
+      OMFactory factory)
+        throws OMException {
+      super(name, namespace, parent, factory);
+    }
+  
+  public FOMGenerator(
+    QName qname,
+    OMContainer parent,
+    OMFactory factory) {
+      super(qname, parent, factory);
+  }
+  
+  public FOMGenerator(
+    QName qname,
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) {
+      super(qname, parent, factory, builder);
+  }
+  
+  public FOMGenerator(
+    OMContainer parent, 
+    OMFactory factory) 
+      throws OMException {
+    super(GENERATOR, parent, factory);
+  }
+
+  public FOMGenerator(
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(GENERATOR, parent, factory, builder);
+  }
+  
+  public URI getUri() throws URISyntaxException {
+    String value = _getAttributeValue(AURI);
+    return (value != null) ? new URI(value) : null;
+}
+
+  public URI getResolvedUri() throws URISyntaxException {
+    return _resolve(getResolvedBaseUri(), getUri());
+  }
+  
+  public void setUri(URI uri) {
+    _setAttributeValue(AURI, (uri != null) ? uri.toString() : null);
+  }
+
+  public void setUri(String uri) throws URISyntaxException {
+    setUri((uri != null) ? new URI(uri) : null);
+  }
+  
+  public String getVersion() {
+    return _getAttributeValue(VERSION);
+  }
+
+  public void setVersion(String version) {
+    _setAttributeValue(VERSION, version);
+  }
+
+}

Added: 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=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,95 @@
+/*
+* 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 javax.xml.namespace.QName;
+
+import org.apache.abdera.model.IRI;
+import org.apache.abdera.util.URIHelper;
+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 FOMIRI 
+  extends FOMElement 
+  implements IRI {
+
+  private static final long serialVersionUID = -8434722753544181200L;
+
+  public FOMIRI(
+    String name,
+    OMNamespace namespace,
+    OMContainer parent,
+    OMFactory factory)
+      throws OMException {
+    super(name, namespace, parent, factory);
+  }
+  
+  public FOMIRI(
+    QName qname, 
+    OMContainer parent, 
+    OMFactory factory) 
+      throws OMException {
+    super(qname, parent, factory);
+  }
+
+  public FOMIRI(
+    QName qname, 
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(qname, parent, factory, builder);
+  }
+  
+  public URI getValue() throws URISyntaxException {
+    return _getUriValue(getText());
+  }
+
+  public void setValue(URI iri) {
+    if (iri != null)
+      setText(_getStringValue(iri));
+    else
+      _removeAllChildren();
+  }
+
+  public void setValue(String iri) throws URISyntaxException {
+    setValue((iri != null) ? new URI(iri) : null);
+  }
+  
+  public java.net.URI getResolvedValue() throws URISyntaxException {
+    return _resolve(getResolvedBaseUri(), getValue());
+  }
+
+  public void setNormalizedValue(URI uri) throws URISyntaxException {
+    if (uri != null)
+      setValue(URIHelper.normalize(uri));
+    else 
+      setValue((URI)null);
+  }
+
+  public void setNormalizedValue(String id) throws URISyntaxException {
+    setNormalizedValue((id != null)?new URI(id):null);
+  }
+}

Added: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMInReplyTo.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMInReplyTo.java?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMInReplyTo.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMInReplyTo.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,135 @@
+/*
+* 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 javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.model.InReplyTo;
+import org.apache.abdera.util.Constants;
+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 FOMInReplyTo 
+  extends FOMExtensionElement 
+  implements InReplyTo {
+
+  private static final long serialVersionUID = 7805672826003392693L;
+
+  public FOMInReplyTo(
+    String name,
+    OMNamespace namespace,
+    OMContainer parent,
+    OMFactory factory)
+      throws OMException {
+    super(name, namespace, parent, factory);
+  }
+  
+  public FOMInReplyTo(
+    QName qname,
+    OMContainer parent,
+    OMFactory factory) {
+      super(qname, parent, factory);
+  }
+  
+  public FOMInReplyTo( 
+    OMContainer parent, 
+    OMFactory factory)
+      throws OMException {
+    super(Constants.IN_REPLY_TO, parent, factory);
+  }
+
+  public FOMInReplyTo(
+    QName qname, 
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(qname, parent, factory, builder);
+  }
+
+  public URI getRef() throws URISyntaxException {
+    return _getUriValue(getAttributeValue(Constants.THRREF));
+  }
+
+  public void setRef(URI ref) {
+    this._setAttributeValue(Constants.THRREF, ref.toString());
+  }
+  
+  public void setRef(String ref) throws URISyntaxException {
+    setRef(new URI(ref));
+  }
+
+  public URI getResolvedHref() throws URISyntaxException {
+    return _resolve(getResolvedBaseUri(), getHref());
+  }
+  
+  public URI getHref() throws URISyntaxException {
+    return _getUriValue(getAttributeValue(HREF));
+  }
+
+  public void setHref(URI ref) {
+    this._setAttributeValue(HREF, ref.toString());
+  }
+
+  public void setHref(String ref) throws URISyntaxException {
+    setHref(new URI(ref));
+  }
+  
+  public MimeType getMimeType() throws MimeTypeParseException {
+    MimeType type = null;
+    String value = _getAttributeValue(TYPE);
+    if (value != null) {
+      type = new MimeType(value);
+    }
+    return type;
+  }
+
+  public void setMimeType(MimeType mimeType) {
+    this._setAttributeValue(TYPE, mimeType.toString());
+  }
+  
+  public void setMimeType(String mimeType) throws MimeTypeParseException {
+    setMimeType(new MimeType(mimeType));
+  }
+  
+  public URI getResolvedSource() throws URISyntaxException {
+    return _resolve(getResolvedBaseUri(), getSource());
+  }
+  
+  public URI getSource() throws URISyntaxException {
+    return _getUriValue(getAttributeValue(Constants.THRSOURCE));
+  }
+
+  public void setSource(URI source) {
+    this._setAttributeValue(Constants.THRSOURCE, source.toString());
+  }
+  
+  public void setSource(String source) throws URISyntaxException {
+    setSource(new URI(source));
+  }
+
+}

Added: 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=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,185 @@
+/*
+* 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.HashMap;
+import java.util.Map;
+
+import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.model.Link;
+import org.apache.abdera.util.URIHelper;
+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 FOMLink 
+  extends FOMExtensibleElement 
+  implements Link {
+
+  private static final long serialVersionUID = 2239772197929910635L;
+
+  public FOMLink(
+    String name,
+    OMNamespace namespace,
+    OMContainer parent,
+    OMFactory factory)
+      throws OMException {
+    super(name, namespace, parent, factory);
+  }
+  
+  public FOMLink( 
+    OMContainer parent, 
+    OMFactory factory)
+      throws OMException {
+    super(LINK, parent, factory);
+  }
+ 
+  public FOMLink( 
+    QName qname,
+    OMContainer parent, 
+    OMFactory factory)
+      throws OMException {
+    super(qname, parent, factory);
+  }
+   
+  public FOMLink( 
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder)
+      throws OMException {
+    super(LINK, parent, factory, builder);
+  }
+  
+  public FOMLink(
+    QName qname,
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder)
+      throws OMException {
+    super(qname, parent, factory, builder);
+  }
+  
+  public URI getHref() throws URISyntaxException {
+    return _getUriValue(_getAttributeValue(HREF));
+  }
+
+  public URI getResolvedHref() throws URISyntaxException {
+    return _resolve(getResolvedBaseUri(), getHref());
+  }
+  
+  public void setHref(URI href) {
+    _setAttributeValue(HREF, _getStringValue(href));
+  }
+
+  public void setHref(String href) throws URISyntaxException {
+    setHref((href != null) ? new URI(href) : null);
+  }
+  
+  public String getRel() {
+    return _getAttributeValue(REL);
+  }
+
+  public void setRel(String rel) {
+    _setAttributeValue(REL, rel);
+  }
+
+  public MimeType getMimeType() throws MimeTypeParseException {
+    String type = _getAttributeValue(TYPE);
+    return (type != null) ? new MimeType(type) : null;
+  }
+  
+  public void setMimeType(MimeType type) {
+    _setAttributeValue(TYPE, (type != null) ? type.toString() : null);
+  }
+
+  public void setMimeType(String type) throws MimeTypeParseException {
+    setMimeType(new MimeType(type));
+  }
+
+  public String getHrefLang() {
+    return _getAttributeValue(HREFLANG);
+  }
+
+  public void setHrefLang(String lang) {
+    _setAttributeValue(HREFLANG, lang);
+  }
+
+  public String getTitle() {
+    return _getAttributeValue(ATITLE);
+  }
+
+  public void setTitle(String title) {
+    _setAttributeValue(ATITLE, title);
+  }
+
+  public long getLength() {
+    String l = _getAttributeValue(LENGTH);
+    return (l != null) ? Long.valueOf(l) : -1;
+  }
+
+  public void setLength(long length) {
+    _setAttributeValue(LENGTH, (length >= 0) ? String.valueOf(length) : "0");
+  }
+
+  
+  private static final Map<String,String> REL_EQUIVS = new HashMap<String,String>();
+  static {
+    REL_EQUIVS.put(REL_ALTERNATE_IANA, REL_ALTERNATE);
+    REL_EQUIVS.put(REL_CURRENT_IANA, REL_CURRENT);
+    REL_EQUIVS.put(REL_ENCLOSURE_IANA, REL_ENCLOSURE);
+    REL_EQUIVS.put(REL_FIRST_IANA, REL_FIRST);
+    REL_EQUIVS.put(REL_LAST_IANA, REL_LAST);
+    REL_EQUIVS.put(REL_NEXT_IANA, REL_NEXT);
+    REL_EQUIVS.put(REL_PAYMENT_IANA, REL_PAYMENT);
+    REL_EQUIVS.put(REL_PREVIOUS_IANA, REL_PREVIOUS);
+    REL_EQUIVS.put(REL_RELATED_IANA, REL_RELATED);
+    REL_EQUIVS.put(REL_SELF_IANA, REL_SELF);
+    REL_EQUIVS.put(REL_VIA_IANA, REL_VIA);
+    REL_EQUIVS.put(REL_REPLIES_IANA, REL_REPLIES);
+    REL_EQUIVS.put(REL_LICENSE_IANA, REL_LICENSE);
+    REL_EQUIVS.put(REL_EDIT_IANA, REL_EDIT);
+    REL_EQUIVS.put(REL_EDIT_MEDIA_IANA, REL_EDIT_MEDIA);
+  }
+  public static final String getRelEquiv(String val) {
+    try {
+      val = URIHelper.normalize(val);
+    } catch (Exception e) {}
+    String rel = REL_EQUIVS.get(val);
+    return (rel != null) ? rel : val;
+  }
+
+  public String getValue() {
+    return getText();
+  }
+
+  public void setValue(String value) {
+    if (value != null)
+      setText(value);
+    else
+      _removeAllChildren();
+  }
+
+}

Added: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,67 @@
+/*
+* 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.io.InputStream;
+import java.net.URI;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Document;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.parser.ParseException;
+import org.apache.abdera.parser.Parser;
+import org.apache.abdera.parser.ParserOptions;
+import org.apache.abdera.util.AbstractParser;
+import org.apache.axiom.om.OMDocument;
+
+
+public class FOMParser 
+  extends AbstractParser 
+  implements Parser {
+
+  public <T extends Element>Document<T> parse(
+    InputStream in, 
+    URI base, 
+    ParserOptions options)
+      throws ParseException {
+    Document<T> document = null;
+    try {
+      FOMFactory factory = (options != null && options.getFactory() != null) ? (FOMFactory)options.getFactory() : null;
+      if (factory == null)
+        factory = (Factory.INSTANCE instanceof FOMFactory) ? (FOMFactory)Factory.INSTANCE : new FOMFactory();
+      
+      FOMBuilder builder = new FOMBuilder(factory, in, options);
+      document = builder.getFomDocument();
+      document.setBaseUri(base);
+      if (options.getCharset() != null) {
+        ((OMDocument)document).setCharsetEncoding(options.getCharset());
+      }
+    } catch (Exception e) {
+      if (!(e instanceof ParseException))
+        e = new ParseException(e);
+      throw (ParseException)e;
+    }
+    return document;
+  }
+
+  @Override
+  public ParserOptions getDefaultParserOptions() {
+    return new FOMParserOptions();
+  }
+
+}

Added: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserOptions.java?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserOptions.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserOptions.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,38 @@
+/*
+* 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.factory.Factory;
+import org.apache.abdera.util.AbstractParserOptions;
+
+
+public class FOMParserOptions
+  extends AbstractParserOptions {
+
+  protected void initFactory() {
+    factory = (Factory.INSTANCE instanceof FOMFactory) ? (FOMFactory)Factory.INSTANCE : new FOMFactory();
+  }
+  
+  protected void checkFactory(Factory factory) {
+    if (!(factory instanceof FOMFactory))
+      throw new FOMException(
+        "Only instances or subclasses of org.apache.abdera.axiom.FOMFactory may be used with this parser implementation");
+  }
+
+
+}

Added: 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=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.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.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.model.IRI;
+import org.apache.abdera.model.Person;
+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.OMXMLParserWrapper;
+
+
+public class FOMPerson
+  extends FOMExtensibleElement 
+  implements Person {
+
+  private static final long serialVersionUID = 2147684807662492625L; 
+  
+  public FOMPerson(
+    String name,
+    OMNamespace namespace,
+    OMContainer parent,
+    OMFactory factory)
+      throws OMException {
+    super(name, namespace, parent, factory);
+  }
+  
+  public FOMPerson(
+    QName qname, 
+    OMContainer parent, 
+    OMFactory factory) 
+      throws OMException {
+    super(qname, parent, factory);
+  }
+
+  public FOMPerson(
+    QName qname, 
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(qname, parent, factory, builder);
+    setBuilder(builder);
+    done = false;
+  }
+
+  public StringElement getNameElement() {
+    return (StringElement)getFirstChildWithName(NAME);
+  }
+
+  public void setNameElement(StringElement element) {
+    if (element != null)
+      _setChild(NAME, (OMElement)element);
+    else 
+      _removeElement(NAME, false);
+  }
+
+  public StringElement setName(String name) {
+    if (name != null) {
+      FOMFactory fomfactory = (FOMFactory) factory;
+      StringElement el = fomfactory.newName(name, null);
+      _setChild(NAME, (OMElement)el);
+      return el;
+    } else {
+      _removeElement(NAME, false);
+      return null;
+    }
+  }
+  
+  public String getName() {
+    StringElement name = getNameElement();
+    return (name != null) ? name.getValue() : null;
+  }
+
+  public StringElement getEmailElement() {
+    return (StringElement)getFirstChildWithName(EMAIL);
+  }
+
+  public void setEmailElement(StringElement element) {
+    if (element != null)
+      _setChild(EMAIL, (OMElement)element);
+    else 
+      _removeElement(EMAIL, false);
+  }
+
+  public StringElement setEmail(String email) {
+    if (email != null) {
+      FOMFactory fomfactory = (FOMFactory) factory;
+      StringElement el = fomfactory.newEmail(email, null);
+      _setChild(EMAIL, (OMElement)el);
+      return el;
+    } else {
+      _removeElement(EMAIL, false);
+      return null;
+    }
+  }
+  
+  public String getEmail() {
+    StringElement email = getEmailElement();
+    return (email != null) ? email.getValue() : null;
+  }
+
+  public IRI getUriElement() {
+    return (IRI)getFirstChildWithName(URI);
+  }
+
+  public void setUriElement(IRI uri) {
+    if (uri != null) 
+      _setChild(URI, (OMElement)uri);
+    else 
+      _removeElement(URI, false);
+  }
+
+  public IRI setUri(URI uri) {
+    if (uri != null) {
+      FOMFactory fomfactory = (FOMFactory) factory;
+      IRI el = fomfactory.newUri(uri, null);
+      _setChild(URI, (OMElement)el);
+      return el;
+    } else {
+      _removeElement(URI, false);
+      return null;
+    }
+  }
+  
+  public IRI setUri(String uri) throws URISyntaxException {
+    if (uri != null) {
+      FOMFactory fomfactory = (FOMFactory) factory;
+      IRI el = fomfactory.newUri(uri, null);
+      _setChild(URI, (OMElement)el);
+      return el;
+    } else {
+      _removeElement(URI, false);
+      return null;
+    }
+  }
+  
+  public URI getUri() throws URISyntaxException {
+    IRI iri = getUriElement();
+    return (iri != null) ? iri.getValue() : null;
+  }
+}

Added: 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=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,120 @@
+/*
+* 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.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.model.Collection;
+import org.apache.abdera.model.Service;
+import org.apache.abdera.model.Workspace;
+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 FOMService
+  extends FOMExtensibleElement 
+  implements Service {
+ 
+  private static final long serialVersionUID = 7982751563668891240L;
+
+  public FOMService(
+    String name,
+    OMNamespace namespace,
+    OMContainer parent,
+    OMFactory factory)
+      throws OMException {
+    super(name, namespace, parent, factory);
+  }
+  
+  public FOMService(
+    QName qname,
+    OMContainer parent,
+    OMFactory factory) {
+      super(qname, parent, factory);
+  }
+  
+  public FOMService(
+    QName qname,
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) {
+      super(qname, parent, factory, builder);
+  }
+  
+  public FOMService(
+    OMContainer parent, 
+    OMFactory factory) 
+      throws OMException {
+    super(SERVICE, parent, factory);
+  }
+
+  public FOMService(
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(SERVICE, parent, factory, builder);
+  }
+  
+  public List<Workspace> getWorkspaces() {
+    return _getChildrenAsSet(WORKSPACE);
+  }
+
+  public Workspace getWorkspace(String title) {
+    List<Workspace> workspaces = getWorkspaces();
+    Workspace workspace = null;
+    for (Workspace w : workspaces) {
+      if (w.getTitle().equals(title)) {
+        workspace = w;
+        break;
+      }
+    }
+    return workspace;
+  }
+
+  public void setWorkspaces(List<Workspace> workspaces) {
+    _setChildrenFromSet(WORKSPACE, workspaces);
+  }
+
+  public void addWorkspace(Workspace workspace) {
+    addChild((OMElement) workspace);
+  }
+  
+  public Workspace addWorkspace(String title) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Workspace workspace = fomfactory.newWorkspace(this);
+    workspace.setTitle(title);
+    return workspace;
+  }
+
+  public Collection getCollection(String workspace, String collection) {
+    Collection col = null;
+    Workspace w = getWorkspace(workspace);
+    if (w != null) {
+      col = w.getCollection(collection);
+    }
+    return col;
+  }
+
+}

Added: 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=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,697 @@
+/*
+* 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.MimeType;
+import javax.activation.MimeTypeParseException;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.model.Category;
+import org.apache.abdera.model.DateTime;
+import org.apache.abdera.model.Div;
+import org.apache.abdera.model.Generator;
+import org.apache.abdera.model.IRI;
+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.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 FOMSource
+  extends FOMExtensibleElement 
+  implements Source {
+
+  private static final long serialVersionUID = 9153127297531238021L; 
+  
+  public FOMSource(
+    String name,
+    OMNamespace namespace,
+    OMContainer parent,
+    OMFactory factory)
+      throws OMException {
+    super(name, namespace, parent, factory);
+  }
+  
+  public FOMSource( 
+    OMContainer parent, 
+    OMFactory factory) 
+      throws OMException {
+    super(SOURCE, parent, factory);
+  }
+
+  public FOMSource( 
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(SOURCE, parent, factory, builder);
+  }
+
+  public FOMSource( 
+    QName qname,
+    OMContainer parent, 
+    OMFactory factory) 
+      throws OMException {
+    super(qname, parent, factory);
+  }
+
+  public FOMSource(
+    QName qname,
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(qname, 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;
+    Person person = fomfactory.newAuthor(name, email, uri, this);
+    addAuthor(person);
+    return person;
+  }
+  
+  public Person addAuthor(String name, String email, URI uri) {
+    FOMFactory fomfactory = (FOMFactory) this.factory;
+    Person person = fomfactory.newAuthor(name, email, uri, this);
+    addAuthor(person);
+    return person;    
+  }
+
+  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);    
+  }
+  
+  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) ||
+            value.equalsIgnoreCase(Link.REL_ALTERNATE_IANA))) {
+        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);
+  }
+    
+  @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);
+  }
+
+  public Text getSubtitleElement() {
+    return getTextElement(SUBTITLE);
+  }
+
+  public void setSubtitleElement(Text text) {
+    setTextElement(SUBTITLE, text, false);
+  }
+
+  public Text setSubtitleAsText(String value) {
+    return setTextText(SUBTITLE, value);
+  }  
+  
+  public Text setSubtitleAsHtml(String value, URI baseUri) {
+    return setHtmlText(SUBTITLE, value, baseUri);
+  }
+  
+  public Text setSubtitleAsXhtml(String value, URI baseUri) {
+    return setXhtmlText(SUBTITLE, value, baseUri);
+  }
+  
+  public Text setSubtitleAsXhtml(Div value, URI baseUri) {
+    return setXhtmlText(SUBTITLE, value, baseUri);
+  }
+  
+  public String getSubtitle() {
+    return getText(SUBTITLE);
+  }
+
+  public Text getTitleElement() {
+    return getTextElement(TITLE);
+  }
+
+  public void setTitleElement(Text text) {
+    setTextElement(TITLE, text, 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 Generator getGenerator() {
+    return (Generator)getFirstChildWithName(GENERATOR);
+  }
+
+  public void setGenerator(Generator generator) {
+    if (generator != null)
+      _setChild(GENERATOR, (OMElement) generator);
+    else 
+      _removeElement(GENERATOR, false);
+  }
+
+  public Generator setGenerator(URI uri, String version, String value) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Generator generator = fomfactory.newGenerator(uri, version, value, this);
+    return generator;
+  }
+  
+  public Generator setGenerator(
+    String uri, 
+    String version, 
+    String value) 
+      throws URISyntaxException {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Generator generator = 
+      fomfactory.newGenerator(
+        (uri != null) ? new URI(uri):null, 
+        version, value, this);
+    return generator;    
+  }
+  
+  public IRI getIconElement() {
+    return (IRI)getFirstChildWithName(ICON);
+  }
+
+  public void setIconElement(IRI iri) {
+    if (iri != null)
+      _setChild(ICON, (OMElement) iri);
+    else 
+      _removeElement(ICON, false);
+  }
+
+  public IRI setIcon(String iri) throws URISyntaxException {
+    if (iri == null) {
+      _removeElement(ICON, false);
+      return null;
+    }
+    FOMFactory fomfactory = (FOMFactory) factory;
+    return fomfactory.newIcon(iri, this);
+  }
+  
+  public IRI setIcon(URI iri) {
+    if (iri == null) {
+      _removeElement(ICON, false);
+      return null;
+    }
+    FOMFactory fomfactory = (FOMFactory) factory;
+    return fomfactory.newIcon(iri, this);    
+  }
+  
+  public URI getIcon() throws URISyntaxException {
+    IRI iri = getIconElement();
+    return (iri != null) ? iri.getValue() : null;
+  }
+
+  public IRI getLogoElement() {
+    return (IRI)getFirstChildWithName(LOGO);
+  }
+
+  public void setLogoElement(IRI iri) {
+    if (iri != null)
+      _setChild(LOGO, (OMElement)iri);
+    else 
+      _removeElement(LOGO, false);
+  }
+
+  public IRI setLogo(String iri) throws URISyntaxException {
+    if (iri == null) {
+      _removeElement(LOGO, false);
+      return null;
+    }
+    FOMFactory fomfactory = (FOMFactory) factory;
+    return fomfactory.newLogo(iri, this);
+  }
+  
+  public IRI setLogo(URI iri) {
+    if (iri == null) {
+      _removeElement(LOGO, false);
+      return null;
+    }
+    FOMFactory fomfactory = (FOMFactory) factory;
+    return fomfactory.newLogo(iri, this);    
+  }
+  
+  public URI getLogo() throws URISyntaxException {
+    IRI iri = getLogoElement();
+    return (iri != null) ? iri.getValue() : null;
+  }
+  
+  public Link getLink(String rel) {
+    List<Link> self = getLinks(rel);
+    Link link = null;
+    if (self.size() > 0) link = self.get(0);
+    return link;
+  }
+  
+  public Link getSelfLink() {
+    return getLink(Link.REL_SELF);
+  }
+
+  public Link getAlternateLink() {
+    return getLink(Link.REL_ALTERNATE);
+  }
+
+  public Text.Type getRightsType() {
+    Text text = getRightsElement();
+    return (text != null) ? text.getTextType() : null;
+  }
+
+  public Text.Type getSubtitleType() {
+    Text text = getSubtitleElement();
+    return (text != null) ? text.getTextType() : null;
+  }
+
+  public Text.Type getTitleType() {
+    Text text = getTitleElement();
+    return (text != null) ? text.getTextType() : 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 setSubtitleAsHtml(String value, String baseUri) throws URISyntaxException {
+    return setSubtitleAsHtml(value, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Text setSubtitleAsXhtml(String value, String baseUri) throws URISyntaxException {
+    return setSubtitleAsXhtml(value, (baseUri != null) ? new URI(baseUri): null);
+  }
+
+  public Text setSubtitleAsXhtml(Div value, String baseUri) throws URISyntaxException {
+    return setSubtitleAsXhtml(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 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 setSubtitleAsHtml(String value) {
+    return setSubtitleAsHtml(value, (URI)null);
+  }
+
+  public Text setSubtitleAsXhtml(String value) {
+    return setSubtitleAsXhtml(value, (URI)null);
+  }
+
+  public Text setSubtitleAsXhtml(Div value) {
+    return setSubtitleAsXhtml(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);
+  }
+
+}

Added: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMStringElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMStringElement.java?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMStringElement.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMStringElement.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,73 @@
+/*
+* 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.StringElement;
+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 FOMStringElement 
+  extends FOMElement 
+  implements StringElement {
+
+  private static final long serialVersionUID = -4891944959471875583L;
+
+  public FOMStringElement(
+    String name,
+    OMNamespace namespace,
+    OMContainer parent,
+    OMFactory factory)
+      throws OMException {
+    super(name, namespace, parent, factory);
+  }
+  
+  public FOMStringElement(
+    QName qname, 
+    OMContainer parent, 
+    OMFactory factory) 
+      throws OMException {
+    super(qname, parent, factory);
+  }
+
+  public FOMStringElement(
+    QName qname, 
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(qname, parent, factory, builder);
+  }
+  
+  public String getValue() {
+    return getText();
+  }
+
+  public void setValue(String value) {
+    if (value != null) 
+      setText(value);
+    else 
+      _removeAllChildren();
+  }
+
+}

Added: 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=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,133 @@
+/*
+* 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 javax.xml.namespace.QName;
+
+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.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 FOMText 
+  extends FOMElement 
+  implements Text {
+
+  private static final long serialVersionUID = 5177795905116574120L;
+  protected Type type = null;
+  
+  public FOMText(
+    Type type,
+    String name,
+    OMNamespace namespace,
+    OMContainer parent,
+    OMFactory factory)
+      throws OMException {
+    super(name, namespace, parent, factory);
+    init(type);
+  }
+  
+  public FOMText(
+    Type type, 
+    QName qname, 
+    OMContainer parent, 
+    OMFactory factory)
+      throws OMException {
+    super(qname, parent, factory);
+    init(type);
+  }
+
+  public FOMText(
+    Type type, 
+    QName qname, 
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder)
+      throws OMException {
+    super(qname, parent, factory, builder);
+    init(type);
+  }
+  
+  private void init(Type type) {
+    this.type = type;
+    if (Type.TEXT.equals(type))
+      _setAttributeValue(TYPE, "text");
+    else if (Type.HTML.equals(type)) 
+      _setAttributeValue(TYPE, "html");
+    else if (Type.XHTML.equals(type))
+      _setAttributeValue(TYPE, "xhtml");
+  }
+  
+  public final Type getTextType() {
+    return type;
+  }
+
+  public Div getValueElement() {
+    return (Div)this.getFirstChildWithName(Constants.DIV);
+  }
+
+  public void setValueElement(Div value) {    
+    if (value != null) {
+      if (this.getFirstChildWithName(Constants.DIV) != null)
+        this.getFirstChildWithName(Constants.DIV).discard();
+      this.setFirstChild((OMElement)value);
+    } else
+      _removeAllChildren();
+  }
+
+  public String getValue() {
+    String val = null;
+    if (Type.TEXT.equals(type)) {
+      val = getText();
+    } else if (Type.HTML.equals(type)) {
+      val = getText();
+    } else if (Type.XHTML.equals(type)) {
+      val = this.getFirstChildWithName(Constants.DIV).toString();
+    }
+    return val;
+  }
+
+  public void setValue(String value) {
+    if (value != null) {
+      if (Type.TEXT.equals(type)) {
+        setText(value);
+      } else if (Type.HTML.equals(type)) {
+        setText(value);
+      } else if (Type.XHTML.equals(type)) {
+        URI baseUri = null;
+        try {
+          baseUri = getResolvedBaseUri();
+        } catch (Exception e) {}
+        Element element = _parse(value, baseUri);
+        if (element != null && element instanceof Div)
+          setValueElement((Div)element);
+      }
+    } else 
+      _removeAllChildren();
+  }
+
+}

Added: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMTotal.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMTotal.java?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMTotal.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMTotal.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,57 @@
+package org.apache.abdera.parser.stax;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.model.Total;
+import org.apache.abdera.util.Constants;
+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 FOMTotal extends FOMExtensionElement implements Total {
+
+  private static final long serialVersionUID = 241599118592917827L;
+
+  public FOMTotal(
+    String name,
+    OMNamespace namespace,
+    OMContainer parent,
+    OMFactory factory)
+      throws OMException {
+    super(name, namespace, parent, factory);
+  }
+  
+  public FOMTotal(
+    QName qname,
+    OMContainer parent,
+    OMFactory factory) {
+      super(qname, parent, factory);
+  }
+  
+  public FOMTotal( 
+    OMContainer parent, 
+    OMFactory factory)
+      throws OMException {
+    super(Constants.THRTOTAL, parent, factory);
+  }
+
+  public FOMTotal(
+    QName qname, 
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(qname, parent, factory, builder);
+  }
+  
+  public int getValue() {
+    return Integer.parseInt(getText());
+  }
+
+  public void setValue(int value) {
+    setText(String.valueOf(value));
+  }
+
+}

Added: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedContentTypeException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedContentTypeException.java?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedContentTypeException.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedContentTypeException.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,29 @@
+/*
+* 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;
+
+public class FOMUnsupportedContentTypeException 
+  extends FOMException {
+
+  private static final long serialVersionUID = 4156893310308105899L;
+
+  public FOMUnsupportedContentTypeException(String message) {
+    super("Unsupported Content Type: " + message);
+  }
+
+}

Added: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedTextTypeException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedTextTypeException.java?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedTextTypeException.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedTextTypeException.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,29 @@
+/*
+* 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;
+
+public class FOMUnsupportedTextTypeException 
+  extends FOMException {
+
+  private static final long serialVersionUID = 4156893310308105899L;
+
+  public FOMUnsupportedTextTypeException(String message) {
+    super("Unsupported Text Type: " + message);
+  }
+
+}

Added: 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=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.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.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.model.Collection;
+import org.apache.abdera.model.Workspace;
+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 FOMWorkspace
+  extends FOMExtensibleElement 
+  implements Workspace {
+
+  private static final long serialVersionUID = -421749865550509424L; 
+
+  public FOMWorkspace(
+    String name,
+    OMNamespace namespace,
+    OMContainer parent,
+    OMFactory factory)
+      throws OMException {
+    super(name, namespace, parent, factory);
+  }
+  
+  public FOMWorkspace(
+    QName qname,
+    OMContainer parent, 
+    OMFactory factory) 
+      throws OMException {
+    super(qname, parent, factory);
+  }
+
+  public FOMWorkspace(
+    QName qname,
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(qname, parent, factory, builder);
+  }
+  
+  public FOMWorkspace(
+    OMContainer parent, 
+    OMFactory factory) 
+      throws OMException {
+    super(WORKSPACE, parent, factory);
+  }
+
+  public FOMWorkspace(
+    OMContainer parent, 
+    OMFactory factory,
+    OMXMLParserWrapper builder) 
+      throws OMException {
+    super(WORKSPACE, parent, factory, builder);
+  }
+  
+  public String getTitle() {
+    return _getAttributeValue(ATITLE);
+  }
+
+  public void setTitle(String title) {
+    _setAttributeValue(ATITLE, title);
+  }
+
+  public List<Collection> getCollections() {
+    return _getChildrenAsSet(COLLECTION);
+  }
+
+  public Collection getCollection(String title) {
+    List<Collection> cols = getCollections();
+    Collection col = null;
+    for (Collection c : cols) {
+      if (c.getTitle().equals(title)) {
+        col = c;
+        break;
+      }
+    }
+    return col;
+  }
+
+  public void setCollection(List<Collection> collections) {
+    _setChildrenFromSet(COLLECTION, collections);
+  }
+
+  public void addCollection(Collection collection) {
+    addChild((OMElement)collection);
+  }
+
+  public Collection addCollection(String title, URI href) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Collection collection = fomfactory.newCollection(this);
+    collection.setTitle(title);
+    collection.setHref(href);
+    return collection;
+  }
+  
+  public Collection addCollection(String title, String href) throws URISyntaxException {
+    return addCollection(title, (href != null) ? new URI(href) : null);
+  }
+}

Added: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMXPath.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMXPath.java?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMXPath.java (added)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMXPath.java Fri Jun 16 13:10:47 2006
@@ -0,0 +1,128 @@
+/*
+* 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.List;
+import java.util.Map;
+
+import org.apache.abdera.model.Base;
+import org.apache.abdera.util.AbstractXPath;
+import org.apache.abdera.xpath.XPathException;
+import org.apache.axiom.om.xpath.DocumentNavigator;
+import org.jaxen.BaseXPath;
+import org.jaxen.JaxenException;
+import org.jaxen.XPath;
+
+public class FOMXPath extends AbstractXPath {
+
+  public static XPath getXPath(String path) throws JaxenException {
+    return getXPath(path, null);
+  }
+  
+  public static XPath getXPath(
+    String path, 
+    Map<String,String> namespaces) 
+      throws JaxenException {
+    DocumentNavigator nav = new DocumentNavigator();
+    XPath contextpath = new BaseXPath(path, nav);
+    if (namespaces != null) {
+      for (String key : namespaces.keySet()) {
+        String value = namespaces.get(key);
+        contextpath.addNamespace(key, value);
+      }
+    }
+    
+    return contextpath;
+  }
+
+  public List selectNodes(
+    String path, 
+    Base base, 
+    Map<String,String> namespaces) throws XPathException {
+    try {
+      XPath xpath = getXPath(path, namespaces);
+      return xpath.selectNodes(base);
+    } catch (JaxenException e) {
+      throw new XPathException(e);
+    }
+  }
+  
+  public Object selectSingleNode(
+    String path, 
+    Base base, 
+    Map<String,String> namespaces) throws XPathException {
+    try {
+      XPath xpath = getXPath(path, namespaces);
+      return xpath.selectSingleNode(base);
+    } catch (JaxenException e) {
+      throw new XPathException(e);
+    }
+  }
+  
+  public Object evaluate(
+    String path, 
+    Base base, 
+    Map<String,String> namespaces) throws XPathException {
+    try {
+      XPath xpath = getXPath(path, namespaces);
+      return xpath.evaluate(base);
+    } catch (JaxenException e) {
+      throw new XPathException(e);
+    }
+  }
+  
+  public String valueOf(
+    String path, 
+    Base base, 
+    Map<String,String> namespaces) 
+      throws XPathException {
+    try {
+      XPath xpath = getXPath(path, namespaces);
+      return xpath.stringValueOf(base);
+    } catch (JaxenException e) {
+      throw new XPathException(e);
+    }
+  }
+  
+  public boolean isTrue(
+    String path, 
+    Base base, 
+    Map<String,String> namespaces) 
+      throws XPathException {
+    try {
+      XPath xpath = getXPath(path, namespaces);
+      return xpath.booleanValueOf(base);
+    } catch (JaxenException e) {
+      throw new XPathException(e);
+    }
+  }
+
+  public Number numericValueOf(
+    String path, 
+    Base base, 
+    Map<String,String>namespaces) 
+      throws XPathException {
+    try {
+      XPath xpath = getXPath(path, namespaces);
+      return xpath.numberValueOf(base);
+    } catch (JaxenException e) {
+      throw new XPathException(e);
+    }
+  }
+  
+}

Added: incubator/abdera/java/trunk/parser/src/test/java/complete.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/java/complete.xml?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/java/complete.xml (added)
+++ incubator/abdera/java/trunk/parser/src/test/java/complete.xml Fri Jun 16 13:10:47 2006
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<feed xmlns="http://www.w3.org/2005/Atom" 
+      xmlns:fh="http://purl.org/syndication/history/1.0">
+  <fh:complete />
+</feed>
\ No newline at end of file

Added: incubator/abdera/java/trunk/parser/src/test/java/entry.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/java/entry.xml?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/java/entry.xml (added)
+++ incubator/abdera/java/trunk/parser/src/test/java/entry.xml Fri Jun 16 13:10:47 2006
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<entry xmlns="http://www.w3.org/2005/Atom">
+<title>Atom-Powered Robots Run Amok</title>
+<link href="http://example.org/2003/12/13/atom03"/>
+<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
+<updated>2003-12-13T18:30:02Z</updated>
+<summary>Some text.</summary>
+</entry>
\ No newline at end of file

Added: incubator/abdera/java/trunk/parser/src/test/java/feed.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/java/feed.xml?rev=414893&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/java/feed.xml (added)
+++ incubator/abdera/java/trunk/parser/src/test/java/feed.xml Fri Jun 16 13:10:47 2006
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+<title>Example Feed</title>
+<link href="http://example.org/"/>
+<updated>2003-12-13T18:30:02Z</updated>
+<author>
+<name>John Doe</name>
+</author>
+<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
+<entry>
+<title>Atom-Powered Robots Run Amok</title>
+<link href="http://example.org/2003/12/13/atom03"/>
+<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
+<updated>2003-12-13T18:30:02Z</updated>
+<summary>Some text.</summary>
+</entry>
+</feed>
\ No newline at end of file



Mime
View raw message