«

»

Apr 08 2007

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]

2 comments

  1. Praveen

    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

    Your right of course ;-)
    Thanks for the hint ! I altered the text.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>