Java Code Examples for com.gargoylesoftware.htmlunit.html.DomNode#getHtmlPageOrNull()

The following examples show how to use com.gargoylesoftware.htmlunit.html.DomNode#getHtmlPageOrNull() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HTMLElement.java    From htmlunit with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public String getLocalName() {
    final DomNode domNode = getDomNodeOrDie();
    if (domNode.getHtmlPageOrNull() != null) {
        final String prefix = domNode.getPrefix();
        if (prefix != null) {
            // create string builder only if needed (performance)
            final StringBuilder localName = new StringBuilder(prefix.toLowerCase(Locale.ROOT))
                .append(':')
                .append(domNode.getLocalName().toLowerCase(Locale.ROOT));
            return localName.toString();
        }
        return domNode.getLocalName().toLowerCase(Locale.ROOT);
    }
    return domNode.getLocalName();
}
 
Example 2
Source File: HTMLElement.java    From HtmlUnit-Android with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public String getLocalName() {
    final DomNode domNode = getDomNodeOrDie();
    if (domNode.getHtmlPageOrNull() != null) {
        final String prefix = domNode.getPrefix();
        if (prefix != null) {
            // create string builder only if needed (performance)
            final StringBuilder localName = new StringBuilder(prefix.toLowerCase(Locale.ROOT));
            localName.append(':');
            localName.append(domNode.getLocalName().toLowerCase(Locale.ROOT));
            return localName.toString();
        }
        return domNode.getLocalName().toLowerCase(Locale.ROOT);
    }
    return domNode.getLocalName();
}
 
Example 3
Source File: HTMLElement.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public String getNodeName() {
    final DomNode domNode = getDomNodeOrDie();
    String nodeName = domNode.getNodeName();
    if (domNode.getHtmlPageOrNull() != null) {
        nodeName = nodeName.toUpperCase(Locale.ROOT);
    }
    return nodeName;
}
 
Example 4
Source File: XMLDOMNode.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the namespace prefix.
 * @return the namespace prefix
 */
@JsxGetter
public String getPrefix() {
    final DomNode domNode = getDomNodeOrDie();
    final String prefix = domNode.getPrefix();
    if (prefix == null || domNode.getHtmlPageOrNull() != null) {
        return "";
    }
    return prefix;
}
 
Example 5
Source File: HTMLElement.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public String getNodeName() {
    final DomNode domNode = getDomNodeOrDie();
    String nodeName = domNode.getNodeName();
    if (domNode.getHtmlPageOrNull() != null) {
        nodeName = nodeName.toUpperCase(Locale.ROOT);
    }
    return nodeName;
}
 
Example 6
Source File: XMLDOMNode.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the namespace prefix.
 * @return the namespace prefix
 */
@JsxGetter
public String getPrefix() {
    final DomNode domNode = getDomNodeOrDie();
    final String prefix = domNode.getPrefix();
    if (prefix == null || domNode.getHtmlPageOrNull() != null) {
        return "";
    }
    return prefix;
}