-1

IS there a way to compare all tags in two xml ? I'm using xmlunit2.3 to do some other stuff.

Example : XML1 :

<A>
<a>
<b>
</A>
<B>
<a>
<b>
<c>
</B>

Size of XML1 = 9

XML2 :

<A>
<a>
<b>
</A>
<B>
<a>
<b>
</B>

Size of XML2 = 8

Thanks in advance

tim_yates
  • 167,322
  • 27
  • 342
  • 338
Hamza Amami
  • 94
  • 4
  • 21
  • What you have tried? May be you can check this one and see if this is helpful - http://stackoverflow.com/questions/40743664/groovy-compare-soap-response-with-xml-file/40745555#40745555 – Rao Nov 29 '16 at 12:29
  • I searched the occurence of "<" in both xml to find the number of tags in an xml file – Hamza Amami Nov 29 '16 at 12:48
  • That may not be good way, because in case if there is `CDATA` and it has `<` as part of data, then it may results incorrect. By the way, try the solution mentioned in the above link. – Rao Nov 29 '16 at 13:23
  • Ok, thanks bro ! But the solutions above is for recursive compare, I want to calculate a size of a Soap – Hamza Amami Nov 29 '16 at 13:33
  • What do you mean by size of soap¿ – Rao Nov 29 '16 at 13:36
  • number of all tags , an xml file that contains have a size of 2. – Hamza Amami Nov 29 '16 at 13:45
  • Well I just find all occurrence of (<) on my xml, as a first solution. – Hamza Amami Nov 29 '16 at 11:23
  • Have you tried the given link in the first comment? Or at least provide the xml snippet closure of your data because what you quoted is not even well formed xml. – Rao Nov 29 '16 at 17:09

1 Answers1

0

This check has to be done in the XMLParser you are using, either your own or a existing. The XML language does support it.

Vincent
  • 4,342
  • 1
  • 38
  • 37