1

I'm developing some test framework. I suppose to validate the extremely complex XML responses with local data.

I thought to have local data in the CSV format and achieved some validation but I found the limitation of this frameworks that I can't validate complex data e.g.

<?xml version='1.0' encoding='UTF-8'?>
 <!DOCTYPE ResourceObject PUBLIC "abc_corp.dtd" "abc_corp.dtd">
 <ResourceObject displayName="abcd" identity="pqr" objectType="account" uuid="123456">
   <Attributes>
     <Map>
       <entry key="memberOf"/>
       <entry key="objectClass">
         <value>
           <List>
             <String>top</String>
             <String>person</String>
             <String>organizationalPerson</String>
             <String>user</String>
           </List>
         </value>
       </entry>
       <entry key="objectSid" value="S-1-5"/>
       <entry key="objectType" value="user"/>
          <value>
           <List>
             <Permission rights="allow:elasticmapreduce:Describe*" target="*"/>
             <Permission rights="allow:elasticmapreduce:List*" target="*"/>
             <Permission rights="allow:elasticmapreduce:ViewEventsFromAllClustersInConsole" target="*"/>
             <Permission rights="allow:s3:GetObject" target="*"/>
             <Permission rights="allow:s3:ListAllMyBuckets" target="*"/>
             <Permission rights="allow:s3:ListBucket" target="*"/>
             <Permission rights="allow:sdb:Select" target="*"/>
             <Permission rights="allow:cloudwatch:GetMetricStatistics" target="*"/>
           </List>
         </value>
       </entry>
     </Map>
   </Attributes>
 </ResourceObject>

Out of above XML object below entry is something hard to represent in the CSV format

       <entry key="objectType" value="user"/>
          <value>
           <List>
             <Permission rights="allow:elasticmapreduce:Describe*" target="*"/>
             <Permission rights="allow:elasticmapreduce:List*" target="*"/>
             <Permission rights="allow:elasticmapreduce:ViewEventsFromAllClustersInConsole" target="*"/>
             <Permission rights="allow:s3:GetObject" target="*"/>
             <Permission rights="allow:s3:ListAllMyBuckets" target="*"/>
             <Permission rights="allow:s3:ListBucket" target="*"/>
             <Permission rights="allow:sdb:Select" target="*"/>
             <Permission rights="allow:cloudwatch:GetMetricStatistics" target="*"/>
           </List>
         </value>
       </entry>

Or XML data which hold list of maps etc.

Is there any framework, library available which could validate such a complex XML data?

Swapnil Kotwal
  • 5,418
  • 6
  • 48
  • 92

1 Answers1

1

Have a look at these for reference..

  1. https://javarevisited.blogspot.com/2017/04/how-to-compare-two-xml-files-in-java.htm
  2. Best way to compare 2 XML documents in Java
    //creating Diff instance to compare two XML files 
    Diff xmlDiff = new Diff(source, target); 

    //for getting detailed differences between two xml files 
    DetailedDiff detailXmlDiff = new DetailedDiff(xmlDiff);

Hope this helps.

Reeta Wani
  • 197
  • 4
  • 13