1

I want to read "Value new" column changes in my html file and display element value by using Xpath(4ex:/html/body/table/tbody/tr[1]/td[6] ) in Oracle form, may I get suggestions for that?

My output in oracle form should be:

0015: IF :NB_CNTRL.FROM_DATE IS NOT NULL THEN
0016: LV_SQL := LV_SQL || ' AND TRUNC(NB_RECEIPT_DATE) >= ''' ||to_char(:NB_CNTRL.FROM_DATE, 'dd-MON-rrrr')||'''';

sample of HTML file

<!-- saved from url=(0043)file:///c:/FRM_05.fmb.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <!--<base href="\\HTMLPictures\">--><base href=".">
  <style type="text/css">
        body,html,table {font-family: "lucida grande",tahoma,verdana,arial,sans-serif;font-size: 12px;line-height: 1.5em;}
  </style>
  <title>Compare</title>

</head>
<body>

<table width="100%" border="0">
<thead>
  <tr>
    <th width="30%">Name</th>
    <th width="50px">Changes</th>
    <th width="20px">&nbsp;</th>
    <th width="35%">Value Old</th>
    <th width="20px">&nbsp;</th>
    <th width="35%">Value New</th>
  </tr>
</thead>
<tbody>
<tr class="lin"><td class="lvl8">(adjoining line)</td><td></td><td class=""></td><td class="">0015:  IF :NB_CNTRL.FROM_DATE IS NOT NULL THEN</td><td class=""></td><td class="">0015:  IF :NB_CNTRL.FROM_DATE IS NOT NULL THEN</td></tr>
<tr class="lin"><td class="lvl8">(line changed)</td><td><img src="./Compare_files/changes_mod.gif"></td><td class="cmpChanged"></td><td class="cmpChanged">0016:    LV_SQL := LV_SQL || ' AND TRUNC(NB_RECEIPT_DATE) &gt;= ''' ||to_char(:NB_CNTRL.FROM_DATE, 'dd-MON-yyyy')||'''';</td><td class="cmpChanged"></td><td class="cmpChanged">0016:    LV_SQL := LV_SQL || ' AND TRUNC(NB_RECEIPT_DATE) &gt;= ''' ||to_char(:NB_CNTRL.FROM_DATE, 'dd-MON-rrrr')||'''';</td></tr>
</tbody>
</table>
</body></html>
5
  • 1
    post your xml so we can create an xpath for you Commented Sep 5, 2017 at 12:57
  • @shubham: we have XPath, the issue is how to open html file, for instance in c# we have xml reader which u can pass xpath and extract data. Now, siti question is how to parse htnl file, ia there any reader? What is the best practice? Commented Sep 5, 2017 at 19:48
  • 1
    First of all HTML and XML are both different thing .. yes they both are having dom but they are different.. selenium can read element from html but not from XML ... Now if your source is html , can you tell is it hosted on your localhost like localhost:8080 Commented Sep 6, 2017 at 1:31
  • @ShubhamJain: please read my question again, i added example. is there any other way except using selenium? do you have any example using selenium in oracle form by java? Commented Sep 6, 2017 at 2:55
  • updated my answer Commented Sep 6, 2017 at 3:40

1 Answer 1

1

ExtractValue should work for you in oracle form

XPath will be like :-

/html/body/table//thead/tr[1]/th[6]/text()  -> it will return ->  "0015: IF :NB_CNTRL.FROM_DATE IS NOT NULL THEN"

/html/body/table/tbody/tr[2]/td[6]/text()  -> it will return ->  "0016: LV_SQL := LV_SQL || ' AND TRUNC(NB_RECEIPT_DATE) >= ''' ||to_char(:NB_CNTRL.FROM_DATE, 'dd-MON-rrrr')||''''"

I do not have experince in oracle form but It should be like :-

ExtractValue(Value(p),'/html/body/table//thead/tr[1]/th[6]/text()') as value

OR

execute immediate 'alter session set events =''31156 trace name context forever, level 2''';

     l_xml := xmltype(l_clob);

     execute immediate 'alter session set events =''31156 trace name context off''';

     select extractvalue( l_xml
                        , '/html/body/table//thead/tr[1]/th[6]/text()' )
     into l_value
     from dual;

     dbms_output.put_line(l_value);

   end;

Source :-

XML Oracle: Extract specific attribute from multiple repeating child nodes

https://community.oracle.com/thread/2381518

Moreover, You can only test HTML based websites with Selenium. If the Oracle application exposes an HTML based front end that is accessible via a web browser then you can use Selenium to test it, if not you can't.

Please let me know if you can access it using browser, if yes then I will create a script for you in java which will retrieve values for you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.