HOWTO: Compile a XML Schema in XMLDB

Just a simple script I want to keep for posterity. The foundations were laid by Mark Drake.

-- --------------------------------------------------------
--
-- Author     : Mark Drake
-- Purpose    : Compiling XML Schema
--
-- Altered    : Marco Gralike
-- Date       : 09/02/2007
-- Alteration : Different error handling
-- 
--
-- --------------------------------------------------------
set echo on 
 
-- spool compileSchemas.log 
-- connect &USERNAME/&PASSWORD 
-- set serveroutput on 
-- 
 
declare 
 
cursor getSchemaList is 
  select schema_url 
  from user_xml_schemas; 
 
begin 
 
for schema in getSchemaList 
loop 
  begin 
    dbms_output.put_line('Processing : ' || schema.schema_url); 
    dbms_xmlschema.compileSchema(schema.schema_url); 
    dbms_output.put_line('Compiled'); 
  exception when others then 
    dbms_output.put_line('Failed ('||SQLCODE||'): ' ||SQLERRM); 
  end; 
end loop; 
end; 
/ 

-- --------------------------------------------------------

The “Invalid XDB schema – how to identify?” part, can be found in the following OTN XMLDB Forum Thread [here]

Marco Gralike Written by:

2 Comments

  1. September 8

    You’ve said “Just a simple script I want to keep for prosperity.” I presume you mean posterity not prosperity!!

    Anyway, thanks for the script.

    Regards,

    Praveen

  2. Marco Gralike
    September 9

    Your right of course 😉
    Thanks for the hint ! I altered the text.

Comments are closed.