How to compare the contents of two XML documents

Hi all,
I was trying to compare the contents of two xml documents, they are both validate for the same XML Schema. i was using the xmlunit to do this. but some how it doesn't work like what i have expected. for example:
1.xml : <test><item>2</item><item>1</item></test>
2.xml: <test><item>3</item><item>2</item><item>1</item></test>
the result from XMLUnit is this two xmls are different, but it compares <item>2</item> with <item>3</item>, which i cannot find out where the real diiffs are.
does anybody know how i can do this correct?
best regards,
tina

I faced a similar problem in one of my projects and hence wrote my own comparator. Most comparators like ExamXML etc show XML as different if the nodes under a parent node occur in different seqeunce or a set of repeated nodes occur in different sequence. The comparator that I wrote gives you the flexibility to configure how to identify a node from a set of repeated nodes and is able to compare them successfully if they occur in any order. You can view the sample output at http://geocities.com/dheerendra_itbhu/TipsFromDheeru.html
and contact me in case you need the source code.

Similar Messages

  • How to compare the contents of two different tables

    hello. can somebody give me an idean on how to compare the contents of two different tables in mysql?
    example, i have a table named Main List and a table named New List.
    The contents of the New List should be compared to the contents of the
    Main List, to check if they are equal. I don't have any idea how to manipulate
    this data. Hoping for your help. Thanks.

    it is better to comapre it using java.. try get the resultset first and store that in collections then comapre the two collections

  • How can i compare the contents of two folders ?

    how can i compare the contents of two folders and find out which files are in one but not in the other?? Knowing how to do this would be the best thing ever, especially when dealing with a large number of files. Often, for instance, I'm dealing with a large number of images, processing them, and saving the retouched ones to a new folder, and need to check that they are all there. If there are say three files missing in the second folder (out of say a hundred in total) being able to automate the process of elimination would be very useful. Please help!!!
    B

    I really wish I knew the answer to this. I work between two macs, a G5 and MacBook Pro when I'm on the go. Each time I move from one to the other I have to copy all my files to the computer I'm going to work on, so I end up with the same files being duplicated. It's not a problem if it's not much data but in my case the it can be to 30GB, mostly graphics files, photoshop, motion, final cut pro, etc.
    There's has got to be a way automator can make a comparison between two folders to sort out what's changed and what's remained the same. It would be nice also if this feature could be done globally on the hard disk using spotlight's technology to stop files being duplicated in places you didn't even know about and taking up valuable disk space. I'm not sure how this could be done.
    Any bright ideas Apple?

  • How to compare the programs in two different systems

    Hi,
    I have two systems say A & B and i have the program say 'Z_TESTPROG'.
    How to compare the program in two different systems.
    Regards,
    Venkat

    Hi,
    Check the version in Utilities -> version -> version management in both servers is one option.
    Another one is using SE39 transaction.
    Regards
    Manasa

  • Help on how to read the content of an XML file from the payload

    I have a receiver channel / mail adapter, that sends e-mails with a XML attachment.
    I’m trying to write a Bean, that should make it possible to rename the attached XML file dynamically.
    In the Bean I want to read the content of the attached XML file, it could be the “order number”.
    The filename should then be “Order number”.XML.
    <u><i>Can anyone help me with how to read the content of the XML file from the payload.</i></u>
    <i><b>Frank</b></i>

    hi,
    check this: http://jakarta.apache.org/poi/

  • How to set the root path of XML document when calling Inserting procedure

    Hi,
    I was create a procedure to insert XML Document in to DBMS Tables, but i am not able to set the Start root element in calling procedure.
    My calling procedure is
    exec insXmldoc('pmc_sample.xml', 'pmc')
    When i am calling this procedure i got this error
    11:23:54 Error: ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException: Start of root element expected.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 65
    ORA-06512: at "SCOTT.INSPROC", line 8
    ORA-06512: at line 2
    I am checking my XML file using XML Validator. My XML file was parsed with out errors.
    Please give the solution,and tell me where i did wrong in my calling procedure.
    suppose i have this XML file in local E drive ,how to set the path for that XML file in my calling procedure.

    Hi, I am doing the code likthis,please give the solution.
    SQL> create or replace procedure insProc(xmlDoc IN CLOB, tableName IN VARCHAR2) is
    2 insCtx DBMS_XMLSave.ctxType;
    3 l_ctx dbms_xmlsave.ctxtype;
    4 rows number;
    5 begin
    6 insCtx := DBMS_XMLSave.newContext(tableName); -- get the context handle
    7 rows := DBMS_XMLSave.insertXML(insCtx,xmlDoc); -- this inserts the document
    8 DBMS_XMLSave.closeContext(insCtx); -- this closes the handle
    9 end;
    10 /
    Procedure created.
    SQL> begin
    2 insProc('/usr/tmp/ROWSET.xml', 'emp');
    3 end;
    4 /
    begin
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException:
    Start of root element expected.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 65
    ORA-06512: at "SCOTT.INSPROC", line 7
    ORA-06512: at line 2
    Kishore B

  • How to set the encoding of an XML-document

    I need to change the encoding of an xml-document.
    When I convert the document into a string, UTF-8
    is used, I want to use ISO-8859-1.

    use this in your identity transform:
    transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");

  • How to Compare pdf contents of two pdfs?

    Hi,
    Can anyone guide me how can i do content comparision of pdf at run time. I am able to compare documets using acrobat and get the results. But I have a scenario where i need to compare two documents at runtime.
    Can assembler compare two documents and Highlight the contents? or
    Is there any JavaScript API which can perform pdf content comparision?
    Please help me on this?
    Regards
    Sunil

    Currently I am having xfa pdfs and i will be able to transform to any version (static,pdf etc) to get the comparision result.

  • How to merge the contents of two Photo Booths?

    Hello.  We have two Macbooks (Old + Existing).  Both are/were updated to Maverick.  However, I have restored the Old Macbook back to original (Snow Leopard) in order to sell.  I manually took off files as well as doing a Time Machine backup. 
    I would like to add all the photos and videos from Photo Booth on the Old Macbook into my Existing Macbook.
    Is this possible either a. through a specific file in Time Machine (I do NOT wish to replace the Existing with the Old.  This is a merger.) or b. with the Photo Booth library I copied onto an external harddrive?  However, this is one 1.75gb file with the Photo Booth icon (a film strip) rather than separate photo files.  I am unsure how to access individual photographs or videos.  I was hesitant to open it up in case it negatively affected the Existing Photo Booth.
    Thanks for any assistance.

    Great, I just lost 10 GB of data thanks to OSX folder merge... because appaerantly I should have known better not to keep a subfolder inside my folder I was trying to merge
    I can not beleive more people don't have a problem with this. Merge contents in Lion does NOT merge contents if 1 or more of those supposed "contents" is a subfolder
    Merge contents of two folders only works for files, it does NOT work for subfolders!!!!
    Can we please get this acknowledged as a bug that needs fixing?
    EXAMPLE:
    Drive1 / Folder1
                   - text1.txt
                   - text2.txt
                   - / subfolder / text3.text
    MERGE TO
    Drive2 / Folder1
                   - text1.txt  (this gets updated / merged)
                   - text2.txt  (this gets updated / merged)
                   - / subfolder /
                             - text.txt
                             - text2.txt     (this should get text3.txt merged into it, from Drive1, but instead this subfolder is REPLACED, and NOT MERGED!!)
    Why would i want to replace a folder if I'm trying to merge it!?
    Almost 2013 and OSX still cant merge a folder? unbelievable

  • How to Merge the Contents of Two Folders in Lion, Keeping the Newer Versions of Duplicate Files.

    Select and copy all the contents of the folder containing the newer files.  Paste the files ONTO the folder containing the older files.  The unique files will be copied into the older folder without further ado.  For the duplicates, a window will appear warning that a file with the same name already exists in the older folder.  Check the "Apply to All" box and click on the Replace button, not the Skip button.  These steps will merge all the files in the newer folder into the older folder, replacing the duplicates with the copies from the newer folder.
    Unfortunately, the only information that the warning window provides about the duplicates is their common name, not sizes, dates, or times.  These steps worked for me because I knew for certain that all the newer files were in one folder.

    Great, I just lost 10 GB of data thanks to OSX folder merge... because appaerantly I should have known better not to keep a subfolder inside my folder I was trying to merge
    I can not beleive more people don't have a problem with this. Merge contents in Lion does NOT merge contents if 1 or more of those supposed "contents" is a subfolder
    Merge contents of two folders only works for files, it does NOT work for subfolders!!!!
    Can we please get this acknowledged as a bug that needs fixing?
    EXAMPLE:
    Drive1 / Folder1
                   - text1.txt
                   - text2.txt
                   - / subfolder / text3.text
    MERGE TO
    Drive2 / Folder1
                   - text1.txt  (this gets updated / merged)
                   - text2.txt  (this gets updated / merged)
                   - / subfolder /
                             - text.txt
                             - text2.txt     (this should get text3.txt merged into it, from Drive1, but instead this subfolder is REPLACED, and NOT MERGED!!)
    Why would i want to replace a folder if I'm trying to merge it!?
    Almost 2013 and OSX still cant merge a folder? unbelievable

  • Comparing the contents of two files

    I have two ASCII files.
    The files contain data from two identical tables in "|" delimited form.
    I need to compare the two files and determine if there is any difference between the two files.
    Any inputs will be appreciated.
    Thank you.
    Ramesh

    In Windows I've found a piece of shareware called WinMerge to be very useful. Try using Google to find it.
    Cheers, APC

  • How to modify the content of a xml element using java?

    Hi all,
    In my usecase I need to export some data from the database to the external file (Ms Word) using java.
    The data which I get from the database will be in the form of a xml file. In that xml file
    I got to modify the content of an attribute of a xml element in the java class. Kindly comeup with your help
    to achieve this.
    Thanks,
    Phanindra.
    Edited by: 887737 on Dec 5, 2011 5:52 AM

    Why don't you try Xerces2?Why don't you tell him to use the javax.xml APIs that are already built in? And that use Xerces2 under the hood? Instead of throwing out a suggestion that might lead to him adding another copy of Xerces into his application?
    @OP there are several techniques:
    - string replacement as suggested by jschell
    - XML parsing to a DOM and then use the DOM API
    - XSLT
    Which you should use depends on the complexity of your requirement.

  • Build the delta from two xml documents

    Hi,
    i look for a solution to solve the following problem:
    i want to build a xml-based interface to pass my data to a client(Web etc.) and i dont know in which way the client manipulates the data and what in the xml-document was changed, inserted or deleted.
    What i have is the original-document and the changed-document (both based on the same DTD). How can i determine the delta from the two documents, cause i must know what actions to be taken (for example put <?bc4j remove?> or an appropriate tag for the XDK in the xml)
    any suggestion ???
    TIA
    Oliver

    The Oracle XDK for Java comes with a utility called XMLDiffer that, given XML Documents A and B, produces an XSLT stylesheet S that transforms A to B.
    Might be of use to you. That's the only inhouse XML diffing technology that I'm aware of. We use it internally in JDeveloper for merging machine-generate web.xml file edits with the user's hand-written web.xml file edits.

  • How to compare the data of two identical tables

    My requirement is to compare two identical tables(eg., t1 and t2) and display the column, which value got changed, old value and its new value.
    For eg:
    T1:
    StudId C1 C2 C3
    1 40 50 90
    2 30 80 100
    3 20 10 11
    T2:
    StudId C1 C2 C3
    1 100 60 90
    2 30 90 100
    3 20 60 80
    output should be:
    StudId Column prevvalue changedvalue
    1 C1 40 100
    1 C2 50 60
    2 C2 80 90
    3 C2 10 60
    3 C3 11 80
    Please help me to how to achieve using oracle pl/sql. It is bit urgent

    No need of PL/SQL, you can do it in SQL as shown
    SQL> create table t1
      2  (
      3  studentId number,
      4  c1 number,
      5  c2 number,
      6  c3 number
      7  );
    Table created
    SQL> insert into t1 values (1,40,50,90);
    1 row inserted
    SQL> insert into t1 values (2,30,80,100);
    1 row inserted
    SQL> insert into t1 values (3,20,10,11);
    1 row inserted
    SQL> commit;
    Commit complete
    SQL> create table t2
      2  (
      3  studentId number,
      4  c1 number,
      5  c2 number,
      6  c3 number
      7  );
    Table created
    SQL> insert into t2 values (1,100,60,90);
    1 row inserted
    SQL> insert into t2 values (2,30,90,100);
    1 row inserted
    SQL> insert into t2 values (3,20,60,80);
    1 row inserted
    SQL> commit;
    Commit complete
    SQL> select * from t1;
    STUDENTID         C1         C2         C3
             1         40         50         90
             2         30         80        100
             3         20         10         11
    SQL> select * from t2;
    STUDENTID         C1         C2         C3
             1        100         60         90
             2         30         90        100
             3         20         60         80
    SQL> select
      2  t1.studentId StudId,'c1' ColumnName,t1.c1 prevvalue,t2.c1 changedvalue
      3  from t1,t2
      4  where t1.studentId = t2.studentId and
      5  t1.c1 <> t2.c1
      6  union
      7  select
      8  t1.studentId,'c2',t1.c2,t2.c2
      9  from t1,t2
    10  where t1.studentId = t2.studentId and
    11  t1.c2 <> t2.c2
    12  union
    13  select
    14  t1.studentId,'c3',t1.c3,t2.c3
    15  from t1,t2
    16  where t1.studentId = t2.studentId and
    17  t1.c3 <> t2.c3
    18  ;
        STUDID COLUMNNAME  PREVVALUE CHANGEDVALUE
             1 c1                 40          100
             1 c2                 50           60
             2 c2                 80           90
             3 c2                 10           60
             3 c3                 11           80
    SQL>

  • How to compare the content of 2 binary file???

    Plz show me the way.
    Best regards
    Hoa

    - Create two input streams
    - Read a byte from both
      - If they're the same, continue
      - If they're not, return false
    - If there are no more bytes available in one of the two streams, return whether they're both completely read
    Kind regards,
      Levi

Maybe you are looking for

  • External mic not working at all??

    hi all i just bought a mic from radio shack to mess around with on my mac and it has a 1/4 phone plug which i converter to a 1/8 with a adapter and i plugged it into my audio inline plug in the back and i have no sound doesnt even move a bar with gar

  • Using System::ErrorDescription in Insert statement

    Hello, I want to insert System::ErrorDescription to store the error in the customized log table. When I use the following statement, it does not insert anything. What am i doing wrong. Please advice. create table dbo.load_err(load_err_id integer(PK),

  • Check from the ABAP backend whether the URL is available

    I need to check whether the  portal(any web page) is available or not. to do this I must check whether the corresponding URL is available. I need the corresponding ABAP code to do so. can anybody please help me out. Thanks, Ashutosh Shukla

  • Causing Runtime error

    Hi, I am getting the Following runtime error, can u please tell me the cause for this. What happened?                                                                                | The exception 'CX_WD_CONTEXT' was raised, but it was not caught any

  • How to Boot from Leopard Upgrade disk??

    I bought a Leopard upgrade disk last year for my iMac. Today I am having computer troubles. But there seems to be no diagnostic programs on the Leopard upgrade disk, nor does it seem to be a bootable disk. What should I do next? The problem with the