Package mf.org.apache.xerces.dom

Examples of mf.org.apache.xerces.dom.ElementImpl



    public synchronized void startElement( String tagName, AttributeList attrList )
        throws SAXException
    {
        ElementImpl elem;
        int         i;
       
  if ( tagName == null )
      throw new SAXException( "HTM004 Argument 'tagName' is null." );

  // If this is the root element, this is the time to create a new document,
  // because only know we know the document element name and namespace URI.
  if ( _document == null )
  {
      // No need to create the element explicitly.
      _document = new HTMLDocumentImpl();
      elem = (ElementImpl) _document.getDocumentElement();
      _current = elem;
      if ( _current == null )
    throw new SAXException( "HTM005 State error: Document.getDocumentElement returns null." );

      // Insert nodes (comment and PI) that appear before the root element.
      if ( _preRootNodes != null )
      {
    for ( i = _preRootNodes.size() ; i-- > 0 ; )
        _document.insertBefore( (Node) _preRootNodes.elementAt( i ), elem );
    _preRootNodes = null;
      }
      
  }
  else
  {
      // This is a state error, indicates that document has been parsed in full,
      // or that there are two root elements.
      if ( _current == null )
    throw new SAXException( "HTM006 State error: startElement called after end of document element." );
      elem = (ElementImpl) _document.createElement( tagName );
      _current.appendChild( elem );
      _current = elem;
  }

  // Add the attributes (specified and not-specified) to this element.
        if ( attrList != null )
        {
            for ( i = 0 ; i < attrList.getLength() ; ++ i )
                elem.setAttribute( attrList.getName( i ), attrList.getValue( i ) );
        }
    }
View Full Code Here

TOP

Related Classes of mf.org.apache.xerces.dom.ElementImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.