svn commit: r559282 - /xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java

[email protected]
Newsgroups gmane.text.xml.xindice.devel
Message-ID <[email protected]>
Author: natalia
Date: Tue Jul 24 19:14:15 2007
New Revision: 559282

URL: http://svn.apache.org/viewvc?view=rev&rev=559282
Log:
Fixes for nested content and empty elements

Modified:
    xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java?view=diff&rev=559282&r1=559281&r2=559282
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java Tue Jul 24 19:14:15 2007
@@ -588,19 +588,17 @@
         }
 
         public void endElement(String namespaceURI, String localName, String qName) {
-            if (info.sb != null) {
-                processEntry(new IndexPattern(symbols, info.symbolID), info.sb.toString(), info.pos, info.len);
-            }
+            StringBuffer sb = info.sb;
+            processEntry(new IndexPattern(symbols, info.symbolID), sb.toString(), info.pos, info.len);
+
             info = (StackInfo) stack.pop();
+            if (info != null) {
+                info.sb.append(sb);
+            }
         }
 
         public void characters(char ch[], int start, int length) {
-            String val = new String(ch).trim();
-            if (info.sb == null) {
-                info.sb = new StringBuffer(ch.length);
-            } else if (info.sb.length() > 0) {
-                info.sb.append(' ');
-            }
+            String val = new String(ch);
             info.sb.append(val);
         }
 
@@ -622,7 +620,7 @@
      */
     private class StackInfo {
         public short symbolID;
-        public StringBuffer sb = null;
+        public StringBuffer sb = new StringBuffer();
         public int pos = -1;
         public int len = -1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.