Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Evaluating an XPath from a xhtml document

LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest
Hi

I'm trying to use a XML data bank to extract an element from this XHTML web page:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml&quot; xml:lang="en">
<head><title /></head><body onload="document.forms[0].submit()">
<noscript>
<p>Since your browser does not support JavaScript, you must press the 'Continue' button once to proceed.</p></noscript>
<form action="http://test.com&quot; method="post">
<div><input type="hidden" name="field1" value="test" />
</div>
<noscript><div><input type="submit" value="Continue" /></div></noscript></form></body></html>


When I try to evaluate a xpath expression in the data bank, SOATest shows this error in the result box:
Cannot evaluate. Not a valid XML. Error message = "Server returned HTTP response code: 503 for URL: http://www.w3.org/TR/xhtml-modularization/...yle-1.mod"

This is caused by a 503 error returned by www.w3.org server. Error message indicates to go to http://w3.org/brief/MTE2 for more information. What they say there is that they return 503 errors when they get a lot of requests from a specific client.

In the capture there are 30 requests to download different files only for validating this XML. Is it possible to disable this validation so evaluation of a XPath works?

Thanks

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Hello Aosorio,

    Firstly, the XML Data Bank is designed to deal with XML, not XHTML. The error message stems from the fact that your XHTML is not valid XML because it includes a <!DOCTYPE ...> declaration. If you remove "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">&quot; from your XHTML, your code becomes valid XML and you should be able to use the XML Data Bank to extract values and evaluate Xpaths.

    -James