@Override
        public void startElement( String uri, String localName, String name,
                Attributes attributes ) throws SAXException {

            XElement element = new XElement( name );
            if( this.element == null ){
                this.element = element;
            }
            else{
                stack.getFirst().addElement( element );
            }
            
            stack.addFirst( element );
            
            // read the attributes
            for( int i = 0, n = attributes.getLength(); i<n; i++ ){
                XAttribute attr = new XAttribute( attributes.getQName( i ));
                attr.setString( attributes.getValue( i ));
                element.addAttribute( attr );
            }
        }