abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r555833 - in /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax: FOMContent.java FOMEntry.java
Date Fri, 13 Jul 2007 01:30:21 GMT
Author: jmsnell
Date: Thu Jul 12 18:30:20 2007
New Revision: 555833

URL: http://svn.apache.org/viewvc?view=rev&rev=555833
Log:
When using XML content, if the mime type has not been set on the atom:content, attempt to
get the mime type from any of the registered ExtensionFactory instances

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

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java?view=diff&rev=555833&r1=555832&r2=555833
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
Thu Jul 12 18:30:20 2007
@@ -130,10 +130,22 @@
     if (value != null) {
       if (this.getFirstElement() != null)
         this.getFirstElement().discard();
+      
+      MimeType mtype = this.getMimeType();
+      if (mtype == null) {
+        try {
+          String mt = getFactory().getMimeType(value);
+          if (mt != null) {
+            setMimeType(mt);
+            mtype = getMimeType();
+          }
+        } catch (MimeTypeParseException e) {}
+      }
+      
       if (value instanceof Div && !type.equals(Content.Type.XML)) 
         init(Content.Type.XHTML);
       else {
-        if (this.getMimeType() == null) {
+        if (mtype == null) {
           init(Content.Type.XML);
         }
       }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java?view=diff&rev=555833&r1=555832&r2=555833
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
Thu Jul 12 18:30:20 2007
@@ -219,7 +219,7 @@
    */
   public Content setContent(Element value) {
     FOMFactory factory = (FOMFactory) this.factory;
-    Content content = factory.newContent(Content.Type.XHTML);
+    Content content = factory.newContent();
     content.setValueElement(value);
     setContentElement(content);
     return content;



Mime
View raw message