Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

validating XML file against external DTD in PLSQL

18786Sep 20 2008 — edited Sep 20 2008
Hello

I m using XML to transfer data between different system.
I recieve XML data which i then load into an Oracle database
I have followed some example to load the files into CLOB , then parse these CLOB using dbms_xmlparser.parseClob(l_parser, l_clob), and then i was able to extract the nodes i required successfully

The current requirement is to validate the XML files with external DTD,

I have seen some hints here and there, but i could not get the document to do

1) one option was to load the DTD into the XML repository ,,, and my question is how to do it, and how to reach the root node .. any reference please
2) I have seen an example where the DTD file was read into a CLOB, parsed then
the XML file parsed

xmlparser.parseDTDClob( PARSER , DTD_SOURCE , 'xx' );
DTD_DOCUMENT := xmlparser.getDoctype( PARSER );
xmlparser.setValidationMode( PARSER , true );
xmlparser.setDoctype( PARSER , DTD_DOCUMENT );
DBMS_XMLPARSER.parseClob( PARSER , v_xml );

I tried the second appoarch using the following XML

<?xml version="1.0" encoding="UTF-8"?>
*<!DOCTYPE family SYSTEM "testdtd.dtd">*
<college>
<master>
<id>10</id>
<name>ammar</name>
<row>
<student_id>1</student_id>
<student_name>Ahmad</student_name>
</row>
<row>
<student_id>2</student_id>
<student_name>Samia</student_name>
</row>
</master>
</college>


and i recieved ORA-31001: Invalid resource handle or path name "/testdtd.dtd"
when the DBMS_XMLPARSER.parseClob( PARSER , v_xml ); is executed
i removed the *<!DOCTYPE family SYSTEM "testdtd.dtd">* from the XML file
the procedures worked , but not sure if really validated against the DTD file



best regards

Ammar Sajdi
REALSOFT Advanced applications
www.e-ammar.com/Oracle.htm
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 18 2008
Added on Sep 20 2008
2 comments
1,008 views