set echo on
--
begin
  if (dbms_xdb.existsResource('/home/%USER%/diff/xmlSchemaDiff.v2.xml')) then
    dbms_xdb.deleteResource('/home/%USER%/diff/xmlSchemaDiff.v2.xml');
  end if;
end;
/
declare
  res boolean;
  diffxml xmltype;
begin

  select xmldiff
         (
            xdbUriType('%BASEFOLDER%/xsd/purchaseOrder.E999.xsd').getXML(),
            xdbUriType('%BASEFOLDER%/xsd/purchaseOrder.v2.xsd').getXML()
         )
   into diffxml
    from dual;

  res := dbms_xdb.createResource('/home/%USER%/diff/xmlSchemaDiff.v2.xml',diffxml);
  
  commit;
end;
/
quit