Compare 2 different xml versions and highlite the differences

Hi,
Currently we have xml and that is displayed on the web page using the css style sheets.
The xml we have remain the same most part but with small changes (say different version created after a week).
We want to be able to track the differences from the previous version and highlight them, the differences, when showing it in the web page.
Please advise if this can be done and how.
Thanks.

try
SQL> set serveroutput on
SQL> set long 50000
SQL>
SQL> declare
  2 
  3    --main
  4    xml1 xmltype := xmltype('<ROWSET>
  5                                <ROW>
  6                                  <EMPNO>7934</EMPNO>
  7                                  <ENAME>MILLER</ENAME>
  8                                  <JOB>CLERK</JOB>
  9                                  <MGR>7782</MGR>
10                                  <HIREDATE>1982-01-23T00:00:00</HIREDATE>
11                                  <REMOVED>abc</REMOVED>
12                                  <SAL>1300</SAL>
13                                  <COMM/>
14                                  <DEPTNO>10</DEPTNO>
15                                </ROW>
16                              </ROWSET>');
17    --new
18    xml2 xmltype := xmltype('<ROWSET>
19                                <ROW>
20                                  <EMPNO>7934</EMPNO>
21                                  <ENAME>MILLER</ENAME>
22                                  <JOB>CLERK</JOB>
23                                  <MGR>7782</MGR>
24                                  <ADDED>xyz</ADDED>
25                                  <HIREDATE>1982-01-23T00:00:00</HIREDATE>
26                                  <SAL>1300</SAL>
27                                  <COMM/>
28                                  <DEPTNO>10</DEPTNO>
29                                </ROW>
30                              </ROWSET>');
31    diff xmltype;
32 
33    xtype varchar2(80);
34    xpath varchar2(80);
35    xpathChild varchar2(80);
36    xnodeChild varchar2(80);
37    new_value xmltype;
38 
39    new_xml xmltype;
40 
41 
42  begin
43 
44    -- get diff
45    select xmldiff(xml1, xml2) into diff from dual;
46    dbms_output.put_line(diff.getclobval());
47 
48    -- that have
49    select x.xtype, x.xpath, x.new_value
50      into xtype, xpath, new_value
51      from xmltable(
52             xmlnamespaces('http://xmlns.oracle.com/xdb/xdiff.xsd' as "xd"
53                          ,'http://www.w3.org/2001/XMLSchema-instance' as "xsi"
54                          )
55           , '/xd:xdiff'
56             passing diff
57             columns xtype     varchar2(80) path 'local-name(xd:insert-node-before)'
58                   , xpath     varchar2(80) path'xd:insert-node-before/@xd:xpath'
59                   , new_value xmltype path 'xd:insert-node-before/xd:content/*'
60           ) x;
61 
62     dbms_output.put_line('type of doing: ' || xtype);
63     dbms_output.put_line('path for doing: ' || xpath);
64     dbms_output.put_line('value for doing: ' || new_value.getclobval());
65 
66     if (xtype = 'insert-node-before') then
67       xpathChild := substr(xpath, 1, instr(xpath, '/',-1)-1);
68       xnodeChild := substr(xpath, instr(xpath, '/',-1)+1);
69 
70       select insertChildXMLbefore (xml1,
71                                    xpathChild,
72                                    xnodeChild,
73                                    XMLType('<HIGHLIGHT>' || new_value || '</HIGHLIGHT>'))
74       into new_xml
75       from dual;
76     end if;
77 
78 
79     dbms_output.put_line(new_xml.getclobval());
80 
81  end;
82  /
<xd:xdiff xsi:schemaLocation="http://xmlns.oracle.com/xdb/xdiff.xsd http://xmlns.oracle.com/xdb/xdiff.xsd" xmlns:xd="http://xmlns.oracle.com/xdb/xdiff.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><?oracle-xmldiff operations-in-docorder="true" output-model="snapshot" diff-algorithm="global"?><xd:insert-node-before xd:node-type="element" xd:xpath="/ROWSET[1]/ROW[1]/HIREDATE[1]"><xd:content><ADDED>xyz</ADDED></xd:content></xd:insert-node-before><xd:delete-node xd:node-type="element" xd:xpath="/ROWSET[1]/ROW[1]/REMOVED[1]"/></xd:xdiff>
type of doing: insert-node-before
path for doing: /ROWSET[1]/ROW[1]/HIREDATE[1]
value for doing: <ADDED>xyz</ADDED>
<ROWSET><ROW><EMPNO>7934</EMPNO><ENAME>MILLER</ENAME><JOB>CLERK</JOB><MGR>7782</MGR><HIGHLIGHT><ADDED>xyz</ADDED></HIGHLIGHT><HIREDATE>1982-01-23T00:00:00</HIREDATE><REMOVED>abc</REMOVED><SAL>1300</SAL><COMM/><DEPTNO>10</DEPTNO></ROW></ROWSET>
PL/SQL procedure successfully completed
SQL>
SQL> select * from v$version where rownum=1;
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
SQL>

Similar Messages

  • How to compare two excel reports and find the difference in BI Publisher

    Hi All,
    I have a requirement that needs to compare two excel reports in XML Publisher 5.6.2. or BI publisher 10.1.3.4
    If anybody has an idea about this pls help us.
    Thanks,

    Since our customer wants to have this comparison only with BI reports....here is the scenario how the comparison should be..
    Now,we have a parameters called Customer name and version id. Version id list will be refreshed based on the customer selection.
    User can generate the report based on the selected customer name and version id. These data are fetch from the oracle database and we are using Data Template in the BI Publisher.
    Now the requirement is customer wants to compare two version id data. for example, v1.2 and v1.3
    Now they wanna to see both the reports while generating in the same work sheet, like, v1.2report should display in the left side and the v1.3report has to display in the right hand side of the same work sheet.
    Now...If there is any addition happened in v1.3 report,then that cell/data should display as a green color in that report.
    If any deletion happened in v1.3report then that should be in the red color.
    If any modification happened in v1.3 then that should be in the yellow color.
    If there is no difference then that should display as it is.
    the thing is that, the both the reports (v1.2 and v1.3)should display side by side in the same worksheet with the format and everything........only the difference should be highlighted.
    Template is same for both the reports..
    To display the data for both versions i think i can generate the template side by side of both in the same worksheet.
    Now, My question is how to find the difference of data in the RTF Template for both the versions
    Can anybody assist me?
    Thanks,
    Edited by: user753355 on Jun 9, 2009 12:03 AM
    Edited by: user753355 on Jun 9, 2009 12:06 AM
    Edited by: user753355 on Jun 9, 2009 12:16 AM
    Edited by: user753355 on Jun 10, 2009 3:59 AM

  • How to compare two images and display the difference on Front Panel

    HI..
    I have attached two images.
    I want to compare these two images and subtract the differenc from these two images and display the difference(the mouse) on the front panel
    Anyone can help me?
    Really thanks
    Attachments:
    IMG_2117.JPG ‏1677 KB
    IMG_2118.JPG ‏1650 KB

    The missing thing. You have to keep in mind that what you see is not the same as the camera sees.
    So when using IMAQ Substract it gives you the difference of the value of every single pixel!
    In order to find the mouse as only difference you have to manage that every other pixel value stays the same, e.g. with a proper lightening.
    At the other hand you can combine different filters or alogorithms to get the object, e.g. if the object is darker or brighter then everything else in the image you could use a threshold and then use morphologic operations to get the objects size and position.
    Christian

  • Compare two tables and log the difference

    Hi,
    I want to compare two tables and log the difference in new table with the fields as (old value,new value, column name). The column name should be the changes value column

    Can you show an example?
    SELECT Foo.*, Bar.*
       FROM Foo
            FULL OUTER JOIN
            Bar
            ON Foo.c1 = Bar.c1
               AND Foo.c2 = Bar.c2
               AND Foo.cn = Bar.cn
     WHERE Foo.key IS NULL 
        OR Bar.key IS NULL; 
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Script to compare 2 tables and retrieve the differences in records data

    Dear All,
    please I need a script to compare two oracle database tables and retrieves the differences in data records between the two tables.
    I have tried this one :
    -- all rows that are in T1 but not in T2
    (select * from T1 minus select * from T2)
    union all
    -- all rows that are in T2 but not in T1
    (select * from T2 minus select * from T1);
    But it generates the following error:
    ORA-01789: query block has incorrect number of result columns
    Thank you for your cooperation , please it is urgent

    ok I used this statement with dblink, the problem is that i cannot use PL/SQL developer since it is a process repeated for 300 tables , that why i am trying to automate it:
    -- all rows that are in T1 but not in T2
    (select * from schema.T1minus select * from T2@dblink_name)
    union all
    -- all rows that are in T2 but not in T1
    (select * from T2@dblink_name minus select * from schema.T1);
    I created the db link on a database A and when i run the statement
    (select * from schema.T1minus select * from T2@dblink_name)
    on the database B i get the error ORA-02019: CONNECTION DESCRIPTION FOR REMOTE DATABASE NOT FOUND.
    DOes anybody have an idea please

  • Hi, i'm trying to download the Lightroom 6 stand alone version and get the following message right after a click the checkout box: "The account was registered for a different country. Please sign out and sign in using an existing account for this country.

    Hi, i'm trying to download the Lightroom 6 stand alone version and get the following message right after a click the checkout box: "The account was registered for a different country. Please sign out and sign in using an existing account for this country." I'm in Namibia and tried to change my country from Africa to USA but still the same problem. TIA

    Hi Annen,
    Please refer the following forum thread.
    Trying to purchase trial period in different email address - error message "Error in Your Order The account was registered for a different country. Please sign out and sign in using an existing account for this country. Ok"
    Regards,
    Sumit Singh

  • Access two EAS with different Essbase versions and different java versions from the same p.c.

    Hi,
    I need to regularly access Essbase 11.1.2.2. and Essbase 11.1.2.3 EAS from the same client machine.
    They are on, and must be on, different versions of java, is there a way to have both versions of java installed but each using the correct version and without the two java versions causing any kind of problems?
    thanks,
    Robert.

    Hi Robert...  I assume this is web-launched?
    I spent a day or so trying understand the intricacies of the JNLP protocol and create shortcuts that will invoke web-launched EAS with the appropriate version of Java.  I can get one version of EAS to use the 1.6 Java Web Launcher, and the other version of EAS to use the 1.7 Java Web Launcher - but both Web Launchers eventually invoke the same version of Java!  There are switches in the JNLP syntax that seem like they should allow you choose the actual Java version that gets invoked, but I just could not make it work.
    You can use the Java Control Panel (in Control Panel) to enable and disable the relevant versions before launching EAS.
    If you find otherwise I would love to know (or if you find out how to control which versions are enabled or disabled via command-line script).

  • Is it possible to have 2 different output config XML files and index the data into 2 endeca apps using the same indexing component ProductCatalogSimpleIndexingAdmin

    Hi ,
    We have a catalog that defines 2 types of products (they have too many different properties), so wanted to keep them on two different MDEX engines and serve the applications requests. Here DB catalog and front end ATG application is same for both the MDEX instances.
    Is it possible to have 2 different output config XML files and index the data into 2 endeca apps using the same indexing component ProductCatalogSimpleIndexingAdmin?
    Thanks
    Dev

    Hi, also have had some problem some monthes ago - I created separete component ProductCatalogSimpleIndexingAdminSecond. After that one of my colleage gave me some advice:
    The creating separate component like ProductCatalogSimpleIndexingAdmin for the second IOC is possible way for resolving your situation. But I afraid that this way will be required creating mane duplicates for already existed components.
    In my opinion the better way is the following:
    starting from AssemblerApplicationConfiguration and ApplicationConfiguration component. It contains details for connecting between ATG and Endeca. Of course you should configure different components for different Endeca Apps.
    After that:
    Find all components that uses AssemblerApplicationConfiguration and ApplicationConfiguration. Customize these components for using one or another  *Configuration component depending on what index works. (many variants released it: the most simple global custom component with flag.)
    Then customize the existed ProductCatalogSimpleIndexingAdmin. Using one or another IOC  and setting the flag in global custom component when index started. You can add some methods into your custom ProductCatalogSimpleIndexingAdmin like:
    Execute baseline index for both IOC (one by one)
    Execute baseline for IOC 1
    Execute baseline for IOC 2.
    Note: you should be afraid about incremental (partial) index in this configuration. But resolving conflicts in incremental index should be done after full implementation these changes.
    Regards

  • I bought the HD season version of breaking bad, however I only need the regular @ 19.95. How can I change this and get the difference refunded?

    bought the HD season version of breaking bad, however I only need the regular @ 19.95. How can I change this and get the difference refunded?

    When you purchase an HD video on a supported device or computer, only HD video will be downloaded. To download the SD version, you need to download the video again from your Purchased page. Conversely, if you purchase an HD video on an unsupported device, the SD version will be downloaded. Then, you will need to download the HD version from your Purchased page. Learn more about downloading previous purchases."
    iTunes: Purchasing and viewing HD videos

  • Compare different project versions for material components?

    hi all,
    is it possible to display and compare different project versions for material components in different COLUMNS? i want to be able to view the data for each version in a different column.. currently i can view the different data per version but it is arranged  by ROW but i want to know if its possible to have different layout/report showing the different versions in separate columns
    Thanks in advance..
    Edited by: Ramesh on Sep 15, 2008 5:58 AM

    hi,
    thanks but this is not the report im looking for.. i wonder if its possible to show a report similar to CNMM or CN53N wherein the different project version data can be displayed side by side as columns?
    again, thanks in advance and regards..

  • Query to compare different Plan versions in CCA

    My requirement is to create a Cost Center query that compares two different plan versions, selected by the user with different time periods. We do not use any SEM functionality and are in version 3.0B.
    There is a standard R3 report but this gives a total figure and does not split the figures by periods.
    Does anyone know a Business Content query that can resolve this issue?

    Hi ,
    Instead of going for a business content query u can go for a formula variable using replacement path and assign the required values for the output and in that by using the customer exit with the help of abapers
    Hope this will be a clear solution to ur problem
    Pls assign full points if answer is satisfied
    Regards ,
    Subash Balakrishann

  • Version 10 doesn't work with a web site I use constantly. How can I download a lower version and have the app appear on my phone?

    Have been using a lower version of firefox on my samsung galaxy phone to access [email protected] for quite some time. Since the upgrade to 10.0, I receive a server error everytime I try to access. Want to download a lower version, but app doesn't appear on my phone. How can I download a lower version and get the app to show up on my phone?

    Mandel is referring to what is called a "User Agent Faker' which tricks the website into thinking it is a different browser or version than it actually is. I sometimes would use this on my iPhone when I wanted to visit the full website of a site I was attempting to go to & it would only take me to the mobile version or state it was only compatible with say Internet Explorer, simply turn it on & select the browser and details you want it to report and it will spoof that browser & you'll be on your way.

  • If i wanted to get the new ipod, could i just bring in my ipod touch and pay the difference?

    I have the ipod touch, fourth generation. And i want to get the newest version of the ipod touch. Would i go to the apple store and give in my ipod and pay the difference to get the new ipod? Or would that not matter and i would still have to pay full price for the newest ipod?

    ipod over 14-30 days over like several months.... u get a 10% recycle apple uses. u wont get the full amount u payed for for that ipod

  • Is it possible to have your music and videos saved on different external drives and use the same iTunes library?

    Is it possible to have your music and videos saved on different external drives and use the same iTunes library?
    I am running out of space on my external hard drive and would like to split the movies and music between two external drives while using the same iTunes library is this possible.
    My library is stored on the external drive all of my music etc is stored.

    Yes.

  • I inadvertently downloaded the 64-bit version and need the 32-bit version of Lightroom 6 upgrade.

    I inadvertently downloaded the 64-bit version and need the 32-bit version of Lightroom 6 upgrade. 
    i go to the download page and i dont see a 32 or 64 bit option.
    Please help!   Thank you,
    Carlos

    lr 6 is 64bit only, System requirements
    http://helpx.adobe.com/x-productkb/policy-pricing/return-cancel-or-change-order.html
    http://helpx.adobe.com/x-productkb/global/phone-support-orders.html

Maybe you are looking for