/** * Recursively writes the XML data for the node tree starting at <code>node</code>. * * @param indent white space to indent child nodes * @param printWriter writer where child nodes are written */ @Override protected void printXml(final String indent, final PrintWriter printWriter) { String data = getData(); if (org.apache.commons.lang3.StringUtils.isNotBlank(data)) { printWriter.print(indent); if (!(getParentNode() instanceof HtmlStyle) || !data.startsWith("<!--") || !data.endsWith("-->")) { data = StringUtils.escapeXmlChars(data); } printWriter.print(data); printWriter.print("\r\n"); } printChildrenAsXml(indent, printWriter); }
final int crosshatchIndex = StringUtils.indexOf(spec, '#', startIndex, endIndex); final int colonIndex = StringUtils.indexOf(spec, ':', startIndex, endIndex); locationEndIndex = StringUtils.indexOf(spec, '/', locationStartIndex, endIndex); if (locationEndIndex >= 0) { startIndex = locationEndIndex; final int questionMarkIndex = StringUtils.indexOf(spec, '?', startIndex, endIndex); final int semicolonIndex = StringUtils.indexOf(spec, ';', startIndex, endIndex);
/** * Indicates if the command is supported. * @see <a href="http://msdn2.microsoft.com/en-us/library/ms536681.aspx">MSDN documentation</a> * @param cmd the command identifier * @return <code>true></code> if the command is supported */ public boolean jsxFunction_queryCommandSupported(final String cmd) { final boolean ff = getBrowserVersion().isFirefox(); final String mode = jsxGet_designMode(); if (!ff) { return containsCaseInsensitive(EXECUTE_CMDS_IE, cmd); } if (!"on".equals(mode)) { final String msg = "queryCommandSupported() called while document.designMode='" + mode + "'."; throw Context.reportRuntimeError(msg); } return containsCaseInsensitive(EXECUTE_CMDS_FF, cmd); }
/** * Searches for any color notation in the specified text. * @param text the string to search in * @return the string of the color if found, null otherwise */ private static String findColor(final String text) { Color tmpColor = com.gargoylesoftware.htmlunit.util.StringUtils.findColorRGB(text); if (tmpColor != null) { return com.gargoylesoftware.htmlunit.util.StringUtils.formatColor(tmpColor); } final String[] tokens = StringUtils.split(text, ' '); for (final String token : tokens) { if (isColorKeyword(token)) { return token; } tmpColor = com.gargoylesoftware.htmlunit.util.StringUtils.asColorHexadecimal(token); if (tmpColor != null) { return com.gargoylesoftware.htmlunit.util.StringUtils.formatColor(tmpColor); } } return null; }
s = com.gargoylesoftware.htmlunit.util.StringUtils.escapeXmlChars(s); final String value = attr.getValue().replaceAll("\"", """); final boolean quote = !ie || com.gargoylesoftware.htmlunit.util.StringUtils.containsWhitespace(value) || value.length() == 0 || (element instanceof HtmlAnchor && "href".equals(name));
/** * Sets the "opacity" style attribute. * @param opacity the new attribute */ public void jsxSet_opacity(final String opacity) { if (getBrowserVersion().isIE()) { setStyleAttribute("opacity", opacity); } else if (isFloat(opacity, true) || opacity.length() == 0) { setStyleAttribute("opacity", opacity.trim()); } }
/** * {@inheritDoc} */ @Override public String getXml() { final StringBuilder sb = new StringBuilder(getName()); sb.append('=').append('"'); sb.append(StringUtils.escapeXmlAttributeValue(getValue())); sb.append('"'); return sb.toString(); }
s = com.gargoylesoftware.htmlunit.util.StringUtils.escapeXmlChars(s); final String value = attr.getValue().replaceAll("\"", """); final boolean quote = !ie || com.gargoylesoftware.htmlunit.util.StringUtils.containsWhitespace(value) || value.length() == 0 || (element instanceof HtmlAnchor && "href".equals(name));
/** * Sets the "opacity" style attribute. * @param opacity the new attribute */ public void jsxSet_opacity(final String opacity) { if (getBrowserVersion().isIE()) { setStyleAttribute("opacity", opacity); } else if (isFloat(opacity, true) || opacity.length() == 0) { setStyleAttribute("opacity", opacity.trim()); } }
/** * Searches for any color notation in the specified text. * @param text the string to search in * @return the string of the color if found, null otherwise */ private static String findColor(final String text) { Color tmpColor = com.gargoylesoftware.htmlunit.util.StringUtils.findColorRGB(text); if (tmpColor != null) { return com.gargoylesoftware.htmlunit.util.StringUtils.formatColor(tmpColor); } final String[] tokens = StringUtils.split(text, ' '); for (final String token : tokens) { if (isColorKeyword(token)) { return token; } tmpColor = com.gargoylesoftware.htmlunit.util.StringUtils.asColorHexadecimal(token); if (tmpColor != null) { return com.gargoylesoftware.htmlunit.util.StringUtils.formatColor(tmpColor); } } return null; }
/** * {@inheritDoc} */ @Override public String getXml() { final StringBuilder sb = new StringBuilder(getName()); sb.append('=').append('"'); sb.append(StringUtils.escapeXmlAttributeValue(getValue())); sb.append('"'); return sb.toString(); }
/** * Recursively writes the XML data for the node tree starting at <code>node</code>. * * @param indent white space to indent child nodes * @param printWriter writer where child nodes are written */ @Override protected void printXml(final String indent, final PrintWriter printWriter) { String data = getData(); if (org.apache.commons.lang3.StringUtils.isNotBlank(data)) { printWriter.print(indent); if (!(getParentNode() instanceof HtmlStyle) || !data.startsWith("<!--") || !data.endsWith("-->")) { data = StringUtils.escapeXmlChars(data); } printWriter.print(data); printWriter.print("\r\n"); } printChildrenAsXml(indent, printWriter); }
s = com.gargoylesoftware.htmlunit.util.StringUtils.escapeXmlChars(s); final String value = attr.getValue().replaceAll("\"", """); final boolean quote = !ie || com.gargoylesoftware.htmlunit.util.StringUtils.containsWhitespace(value) || value.length() == 0 || (element instanceof HtmlAnchor && "href".equals(name));
/** * Indicates if the command can be successfully executed using <tt>execCommand</tt>, given * the current state of the document. * @param cmd the command identifier * @return <code>true</code> if the command can be successfully executed */ public boolean jsxFunction_queryCommandEnabled(final String cmd) { final boolean ff = getBrowserVersion().isFirefox(); final String mode = jsxGet_designMode(); if (!ff) { return containsCaseInsensitive(EXECUTE_CMDS_IE, cmd); } if (!"on".equals(mode)) { final String msg = "queryCommandEnabled() called while document.designMode='" + mode + "'."; throw Context.reportRuntimeError(msg); } return containsCaseInsensitive(EXECUTE_CMDS_FF, cmd); }
final int crosshatchIndex = StringUtils.indexOf(spec, '#', startIndex, endIndex); final int colonIndex = StringUtils.indexOf(spec, ':', startIndex, endIndex); locationEndIndex = StringUtils.indexOf(spec, '/', locationStartIndex, endIndex); if (locationEndIndex >= 0) { startIndex = locationEndIndex; final int questionMarkIndex = StringUtils.indexOf(spec, '?', startIndex, endIndex); final int semicolonIndex = StringUtils.indexOf(spec, ';', startIndex, endIndex);
/** * Sets the "opacity" style attribute. * @param opacity the new attribute */ public void jsxSet_opacity(final String opacity) { if (getBrowserVersion().isIE()) { setStyleAttribute("opacity", opacity); } else if (isFloat(opacity, true) || opacity.length() == 0) { setStyleAttribute("opacity", opacity.trim()); } }
/** * Prints the content between "<" and ">" (or "/>") in the output of the tag name * and its attributes in XML format. * @param printWriter the writer to print in */ protected void printOpeningTagContentAsXml(final PrintWriter printWriter) { printWriter.print(getTagName()); for (final Map.Entry<String, DomAttr> entry : attributes_.entrySet()) { printWriter.print(" "); printWriter.print(entry.getKey()); printWriter.print("=\""); printWriter.print(StringUtils.escapeXmlAttributeValue(entry.getValue().getNodeValue())); printWriter.print("\""); } }
/** * Recursively writes the XML data for the node tree starting at <code>node</code>. * * @param indent white space to indent child nodes * @param printWriter writer where child nodes are written */ @Override protected void printXml(final String indent, final PrintWriter printWriter) { if (getData().trim().length() != 0) { printWriter.print(indent); String data = getData(); if (!(getParentNode() instanceof HtmlStyle) || !data.startsWith("<!--") || !data.endsWith("-->")) { data = StringUtils.escapeXmlChars(data); } printWriter.println(data); } printChildrenAsXml(indent, printWriter); }
/** * Indicates if the command is supported. * @see <a href="http://msdn2.microsoft.com/en-us/library/ms536681.aspx">MSDN documentation</a> * @param cmd the command identifier * @return <code>true></code> if the command is supported */ public boolean jsxFunction_queryCommandSupported(final String cmd) { final boolean ff = getBrowserVersion().isFirefox(); final String mode = jsxGet_designMode(); if (!ff) { return containsCaseInsensitive(EXECUTE_CMDS_IE, cmd); } if (!"on".equals(mode)) { final String msg = "queryCommandSupported() called while document.designMode='" + mode + "'."; throw Context.reportRuntimeError(msg); } return containsCaseInsensitive(EXECUTE_CMDS_FF, cmd); }
final int crosshatchIndex = StringUtils.indexOf(spec, '#', startIndex, endIndex); final int colonIndex = StringUtils.indexOf(spec, ':', startIndex, endIndex); locationEndIndex = StringUtils.indexOf(spec, '/', locationStartIndex, endIndex); if (locationEndIndex >= 0) { startIndex = locationEndIndex; final int questionMarkIndex = StringUtils.indexOf(spec, '?', startIndex, endIndex); final int semicolonIndex = StringUtils.indexOf(spec, ';', startIndex, endIndex);