Java 类org.w3c.dom.html.HTMLHtmlElement 实例源码

项目:openid4java    文件:OpenID4JavaDOMParser.java   
public void ignoredStartElement(QName element, XMLAttributes attrs, Augmentations augs)
{
    if (element.rawname.equals("HEAD")
            && this.fCurrentNode instanceof HTMLHtmlElement)
    {
        this.ignoredHeadStartElement = true;
    }
}
项目:SplitCharater    文件:HTMLDocumentImpl.java   
public synchronized Element getDocumentElement()
{
    Node    html;
    Node    child;
    Node    next;

    // The document element is the top-level HTML element of the HTML
    // document. Only this element should exist at the top level.
    // If the HTML element is found, all other elements that might
    // precede it are placed inside the HTML element.
    html = getFirstChild();
    while ( html != null )
    {
        if ( html instanceof HTMLHtmlElement )
        {
            // REVISIT: [Q] Why is this code even here? In fact, the
            //          original code is in error because it will
            //          try to move ALL nodes to be children of the
            //          HTML tag. This is not the intended behavior
            //          for comments and processing instructions
            //          outside the root element; it will throw a
            //          hierarchy request error exception for doctype
            //          nodes; *and* this code shouldn't even be
            //          needed because the parser should never build
            //          a document that contains more than a single
            //          root element, anyway! -Ac
            /***
            synchronized ( html )
            {
                child = getFirstChild();
                while ( child != null && child != html )
                {
                    next = child.getNextSibling();
                    html.appendChild( child );
                    child = next;
                }
            }
            /***/
            return (HTMLElement) html;
        }
        html = html.getNextSibling();
    }

    // HTML element must exist. Create a new element and dump the
    // entire contents of the document into it in the same order as
    // they appear now.
    html = new HTMLHtmlElementImpl( this, "HTML" );
    child = getFirstChild();
    while ( child != null )
    {
        next = child.getNextSibling();
        html.appendChild( child );
        child = next;
    }
    appendChild( html );
    return (HTMLElement) html;
}