abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r417876 - in /incubator/abdera/java/trunk: core/src/main/java/org/apache/abdera/model/Content.java parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
Date Wed, 28 Jun 2006 21:21:53 GMT
Author: jmsnell
Date: Wed Jun 28 14:21:52 2006
New Revision: 417876

URL: http://svn.apache.org/viewvc?rev=417876&view=rev
Log:
Adding a getWrappedValue/setWrappedValue for returning/setting the XHTML content with the
wrapper div.  
For any other type of content, this just delegates to the regular getValue/setValue.

Modified:
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java?rev=417876&r1=417875&r2=417876&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java Wed
Jun 28 14:21:52 2006
@@ -224,4 +224,7 @@
    */
   void setDataHandler(DataHandler dataHandler);
 
+  String getWrappedValue();
+  
+  void setWrappedValue(String wrappedValue);
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java?rev=417876&r1=417875&r2=417876&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
Wed Jun 28 14:21:52 2006
@@ -257,4 +257,26 @@
     }
   }
 
+  public String getWrappedValue() {
+    if (Type.XHTML.equals(type)) {
+      return this.getFirstChildWithName(Constants.DIV).toString();
+    } else {
+      return getValue();
+    }
+  }
+
+  public void setWrappedValue(String wrappedValue) {
+    if (Type.XHTML.equals(type)) {
+      URI baseUri = null;
+      try {
+        baseUri = getResolvedBaseUri();
+      } catch (Exception e) {}
+      Element element = _parse(wrappedValue, baseUri);
+      if (element != null && element instanceof Div)
+        setValueElement((Div)element);
+    } else {
+      setValue(wrappedValue);
+    }
+  }
+
 }



Mime
View raw message