/** * {@inheritDoc} */ @Override public void setNodeValue(final String value) { setValue(value); }
/** * {@inheritDoc} */ @Override public void setNodeValue(final String value) { setValue(value); }
/** * Sets the value of this attribute. * @param value the new value of this attribute */ @JsxSetter public void setValue(final String value) { getDomNodeOrDie().setValue(value); }
/** * Sets the value of this attribute. * @param value the new value of this attribute */ @JsxSetter public void setValue(final String value) { getDomNodeOrDie().setValue(value); }
protected Map<String, DomAttr> getAttributesFor(final HtmlLink link) { final Map<String, DomAttr> map = new HashMap<String, DomAttr>(link.getAttributesMap()); final String src = map.get("href").getValue(); try { final File file = createFile(src, ".css"); FileUtils.writeStringToFile(file, link.getWebResponse(true).getContentAsString()); map.get("href").setValue(outputDir_.getName() + File.separatorChar + file.getName()); } catch (final Exception e) { throw new RuntimeException(e); } return map; }
protected Map<String, DomAttr> getAttributesFor(final HtmlLink link) { final Map<String, DomAttr> map = new HashMap<String, DomAttr>(link.getAttributesMap()); final String src = map.get("href").getValue(); try { final File file = createFile(src, ".css"); FileUtils.writeStringToFile(file, link.getWebResponse(true).getContentAsString()); map.get("href").setValue(outputDir_.getName() + File.separatorChar + file.getName()); } catch (final Exception e) { throw new RuntimeException(e); } return map; }
protected Map<String, DomAttr> getAttributesFor(final HtmlLink link) { final Map<String, DomAttr> map = new HashMap<String, DomAttr>(link.getAttributesMap()); final String src = map.get("href").getValue(); try { final File file = createFile(src, ".css"); FileUtils.writeStringToFile(file, link.getWebResponse(true).getContentAsString()); map.get("href").setValue(outputDir_.getName() + File.separatorChar + file.getName()); } catch (final Exception e) { throw new RuntimeException(e); } return map; }
protected Map<String, DomAttr> getAttributesFor(final HtmlScript script) { final Map<String, DomAttr> map = new HashMap<String, DomAttr>(script.getAttributesMap()); final String src = map.get("src").getValue(); try { final File file = createFile(src, ".js"); final String content = webClient_.<Page>getPage(src).getWebResponse().getContentAsString(); FileUtils.writeStringToFile(file, content); map.get("src").setValue(outputDir_.getName() + File.separatorChar + file.getName()); } catch (final Exception e) { throw new RuntimeException(e); } return map; }
protected Map<String, DomAttr> getAttributesFor(final HtmlLink link) throws IOException { final Map<String, DomAttr> map = createAttributesCopyWithClonedAttribute(link, "href"); final DomAttr hrefAttr = map.get("href"); if (hrefAttr != null && StringUtils.isNotBlank(hrefAttr.getValue())) { final String protocol = link.getWebRequest().getUrl().getProtocol(); if ("http".equals(protocol) || "https".equals(protocol)) { final File file = createFile(hrefAttr.getValue(), ".css"); FileUtils.writeStringToFile(file, link.getWebResponse(true, null).getContentAsString(), ISO_8859_1); hrefAttr.setValue(outputDir_.getName() + FILE_SEPARATOR + file.getName()); } } return map; }
protected Map<String, DomAttr> getAttributesFor(final HtmlLink link) throws IOException { final Map<String, DomAttr> map = createAttributesCopyWithClonedAttribute(link, "href"); final DomAttr hrefAttr = map.get("href"); if (hrefAttr != null && StringUtils.isNotBlank(hrefAttr.getValue())) { final String protocol = link.getWebRequest().getUrl().getProtocol(); if ("http".equals(protocol) || "https".equals(protocol)) { final File file = createFile(hrefAttr.getValue(), ".css"); FileUtils.writeStringToFile(file, link.getWebResponse(true, null).getContentAsString(), ISO_8859_1); hrefAttr.setValue(outputDir_.getName() + FILE_SEPARATOR + file.getName()); } } return map; }
protected Map<String, DomAttr> getAttributesFor(final HtmlImage image) throws IOException { final Map<String, DomAttr> map = createAttributesCopyWithClonedAttribute(image, "src"); final DomAttr srcAttr = map.get("src"); if (srcAttr != null && StringUtils.isNotBlank(srcAttr.getValue())) { final WebResponse response = image.getWebResponse(true); final File file = createFile(srcAttr.getValue(), "." + getSuffix(response)); try (InputStream inputStream = response.getContentAsStream()) { FileUtils.copyInputStreamToFile(inputStream, file); } final String valueOnFileSystem = outputDir_.getName() + FILE_SEPARATOR + file.getName(); srcAttr.setValue(valueOnFileSystem); // this is the clone attribute node, not the original one of the page } return map; }
/** * Sets the attribute value. * @param value the new attribute value */ @JsxSetter public void setValue(final String value) { getDomNodeOrDie().setValue(value); resetTextNode(); }
/** * Sets the attribute value. * @param value the new attribute value */ @JsxSetter public void setValue(final String value) { getDomNodeOrDie().setValue(value); resetTextNode(); }
private void updateAttribute(final String value) { final DomElement domNode = (DomElement) getDomNodeOrDie(); DomAttr attr = (DomAttr) domNode.getAttributes().getNamedItem(attributeName_); if (null == attr) { attr = domNode.getPage().createAttribute(attributeName_); domNode.setAttributeNode(attr); } attr.setValue(value); }
private void updateAttribute(final String value) { final DomElement domNode = (DomElement) getDomNodeOrDie(); DomAttr attr = (DomAttr) domNode.getAttributes().getNamedItem(attributeName_); if (null == attr) { attr = domNode.getPage().createAttribute(attributeName_); domNode.setAttributeNode(attr); } attr.setValue(value); }
/** * Detaches this attribute from the parent HTML element after caching the attribute value. */ public void detachFromParent() { final DomAttr domNode = getDomNodeOrDie(); final DomElement parent = (DomElement) domNode.getParentNode(); if (parent != null) { domNode.setValue(parent.getAttribute(getName())); } domNode.remove(); }
/** * Detaches this attribute from the parent HTML element after caching the attribute value. */ public void detachFromParent() { final DomAttr domNode = getDomNodeOrDie(); final DomElement parent = (DomElement) domNode.getParentNode(); if (parent != null) { domNode.setValue(parent.getAttribute(getName())); } domNode.remove(); }
/** * Detaches this attribute from the parent HTML element after caching the attribute value. */ public void detachFromParent() { final DomAttr domNode = getDomNodeOrDie(); final DomElement parent = (DomElement) domNode.getParentNode(); if (parent != null) { domNode.setValue(parent.getAttribute(getName())); } domNode.remove(); }
/** * Detaches this attribute from the parent HTML element after caching the attribute value. */ public void detachFromParent() { final DomAttr domNode = getDomNodeOrDie(); final DomElement parent = (DomElement) domNode.getParentNode(); if (parent != null) { domNode.setValue(parent.getAttribute(getName())); } domNode.remove(); }
/** * {@inheritDoc} */ @Override public void setTextContent(final String textContent) { final boolean mappedElement = HtmlPage.isMappedElement(getOwnerDocument(), getName()); if (mappedElement) { ((HtmlPage) getPage()).removeMappedElement((HtmlElement) getOwnerElement()); } setValue(textContent); if (mappedElement) { ((HtmlPage) getPage()).addMappedElement(getOwnerElement()); } } }