abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r419296 - /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
Date Wed, 05 Jul 2006 17:47:54 GMT
Author: jmsnell
Date: Wed Jul  5 10:47:54 2006
New Revision: 419296

URL: http://svn.apache.org/viewvc?rev=419296&view=rev
Log:
Div.setValue/Div.getValue now set/return the internal markup of the Div (it used to just return
the text content stripped of any markup

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

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java?rev=419296&r1=419295&r2=419296&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
Wed Jul  5 10:47:54 2006
@@ -18,6 +18,7 @@
 package org.apache.abdera.parser.stax;
 
 import java.io.ByteArrayOutputStream;
+import java.net.URI;
 import java.util.Iterator;
 
 import javax.xml.namespace.QName;
@@ -28,6 +29,7 @@
 import org.apache.abdera.model.Div;
 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;
@@ -114,14 +116,22 @@
   }
 
   public String getValue() {
-    return getText();
+    return getInternalValue();
   }
 
   public void setValue(String value) {
-    if (value != null)
-      setText(value);
-    else 
-      _removeAllChildren();
+    _removeAllChildren();
+    if (value != null) {
+      URI baseUri = null;
+      try {
+        baseUri = getResolvedBaseUri();
+      } catch (Exception e) {}
+      value = "<div xmlns=\"" + XHTML_NS + "\">" + value + "</div>";
+      OMElement element = (OMElement) _parse(value, baseUri);
+      for (Iterator i = element.getChildren(); i.hasNext();) {
+        this.addChild((OMNode)i.next());
+      }
+    }
   }
 
   protected String getInternalValue() {



Mime
View raw message