donaldp 01/04/14 17:25:20 Modified: src/java/org/apache/avalon/configuration SAXConfigurationHandler.java Log: Fixed SAXHandler so that content is given to correct element. Submitted By: Jason Harrop <[EMAIL PROTECTED]> Revision Changes Path 1.3 +13 -20 jakarta-avalon/src/java/org/apache/avalon/configuration/SAXConfigurationHandler.java Index: SAXConfigurationHandler.java =================================================================== RCS file: /home/cvs/jakarta-avalon/src/java/org/apache/avalon/configuration/SAXConfigurationHandler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SAXConfigurationHandler.java 2001/03/15 04:41:52 1.2 +++ SAXConfigurationHandler.java 2001/04/15 00:25:19 1.3 @@ -29,7 +29,6 @@ protected final ArrayList m_elements = new ArrayList(); protected Configuration m_configuration; protected Locator m_locator; - protected String m_value; public Configuration getConfiguration() { @@ -50,12 +49,22 @@ public void characters( final char[] ch, int start, int end ) throws SAXException { - final String value = (new String( ch, start, end )).trim(); + String value = (new String( ch, start, end )).trim(); if( value.equals( "" ) ) return; - if( null == m_value ) m_value = value; - else m_value += value; + final DefaultConfiguration configuration = + (DefaultConfiguration)m_elements.get( m_elements.size() - 1 ); + + if( 0 != configuration.getChildCount() ) + { + throw new SAXException( "Not allowed to define mixed content in the " + + "element " + configuration.getName() + " at " + + configuration.getLocation() ); + } + + value = configuration.getValue( "" ) + value; + configuration.setValue( value ); } public void endElement( final String namespaceURI, @@ -63,22 +72,6 @@ final String rawName ) throws SAXException { - if( null != m_value ) - { - final DefaultConfiguration configuration = - (DefaultConfiguration)m_elements.get( m_elements.size() - 1 ); - - if( 0 != configuration.getChildCount() ) - { - throw new SAXException( "Not allowed to define mixed content in the " + - "element " + configuration.getName() + " at " + - configuration.getLocation() ); - } - - configuration.setValue( m_value ); - m_value = null; - } - final int location = m_elements.size() - 1; final Object object = m_elements.remove( location ); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]