本文整理了Java中com.gargoylesoftware.htmlunit.xml.XmlPage.<init>()
方法的一些代码示例,展示了XmlPage.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlPage.<init>()
方法的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.xml.XmlPage
类名称:XmlPage
方法名:<init>
[英]Creates an instance. A warning is logged if an exception is thrown while parsing the XML content (for instance when the content is not a valid XML and can't be parsed).
[中]创建一个实例。如果在解析XML内容时引发异常(例如,当内容不是有效的XML且无法解析时),将记录警告。
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* Creates an SgmlPage for this WebResponse.
*
* @param webResponse the page's source
* @param webWindow the WebWindow to place the TextPage in
* @return the newly created TextPage
* @throws IOException if the page could not be created
*/
protected SgmlPage createXmlPage(final WebResponse webResponse, final WebWindow webWindow) throws IOException {
final SgmlPage page = new XmlPage(webResponse, webWindow);
webWindow.setEnclosedPage(page);
return page;
}
代码示例来源:origin: org.jenkins-ci/htmlunit
/**
* Creates an XmlPage for this WebResponse.
*
* @param webResponse the page's source
* @param webWindow the WebWindow to place the TextPage in
* @return the newly created TextPage
* @throws IOException if the page could not be created
*/
protected XmlPage createXmlPage(final WebResponse webResponse, final WebWindow webWindow) throws IOException {
final XmlPage newPage = new XmlPage(webResponse, webWindow);
webWindow.setEnclosedPage(newPage);
return newPage;
}
代码示例来源:origin: org.jvnet.hudson/htmlunit
/**
* Creates an XmlPage for this WebResponse.
*
* @param webResponse the page's source
* @param webWindow the WebWindow to place the TextPage in
* @return the newly created TextPage
* @throws IOException if the page could not be created
*/
protected XmlPage createXmlPage(final WebResponse webResponse, final WebWindow webWindow) throws IOException {
final XmlPage newPage = new XmlPage(webResponse, webWindow);
webWindow.setEnclosedPage(newPage);
return newPage;
}
代码示例来源:origin: net.disy.htmlunit/htmlunit
/**
* Creates an XmlPage for this WebResponse.
*
* @param webResponse the page's source
* @param webWindow the WebWindow to place the TextPage in
* @return the newly created TextPage
* @throws IOException if the page could not be created
*/
protected XmlPage createXmlPage(final WebResponse webResponse, final WebWindow webWindow) throws IOException {
final XmlPage newPage = new XmlPage(webResponse, webWindow);
webWindow.setEnclosedPage(newPage);
return newPage;
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* Creates an SgmlPage for this WebResponse.
*
* @param webResponse the page's source
* @param webWindow the WebWindow to place the TextPage in
* @return the newly created TextPage
* @throws IOException if the page could not be created
*/
protected SgmlPage createXmlPage(final WebResponse webResponse, final WebWindow webWindow) throws IOException {
final SgmlPage page = new XmlPage(webResponse, webWindow);
webWindow.setEnclosedPage(page);
return page;
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* Creates a new instance, with associated XmlPage.
* @param enclosingWindow the window
*/
public XMLDocument(final WebWindow enclosingWindow) {
if (enclosingWindow != null) {
try {
final XmlPage page = new XmlPage((WebResponse) null, enclosingWindow);
setDomNode(page);
}
catch (final IOException e) {
throw Context.reportRuntimeError("IOException: " + e);
}
}
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* Creates a new instance, with associated {@link XmlPage}.
* @param enclosingWindow the window
*/
public XMLDOMDocument(final WebWindow enclosingWindow) {
if (enclosingWindow != null) {
try {
final XmlPage page = new XmlPage((WebResponse) null, enclosingWindow, true, false);
setDomNode(page);
}
catch (final IOException e) {
throw Context.reportRuntimeError("IOException: " + e);
}
}
}
代码示例来源:origin: net.disy.htmlunit/htmlunit
/**
* Creates a new instance, with associated XmlPage.
* @param enclosingWindow the window
*/
public XMLDocument(final WebWindow enclosingWindow) {
if (enclosingWindow != null) {
try {
final XmlPage page = new XmlPage((WebResponse) null, enclosingWindow);
setDomNode(page);
}
catch (final IOException e) {
throw Context.reportRuntimeError("IOException: " + e);
}
}
}
代码示例来源:origin: org.jvnet.hudson/htmlunit
/**
* Creates a new instance, with associated XmlPage.
* @param enclosingWindow the window
*/
public XMLDocument(final WebWindow enclosingWindow) {
if (enclosingWindow != null) {
try {
final XmlPage page = new XmlPage((WebResponse) null, enclosingWindow);
setDomNode(page);
}
catch (final IOException e) {
throw Context.reportRuntimeError("IOException: " + e);
}
}
}
代码示例来源:origin: org.jenkins-ci/htmlunit
/**
* Creates a new instance, with associated XmlPage.
* @param enclosingWindow the window
*/
public XMLDocument(final WebWindow enclosingWindow) {
if (enclosingWindow != null) {
try {
final XmlPage page = new XmlPage((WebResponse) null, enclosingWindow);
setDomNode(page);
}
catch (final IOException e) {
throw Context.reportRuntimeError("IOException: " + e);
}
}
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* Creates a new instance, with associated {@link XmlPage}.
* @param enclosingWindow the window
*/
public XMLDOMDocument(final WebWindow enclosingWindow) {
if (enclosingWindow != null) {
try {
final XmlPage page = new XmlPage((WebResponse) null, enclosingWindow, true, false);
setDomNode(page);
}
catch (final IOException e) {
throw Context.reportRuntimeError("IOException: " + e);
}
}
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* Creates a new instance, with associated XmlPage.
* @param enclosingWindow the window
*/
public XMLDocument(final WebWindow enclosingWindow) {
if (enclosingWindow != null) {
try {
final XmlPage page = new XmlPage((WebResponse) null, enclosingWindow);
setDomNode(page);
}
catch (final IOException e) {
throw Context.reportRuntimeError("IOException: " + e);
}
}
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
private static XmlPage createParserErrorXmlPage(final String message, final WebWindow webWindow)
throws IOException {
final String xml = "<parsererror xmlns=\"http://www.mozilla.org/newlayout/xml/parsererror.xml\">\n"
+ message + "\n"
+ "<sourcetext></sourcetext>\n"
+ "</parsererror>";
final WebResponse webResponse = new StringWebResponse(xml, webWindow.getEnclosedPage().getUrl());
return new XmlPage(webResponse, webWindow, false);
}
代码示例来源:origin: HtmlUnit/htmlunit
private static XmlPage createParserErrorXmlPage(final String message, final WebWindow webWindow)
throws IOException {
final String xml = "<parsererror xmlns=\"http://www.mozilla.org/newlayout/xml/parsererror.xml\">\n"
+ message + "\n"
+ "<sourcetext></sourcetext>\n"
+ "</parsererror>";
final WebResponse webResponse = new StringWebResponse(xml, webWindow.getEnclosedPage().getUrl());
return new XmlPage(webResponse, webWindow, false);
}
代码示例来源:origin: org.jenkins-ci/htmlunit
/**
* Loads an XML document using the supplied string.
*
* @param strXML A string containing the XML string to load into this XML document object
* This string can contain an entire XML document or a well-formed fragment.
* @return true if the load succeeded; false if the load failed
*/
public boolean jsxFunction_loadXML(final String strXML) {
try {
final List<NameValuePair> emptyList = Collections.emptyList();
final WebResponseData data = new WebResponseData(strXML.getBytes(), HttpStatus.SC_OK, null, emptyList);
final WebResponse webResponse = new WebResponseImpl(data, (URL) null, (HttpMethod) null, 0);
final XmlPage page = new XmlPage(webResponse, getWindow().getWebWindow());
setDomNode(page);
return true;
}
catch (final IOException e) {
LOG.debug("Error parsing XML\n" + strXML, e);
return false;
}
}
代码示例来源:origin: net.disy.htmlunit/htmlunit
/**
* Loads an XML document using the supplied string.
*
* @param strXML A string containing the XML string to load into this XML document object
* This string can contain an entire XML document or a well-formed fragment.
* @return true if the load succeeded; false if the load failed
*/
public boolean jsxFunction_loadXML(final String strXML) {
try {
final List<NameValuePair> emptyList = Collections.emptyList();
final WebResponseData data = new WebResponseData(strXML.getBytes(), HttpStatus.SC_OK, null, emptyList);
final WebResponse webResponse = new WebResponseImpl(data, (URL) null, (HttpMethod) null, 0);
final XmlPage page = new XmlPage(webResponse, getWindow().getWebWindow());
setDomNode(page);
return true;
}
catch (final IOException e) {
LOG.debug("Error parsing XML\n" + strXML, e);
return false;
}
}
代码示例来源:origin: org.jvnet.hudson/htmlunit
/**
* Loads an XML document using the supplied string.
*
* @param strXML A string containing the XML string to load into this XML document object
* This string can contain an entire XML document or a well-formed fragment.
* @return true if the load succeeded; false if the load failed
*/
public boolean jsxFunction_loadXML(final String strXML) {
try {
final List<NameValuePair> emptyList = Collections.emptyList();
final WebResponseData data = new WebResponseData(strXML.getBytes(), HttpStatus.SC_OK, null, emptyList);
final WebResponse webResponse = new WebResponseImpl(data, (URL) null, (HttpMethod) null, 0);
final XmlPage page = new XmlPage(webResponse, getWindow().getWebWindow());
setDomNode(page);
return true;
}
catch (final IOException e) {
LOG.debug("Error parsing XML\n" + strXML, e);
return false;
}
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* Loads an XML document from the specified location.
*
* @param xmlSource a string containing a URL that specifies the location of the XML file
* @return true if the load succeeded; false if the load failed
*/
@JsxFunction(FF)
public boolean load(final String xmlSource) {
if (async_) {
if (LOG.isDebugEnabled()) {
LOG.debug("XMLDocument.load(): 'async' is true, currently treated as false.");
}
}
try {
final WebWindow ww = getWindow().getWebWindow();
final HtmlPage htmlPage = (HtmlPage) ww.getEnclosedPage();
final WebRequest request = new WebRequest(htmlPage.getFullyQualifiedUrl(xmlSource));
final WebResponse webResponse = ww.getWebClient().loadWebResponse(request);
final XmlPage page = new XmlPage(webResponse, ww, false);
setDomNode(page);
return true;
}
catch (final IOException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Error parsing XML from '" + xmlSource + "'", e);
}
return false;
}
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* Transforms the node source applying the stylesheet given by the importStylesheet() function.
* The owner document of the output node owns the returned document fragment.
*
* @param source the node to be transformed
* @return the result of the transformation
*/
@JsxFunction
public XMLDocument transformToDocument(final Node source) {
final XMLDocument doc = new XMLDocument();
doc.setPrototype(getPrototype(doc.getClass()));
doc.setParentScope(getParentScope());
final Object transformResult = transform(source);
final org.w3c.dom.Node node;
if (transformResult instanceof org.w3c.dom.Node) {
final org.w3c.dom.Node transformedDoc = (org.w3c.dom.Node) transformResult;
node = transformedDoc.getFirstChild();
}
else {
node = null;
}
final XmlPage page = new XmlPage(node, getWindow().getWebWindow());
doc.setDomNode(page);
return doc;
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* Transforms the node source applying the stylesheet given by the importStylesheet() function.
* The owner document of the output node owns the returned document fragment.
*
* @param source the node to be transformed
* @return the result of the transformation
*/
@JsxFunction
public XMLDocument transformToDocument(final Node source) {
final XMLDocument doc = new XMLDocument();
doc.setPrototype(getPrototype(doc.getClass()));
doc.setParentScope(getParentScope());
final Object transformResult = transform(source);
final org.w3c.dom.Node node;
if (transformResult instanceof org.w3c.dom.Node) {
final org.w3c.dom.Node transformedDoc = (org.w3c.dom.Node) transformResult;
node = transformedDoc.getFirstChild();
}
else {
node = null;
}
final XmlPage page = new XmlPage(node, getWindow().getWebWindow());
doc.setDomNode(page);
return doc;
}
内容来源于网络,如有侵权,请联系作者删除!