Hi folks,
I'm trying to validate an XML file against XSD schema within database package.
When I validate it in external software (Liquid XML studio), file passes validation agains it's schema.
Here are my steps and error which I'm getting:
1. Registering XSD
BEGIN
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => 'http://www.slc.co.uk/hei/sis-v0.4.xsd',
SCHEMADOC => bfilename('XSD_DIR','sis-v0.4.xsd'),
LOCAL => TRUE,
GENTYPES => TRUE,
genbean => FALSE,
GENTABLES => FALSE,
force => FALSE,
CSID => nls_charset_id('UTF8'));
END;
/
2. part of my package code
create or replace package SLC_RETURN is
c_xsd_validate_schema constant varchar2(20) := 'http://www.slc.co.uk/hei/sis-v0.4.xsd';
-- TEST PURPOSE ONLY
procedure spit_xml_and_validate (p_xml_clob clob);
end SLC_RETURN;
create or replace package body SLC_RETURN is
...
procedure spit_xml_and_validate (p_xml_clob clob) is
l_xml XMLTYPE;
l_exception varchar2(4000);
BEGIN
dbms_output.put_line ('Starting XML Splitting...');
begin
l_xml := xmltype(p_xml_clob);
l_xml := l_xml.createSchemaBasedXML(c_xsd_validate_schema);
xmltype.schemaValidate(l_xml);
EXCEPTION
when OTHERS then
dbms_output.put_line('Document not valid');
l_exception := sqlerrm;
dbms_output.put_line('Error: ' || l_exception);
end;
EXCEPTION
WHEN OTHERS THEN
raise;
END spit_xml_and_validate;
...
end SLC_RETURN;
3. In table SLC_XML i have stored my XML file which I want to validate against it's schema
declare
l_xml blob;
begin
select xml.xml into l_xml from SLC_XML xml where object_id = 672211688;
slc_return.spit_xml_and_validate(slc_return.convert_blob_to_clob(l_xml));
end;
4. dbms_output
Starting XML Splitting...
Document not valid
Error: ORA-31154: invalid XML document
ORA-19202: Error occurred in XML processing
LSX-00235: invalid URI "http://www.slc.co.uk/hei/sis-v0.4.xsd"
Tesing files could be temporary found
HERE.
"CoC_20091201_1340_01.xml" is a file which I'm trying to validate against "sis-v0.4.xsd" schema.
"sis-v0.4.xsd" is referencing other xsd schemas. Is this a problem?
I'm using 10g database, release 1 only!
Thanks,
Tomas