Why is trimming done in characters() rather than endElement()?  (This is a
response to the problems with whitespace in general, and not a response to
Greg's question or patch.)  Just because XML *allows* some whitespace to be
ignored, doesn't mean it should be done in such an unpredictable way.  (I'll
concede that it is probably predictable by counting characters, but this fact is
not obvious to someone who hasn't read parts of the code, or possibly some
spec/API I haven't read.)

For Greg's question about having a special attribute set, see the xml:space
attribute described in the XML spec:
http://www.w3.org/TR/REC-xml#sec-white-space ... at least, that's the most
recent spec I could find.  I am assuming that our SAXConfigurationHandler is the
"application" as described in that document, even though it feels like a
processor from my end. :)

Anyway, if there's a standard hint, might as well use it.

To address the issue raised in my first paragraph, I made the modification shown
in the attached diff.  That said, I suspect I don't know the code well enough to
know whether it's an appropriate change.

Laura
an xml newbie who recently learned how to use jswat (guess why? :)
--- org/apache/avalon/framework/configuration/SAXConfigurationHandler.old       Mon 
Apr 29 09:28:12 2002
+++ org/apache/avalon/framework/configuration/SAXConfigurationHandler.java      Mon 
+Apr 29 11:21:09 2002
@@ -26,7 +26,7 @@
     implements ErrorHandler
 {
     private final ArrayList              m_elements        = new ArrayList();
-    private Configuration                m_configuration;
+    private DefaultConfiguration         m_configuration;
     private Locator                      m_locator;
 
     public Configuration getConfiguration()
@@ -48,7 +48,7 @@
     public void characters( final char[] ch, int start, int end )
         throws SAXException
     {
-        String value = (new String( ch, start, end )).trim();
+        String value = new String( ch, start, end );
 
         if( value.equals( "" ) )
         {
@@ -79,7 +79,9 @@
 
         if( 0 == location )
         {
-            m_configuration = (Configuration)object;
+            m_configuration = (DefaultConfiguration)object;
+            String value = m_configuration.getValue( "" ).trim();
+            m_configuration.setValue( value );
         }
     }
 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to