Compare two XMLElements for semantical equality

I rewrote a statement that generates XML from our database and I need to check if it produces the same result as the old statement. However, for some reason, the new statement generates a certain empty element as <FOO/> while the old statement generates a <FOO></FOO>. The strange thing is, that the tag is generated by a substatement that definitely has not changed at all.
This wouldn't be a problem if I could compare the two XMLElements for semantical equality but I couldn't find an appropriate function.

I didn't change the database version, both versions of my XML generating queries run on the same schema on the same database. I think it doesn't make sense to post the whole queries since they are really huge. So I will try to point out the relevant part:
I have a rather complex query that generates an XML document using SQL/XML. I refactored that query to avoid code redundancies and to make it more readable. The output of the refactored query is the same as that of the old query, except for the representation of that empty tag.The empty tag is generated by a subquery that is called by the refactored query. The subquery has not changed at all and it is called with the same parameters as before.
I don't know if there is a way to take explicit control of how empty tags should be represented. But it seems that the representation that the DBMS chooses by default is practically not predictablae.

Similar Messages

  • Compare Two Values in logic:equal issue !!!!!!!!!!!

    Hi Techie !!!!
    I have list object from DB inwhich i want compare a field in <logic:equal> Struts EL ....... I have written the following code.....
    <%
             List list = (List)request.getAttribute("AppointmentDetailNavigationList");
          pageContext.setAttribute("list", list, pageContext.REQUEST_SCOPE);
    %>
    <body>
    <ul>
         <logic:iterate id="item" name="list" type="com.bean.AppoinmentInformation" scope="request">
               <logic:equal property="rsc_name" value="rsc_name">   // This is for test only
                         *// Here i want compare rsc_name if comes two times in list i want come out of this scope....*
               </logic:equal>
         </logic:iterate>
    </ul>
    </body>
    </html>          My requirement is a field with duplicate, wanna come out of the scope from the list...
    Any one help me out.....

    Wouldn't it be easier to use a Set which does not allow duplicates? That would nip the problem at the source rather than bringing it all the way to the jsp and not displaying it.
    However if you have to have it this way, there is no easy way to break out of a loop in logic tags. Maybe some murky servlet code with a break command in scriptlets would do the trick, but you really have to scour the source code to confirm that.
    cheers,
    ram.
    Edited by: Madathil_Prasad on Apr 26, 2010 1:00 PM

  • Compare two strings for partial or full match

    I have been trying to figure out away of comparing two strings.
    I can get the full string matching to successfully work but am struggling on how to get partial eg wildcard search working.
    say I had names like paul Duncan, George Morrison.
    I have split them up so its now paul , duncan i then use the users entered string to compare it against the name name to see if it matches anything in the first name or the last name if it does i added it to an arraylist.
    however i have tried t use a indexof as i believe this looks for similarity (Substring matches?) but it always returns -1.
    Could anyone possibly direct me to a method that will allow me to use partial text string to match it against stored user names.
    eg user enters pa
    I would return anything that would contain pa
    thanks for any help

    thank you for the reply
    Sorry I forgot to put in the code.
    This is a reduced down version including the read in from a text file as well as the index of if statement and the adding of it to an array list.
    public class FindContact {
    String res;
    /** Creates a new instance of FindContact */
    public FindContact() {
    public Object[] FindAUser(String passSearch) {
    System.out.println("getting here");
    ArrayList found = new ArrayList();
    String patternStr = ",";
    int j, i = 0;
    try {
    BufferedReader in = new BufferedReader(new FileReader("H:\\out.txt"));
    String str;
    while ((str = in.readLine()) != null) {
    String[] fields = str.split(patternStr);
    //for(j=0;j < fields.length;j++) {
    if (fields.length != 0) {
    if (passSearch.indexOf(fields[0])!=-1 || passSearch.indexOf(fields[1])!=-1) {
    found.add(str);
    System.out.println("ENDDDDDDDD value ");
    in.close();
    } catch (IOException e) {
    System.out.println(e.toString());
    Object[] foundResult = new Object[found.size()];
    foundResult = found.toArray();
    if (foundResult.length >= 0) {
    System.out.println(foundResult.length);
    return foundResult;
    Hope that helps as it has confused me and am not sure why it is not returning a value.
    Should I maybe use the contain method instead to search for the user inputted string?

  • How compare two URLs for equality if one uses jar protocol?

    I'm trying to see if some URLs are referring to the same jar file but some of them come with the prepend/append of "jar:file:/" and "!/" and some are just as "file:/". So when I call "URL.equals(...)", it returns false. How do I properly compare these two?
    //Returns false, even though both can be used to find the jar file
    new URL( "jar:file:/home/me/tmp.jar!/" ).equals( new URL( "file:/home/me/tmp.jar" ) );

    The URL with the leading "jar:" and trailing "!/" is a JAR URL. It's described in the JarURLConnection class API document.
    This is one way (there any be a simpler one). You will have to figure out whether you're working with a jar URL or a "regular" URL by parsing the URL to figure out which kind it is. One diffrence is the leading "jar"
    import java.io.IOException;
    import java.net.JarURLConnection;
    import java.net.MalformedURLException;
    import java.net.URL;
    public class Xy
        public static void main(String[] args)
            throws MalformedURLException, IOException
            URL fileURL =
                new URL("file:/Program Files/Java/jre6/lib/deploy.jar");
            URL jarURL =
                new URL("jar:file:/Program Files/Java/jre6/lib/deploy.jar!/");
            String fURL = fileURL.toString();
            System.out.println("fileURL: " + fURL);
            String jURL = ((JarURLConnection) jarURL.openConnection()).
                getJarFileURL().toString();
            System.out.println("jarURL: " + jURL);
            if (fURL.equals(jURL))
                System.out.println("They are equivalent");
    }

  • Comparing two ResultSets for equality

    Hello,
    I wish to test if two separate ResultSet objects are identical.
    By identical I mean that two different ResultSet objects are identical if
    they contain the same rows in the same order, and each row contains identical values in the two ResultSets.
    Two possibilities could be that the equals() method returns true or that the hashcode() method also produces the same hash value if the objects are identical as described.
    I haven't been able to find any documentation on this issue.
    Does anyone know if either (or both) of these methods have the contract as described above? If so are they guaranteed?
    I can see several potential problems here. Performance with a large ResultSet, duplicate rows, and the ordering of rows not being guaranteed?
    Thanks in advance.
    Tim

    Two possibilities could be that the equals() method
    returns true or that the hashcode() method also
    produces the same hash value if the objects are
    identical as described.I can tell you without looking anything up that these methods do not do that, as doing that would require them to scan the entire result-set, and JDBC tries to avoid doing useless processing. You are going to have to write this code yourself.

  • How to compare two recordsets for common or difference or join (ASP)

    Good day,
    I have Adobe Dreamweaver CS3 and here is my question. I have created two recordsets, one called Active_Stu and the other is called Active_Emps. One deals with active employees and the other deals with active Students. Both hava ids of students and employees. The student id field is called stuid and the employee id field in the active employee record set is called empid. They are both integers and come from one table. Each recordset is a SQL query that work fine on its own. How can I join the two recordsets into a third recordset? How can I find the ids in one that is not in the other one? or the ones that both have in common? I can do all that in Access by bringing the two queries into the third one and do a left join or others but not sure how to do such action in the Dreamweaver.
    I am using VB ASP for my development.
    Any ideas?

    Don't try to join two recordsets to find rows different or in common between tables. You do the same as you would in Access. Just write a single SQL query that joins the tables. Depending on what exactly you are looking for, you would use inner joins, outer joins or sub-selects.

  • Compare tables in two schemas for the table with particular column & value

    Hello All,
    I have a query to find out the list of table from a given schema to extract all the tables having a search column .
    ex :
    SELECT OWNER, TABLE_NAME, COLUMN_NAME FROM
    ALL_TAB_COLUMNS WHERE OWNER='<SCHEMA_NAME>'
    AND COLUMN_NAME='<COLUMN_NAME>'
    I want to compare two schemas for the same above query .
    Can we wirte a query on this - I am using SQL DEVELOPER , which has menu item - TOOL - database differneces to find the diffenence between two schemas but my requirement is to find the differences in two schemas for all the tables matching for a particular column ( as given in quer).
    Appreciate your help.
    thanks/Kumar
    Edited by: kumar73 on 29 Nov, 2012 1:50 PM

    Hi, Kumar,
    This is the SQL and PL/SQL forum. If you have a question about SQL Developer, then the SQL Developer is a better place to post it. Mark this thread as "Answered" before starting another thread for the same question.
    If SQL Developer has a tool for doing what you want, don't waste your time trying to devise a SQL solution. The SQL Developer way will probably be simpler, more efficient and more reliable.
    If you do need to try a SQL solution, then post some sample data (CREATE TABLE and INSERT statements for a table that resembles all_tab_columns; you can call it my_tab_columns) and the results you want from that data.

  • How to Compare Two Strng without .equals() method

    Hiii,
    How to compare two Strings with out .equals method if there are white spaces in between these string it should be avoided..
    eg: ab cd ef g is equal to a bc de fg
    Please give me the logic or code..
    Your help will be appreciated

    dude find the code without the equal method
    public class test {     
         public static void main(String args[])
              String str = "ab cd ef g" ;
              String str1 = "a bc de fg";
              char []ch = str.toCharArray();
              char []ch1 = str1.toCharArray();
              int counter =0, counter1 = 0;
              while(counter < ch.length && counter1 < ch1.length)
                   while(ch[counter]==' ')
                        counter++;
                   while(ch1[counter1]==' ')
                        counter1++;
                   if(ch[counter] != ch1[counter1])
                        break;
                   counter++; counter1++;
              if(counter == ch.length && counter1 == ch1.length)
                   System.out.println("true");
              else
                   System.out.println("false");
    }

  • Compareto versus equals performance for strings equality

    Hi
    Just wanted to know whether compareto and equals method performance for checking whether the two strings are equal or not .
    Which one is good with respect to bytecode , speed performance.
    Im not asking for the difference, only asking which one is good to use most number of times for comparing two strings for equilaty.
    Thanks.

    Hi
    Ya they are both for different purposes. No doubt.
    t which one is faster among the two for string
    equality?
    compareto or equals.
    thanksHis point is that it doesn't matter. You shouldn't worry about optimization for small details like this. Unless you are profiling your code and find a large slowdown with that code, then don't worry about their performance. Use the one that best suits your purpose. If you want to know if they're equal, use equals(), if you want to know their order, use compareTo().

  • Need ideas for alternative to JavaScript for comparing two inputText values

    Hello
    I am currently using the JavaScript method to check if the values of two inputText components are equal.
    If the values are not equal an alert box is displayed. In either case the action on the bean is performed and in the action method the two bean property values are compared again, if they don't match the action returns null and the for is redisplayed.
    I don't like this method because:
    A) it seems long winded and wasteful
    B) the JavaScript dialog box is out of character with the rest of the form, where validation errors are returned as messages next to the offending component.
    On one of the inputText components I already do a custom validation to check that the input value is a valid javax.mail.internet.InternetAddress.
    Does anyone know of any other method ideas, perhaps using Value Change Events that will allow a message to be written against the second inputText component if the two values did not match, and which could be done before the Invoke Application event. I have tried something along these lines but have failed.
    Many thanks in advance...

    If you can use a custom tag for the validator instead of the standard f:validator tag,
    there is a better way:
    The custom tag has an attribute , eg. "forId", to specify the ID of another component.
    Then, your validator can use the attribute for the parameter of findComponent().
    Something like:
    YourValidatorTagHandler.java
         protected Validator createValidator() throws JspException {
              YourValidator val = (YourValidator)super.createValidator();
              val.setForId(forId);
              return val;
    YourValidator.java
         public void setForId(String f) {
              forId = f;
         public void validate(
              FacesContext context,
              UIComponent component,
              Object value)
              throws ValidatorException {
                   int i1;
                   int i2;
                   try {
                        i1 = ((Integer) value).intValue();
                        UIComponent comp = component.findComponent(forId);
                        String val = (String)((UIInput)comp).getSubmittedValue();
                        i2 = Integer.parseInt(val);
                   } catch (RuntimeException e) {
                        FacesMessage msg = new FacesMessage(e.getMessage());
                        throw new ValidatorException(msg);
                   if (i1 != i2) {
                        FacesMessage msg = new FacesMessage("Error");
                        throw new ValidatorException(msg);
         }

  • How can i compare two color images in vision builder for AI?

    What i want to do is to compare two images. I have a base color image that represents the desired colors and tones. I have another image to be compared to the base image. What i want to do is to compare this two images to know how close they are regarding contents of color and tones. In other words, i want to know how close is image 2 to image 1 (base sample)....
    I would like to know how to get the content of certain colors in an image and then compare this values with the same values from another image.
    For example..i have two sheets of paper that contain various mixed colors...i want to know the amount of green, red an blue in each image and then comapre this values.
    What i want to do is to compare difer
    ent samples of fabrics. this fabrics must be of a specified color...but due to the process they may vary in tone or even color...so i want to compare this fabrics to a amster sample to see how close they are in color and tone..
    Anything would help since i dont have experience in this type of comparisons...thanks

    VBAI allows you to work with grayscale images only. You can acquire an image, use the vision assistant to convert it grayscale by extracting the luminance plane (or any of the other color planes) and then analyze the resulting grayscale image. To do what you are talking about, though, it would really be better to get Vision for labview. You could then take color images, compare color plains, use statistical functions to determine average color values, and so on.

  • How to compare two strings whether both are equal while ignoring the difference in special characters (example: & vs & and many others)?

    I attempted to compare two strings whether they are equal or not. They should return true if both are equal.
    One string is based on Taxonomy's Term (i.e. Term.Name) whereas other string is based on String object.
    The problem is that both strings which seem equal return false instead of true. Both string values have different special characters though their special characters are & and &
    Snapshot of different design & same symbols:
    Is it due to different culture or language?
    How to compare two strings whether both are equal while ignoring the difference in special characters (& vs &)?

    Hi Jerioon,
    If you have a list of possible ambiguous characters the job is going to be easy and if (& vs &) are the only charracters in concern awesome.
    You can use the below solution.
    Before comparing pass the variables through a replace function to standarize the char set.
    $Var = Replace($Var,"&","&")
    This is going to make sure you don't end up with ambiguous characters failing the comparison and all the char are "&" in this case.
    Similar technique is used to ignore Character Cases 'a' vs. 'A'
    Regards,
    Satyajit
    Please “Vote As Helpful”
    if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.

  • I am comparing two documents. The "Not Responding" event happens for over 30 minutes.

    I am comparing two documents using FM 11 on Windows 7. The "Not Responding" event happens for over 30 minutes. When should I force the application to quit?

    It sounds like your installation is corrupted. I don't know what two checkmarks you mean, but when the Setup Assistant starts it collects some personal information after which it will return you to your normal Desktop. If it isn't doing that, then something is not right.
    I think you will need to shut down the computer, then reboot. If you are able to reboot, then check About This Mac under the pple menu to see what version of OS X it shows is installed. If it shows 10.9.x then do the following:
    Repair the Hard Drive and Permissions - Mavericks, Lion/Mountain Lion
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported then click on the Repair Permissions button. When the process is completed, then quit DU and return to the main menu. Select Restart from the Apple menu.

  • Tool for comparing two schemas....

    Do we have any tool avalilable in oracle that compares two different schemas and find out the differences between two so that we can validate a schema against a standard one?

    Hi.
    Toad have option that is called just like that , compare schemas, and when used to compare two schemas it outputs diferences between them.
    I dont know about any other tool.

  • Is there an easy way to compare two null columns?

    I need to compare a significant number of columns between records in two tables for a data conversion. I really need a comparison that will return true if: 1) both columns are null; or 2) both columns are not null and equal. I want it to return false if: 3) one column is null and the other is not; or 4) both columns are not null and are not equal. I am trying to find records which are not exact matches.
    I found documentation at oracle-base.com about the SYS_OP_MAP_NONNULL function that would do what I want, but I don't want to use this since it's an undocumented feature and my code will be in production for a period of time.
    I would rather not have to use a construct like this for each and every column I'm comparing:
              a.col is null
              and b.col is null
         or (
              a.col = b.col
    )Also, I know about the NVL function, but I'm comparing columns which are entered by users, and I'm not comfortable substituting any values for null because those values might actually exist in the data.

    Performance wasn't the issue but they will be about the same anyway. The issue was avoiding the messy syntax needed to do the job.
    Which of these looks easier to you if you had to understand and maintain the code or add new columns
    >
    I would rather not have to use a construct like this for each and every column I'm comparing:
              a.col is null
              and b.col is null
         or (
              a.col = b.col
    >
    or
    1 = DECODE (a.col, b.col, 1)So if, like the OP, you had to 'compare a significant number of columns' which syntax would you use?

Maybe you are looking for