Package org.apache.xerces.dom

Examples of org.apache.xerces.dom.ElementImpl


        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

    }
    super.startElement(arg0, arg1, arg2);
    try
    {
      element = (Element)getProperty(CURRENT_ELEMENT_NODE);
      ElementImpl elementImpl = (ElementImpl)element;
      // Setting the user data with an identifier such as ElementLocation.KEY_NAME
      // may be a long term good idea. The setUserData method with no id is used
      // to support JVMs with alternate versions of Xerces.
      elementImpl.setUserData(new ElementLocation(locator.getLineNumber(), locator.getColumnNumber()));
    }
    // catch SAXNotRecognizedException and SAXNotSupportedException if can't get element
    catch (ClassCastException e)
    {
      //System.out.println(e);
View Full Code Here

    ElementLocation elementLocation = null;

    try
    {
      // See if the element object is an instanceof org.apache.xerces.dom.ElementImpl
      ElementImpl elementImpl = (ElementImpl) element;

      // If it is, then get the element location information
      elementLocation =
        (ElementLocation) elementImpl.getUserData();

      // Add it to the list
      this.wsdlElementList.addElement(wsdlElement, elementLocation);
    }
View Full Code Here

    XMLAttributes attributes,
    Augmentations augs)
    throws XNIException
  {
    Element element;
    ElementImpl elementImpl;

    // DEBUG:
    //System.err.println("1-line: " + locator.getLineNumber() + ", column: " + locator.getColumnNumber());

    super.startElement(qname, attributes, augs);

    // DEBUG:
    //System.err.println("2-line: " + locator.getLineNumber() + ", column: " + locator.getColumnNumber());   

    try
    {
      element = (Element) getProperty(CURRENT_ELEMENT_NODE);

      elementImpl = (ElementImpl) element;
      // Setting the user data with an identifier such as ElementLocation.KEY_NAME
      // may be a long term good idea. The setUserData method with no id is used
      // to support JVMs with alternate versions of Xerces.
      elementImpl.setUserData(new ElementLocation(locator.getLineNumber(), locator.getColumnNumber()));
    }
    catch (ClassCastException cce)
    {
    }
    catch (SAXNotSupportedException snse)
View Full Code Here

   */
  protected void setLocation(Object refObject, Element element)
  {
    try
    {
      ElementImpl elementImpl = (ElementImpl)element;
      ElementLocation elementLocation = (ElementLocation)elementImpl.getUserData();
      if (elementLocation != null)
      {

        elementLocations.put(
          refObject,
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


    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.