Package org.apache.xerces.dom

Examples of 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



    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


    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


    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

     * @param name DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    public Element newElementNode(Document document, String name) {
        return new ElementImpl((DocumentImpl) document, name);
    }
View Full Code Here


    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

     * @param name DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    public Element newElementNode(Document document, String name) {
        return new ElementImpl((DocumentImpl) document, name);
    }
View Full Code Here


    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

  public synchronized void startElement(String paramString, AttributeList paramAttributeList)
    throws SAXException
  {
    if (paramString == null)
      throw new SAXException("HTM004 Argument 'tagName' is null.");
    ElementImpl localElementImpl;
    int i;
    if (this._document == null)
    {
      this._document = new HTMLDocumentImpl();
      localElementImpl = (ElementImpl)this._document.getDocumentElement();
      this._current = localElementImpl;
      if (this._current == null)
        throw new SAXException("HTM005 State error: Document.getDocumentElement returns null.");
      if (this._preRootNodes != null)
      {
        i = this._preRootNodes.size();
        while (i-- > 0)
          this._document.insertBefore((Node)this._preRootNodes.elementAt(i), localElementImpl);
        this._preRootNodes = null;
      }
    }
    else
    {
      if (this._current == null)
        throw new SAXException("HTM006 State error: startElement called after end of document element.");
      localElementImpl = (ElementImpl)this._document.createElement(paramString);
      this._current.appendChild(localElementImpl);
      this._current = localElementImpl;
    }
    if (paramAttributeList != null)
      for (i = 0; i < paramAttributeList.getLength(); i++)
        localElementImpl.setAttribute(paramAttributeList.getName(i), paramAttributeList.getValue(i));
  }
View Full Code Here


    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 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.