membrane / soa-model

Toolkit and Java API for WSDL, WADL and XML Schema.
http://www.membrane-soa.org/soa-model/
Apache License 2.0
93 stars 73 forks source link

Displaying similarity percentage of comparing XSD #275

Closed balnamlah closed 4 years ago

balnamlah commented 4 years ago

Is there a way to display the similarity percentage of comparing XSD files? Currently the code displays the difference as a text, I need it as a number

rrayst commented 4 years ago

Hi @balnamlah , soa-model currently offers no such functionality. Feel free to

balnamlah commented 4 years ago

how to count the length of the diff? is there a method?

balnamlah commented 4 years ago

here is the code

 List<Difference> lst = diffGen.compare();
        for (Difference diff : lst) {

          dumpDiff(diff, "");   

        }
System.out.println("counter is" +counter);
    }

      private static void dumpDiff(Difference diff, String level) {

        System.out.println( level + diff.getDescription());

        for (Difference localDiff : diff.getDiffs()){
          dumpDiff(localDiff, level + "  ");
          counter++;

        }

the counter will count each time system enter this method which is wrong If this is my output

ComplexType Address removed.
ComplexType Student:
  Sequence:
    Element course:
      MinOccurs changed from 0 to 1.
  Attribute grade removed.
ComplexType Course:
  The attribute use has changed from optional to required.

the result is = 5, but it should be = 4