abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r493109 - /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
Date Fri, 05 Jan 2007 18:04:21 GMT
Author: jmsnell
Date: Fri Jan  5 10:04:19 2007
New Revision: 493109

URL: http://svn.apache.org/viewvc?view=rev&rev=493109
Log:
For some unknown reason, not all Stax parsers work consistently with Axiom's getText method
implementation.
This overrides the axiom impl with one that will work consistently.  This currently duplicates
the behavior 
we see when using the Woodstox and Stax Ref impl parsers.

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

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java?view=diff&rev=493109&r1=493108&r2=493109
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
Fri Jan  5 10:04:19 2007
@@ -115,7 +115,7 @@
         builder,
         factory);
   }
-  
+    
   protected Element getWrapped(Element internal) {
     if (internal == null) return null;
     FOMFactory factory = (FOMFactory) getFactory();
@@ -435,6 +435,22 @@
     text.setValueElement(value);
     setTextElement(qname, text, false);
     return text;
+  }
+  
+  public String getText() {
+    StringBuffer buf = new StringBuffer();
+    Iterator i = getChildren();
+    while (i.hasNext()) {
+      OMNode node = (OMNode) i.next();
+      if (node instanceof OMText) {
+        buf.append(((OMText)node).getText());
+      } else {
+        // for now, let's ignore other elements. eventually, we 
+        // should make this work like innerHTML in browsers... stripping
+        // out all markup but leaving all text, even in child nodes
+      }
+    }
+    return buf.toString();
   }
   
   protected String getText(QName qname) {



Mime
View raw message