public void startElement()

in commons-digester3-core/src/main/java/org/apache/commons/digester3/NodeCreateRule.java [246:285]


        public void startElement( final String namespaceURI, final String localName, final String qName, final Attributes atts )
            throws SAXException
        {
            addTextIfPresent();

            try
            {
                final Node previousTop = top;
                if ( localName == null || localName.isEmpty() )
                {
                    top = doc.createElement( qName );
                }
                else
                {
                    top = doc.createElementNS( namespaceURI, localName );
                }
                for ( int i = 0; i < atts.getLength(); i++ )
                {
                    Attr attr = null;
                    if ( atts.getLocalName( i ) == null || atts.getLocalName( i ).isEmpty() )
                    {
                        attr = doc.createAttribute( atts.getQName( i ) );
                        attr.setNodeValue( atts.getValue( i ) );
                        ( (Element) top ).setAttributeNode( attr );
                    }
                    else
                    {
                        attr = doc.createAttributeNS( atts.getURI( i ), atts.getLocalName( i ) );
                        attr.setNodeValue( atts.getValue( i ) );
                        ( (Element) top ).setAttributeNodeNS( attr );
                    }
                }
                previousTop.appendChild( top );
                depth++;
            }
            catch ( final DOMException e )
            {
                throw new SAXException( e.getMessage() );
            }
        }