You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by do...@apache.org on 2001/04/15 02:25:20 UTC
cvs commit: jakarta-avalon/src/java/org/apache/avalon/configuration SAXConfigurationHandler.java
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 <ja...@xn.com.au>
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: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org