473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Error in parsing XML File

Hello,

I am running Oracle 10g R2 in our office. I created the following procedure. It is suppose to access an xml file ( family.xml). The procedure is compiled and when I try to run it, i get the following error.

SQL> execute domsample('c:\','song.xml','error.txt')
BEGIN domsample('c:\','song.xml','error.txt

*
ERROR at line 1:
ORA-31001: Invalid resource handle or path
ORA-06512: at "SYS.XDBURITYPE", line 11
ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line
ORA-29280: invalid directory path
ORA-29280: invalid directory path
ORA-29280: invalid directory path
ORA-06512: at "XDB.DBMS_XMLPARSER", line 11
ORA-06512: at "BRREG.DOMSAMPLE", line 81
ORA-06512: at line 1



Source Code:
============

create or replace procedure domsample(dir varchar2, inpfile varchar2,
errfile varchar2) is
p DBMS_XMLPARSER.parser;
doc dbms_xmldom.DOMDocument;

-- prints elements in a document
procedure printElements(doc xmldom.DOMDocument) is
nl xmldom.DOMNodeList;
len number;
n dbms_xmldom.DOMNode;

begin
-- get all elements
nl := dbms_xmldom.getElementsByTagName(doc, '*');
len := dbms_xmldom.getLength(nl);

-- loop through elements
for i in 0..len-1 loop
n := dbms_xmldom.item(nl, i);
dbms_output.put(dbms_xmldom.getNodeName(n) || ' ');
end loop;

dbms_output.put_line('');
end printElements;

-- prints the attributes of each element in a document
procedure printElementAttributes(doc dbms_xmldom.DOMDocument) is
nl dbms_xmldom.DOMNodeList;
len1 number;
len2 number;
n dbms_xmldom.DOMNode;
e dbms_xmldom.DOMElement;
nnm dbms_xmldom.DOMNamedNodeMap;
attrname varchar2(100);
attrval varchar2(100);

begin

-- get all elements
nl := dbms_xmldom.getElementsByTagName(doc, '*');
len1 := dbms_xmldom.getLength(nl);

-- loop through elements
for j in 0..len1-1 loop
n := dbms_xmldom.item(nl, j);
e := dbms_xmldom.makeElement(n);
dbms_output.put_line(dbms_xmldom.getTagName(e) || ':');

-- get all attributes of element
nnm := dbms_xmldom.getAttributes(n);

if (dbms_xmldom.isNull(nnm) = FALSE) then
len2 := dbms_xmldom.getLength(nnm);

-- loop through attributes
for i in 0..len2-1 loop
n := dbms_xmldom.item(nnm, i);
attrname := dbms_xmldom.getNodeName(n);
attrval := dbms_xmldom.getNodeValue(n);
dbms_output.put(' ' || attrname || ' = ' || attrval);
end loop;
dbms_output.put_line('');
end if;
end loop;

end printElementAttributes;

begin

-- new parser
p := DBMS_XMLPARSER.newParser;

-- set some characteristics
DBMS_XMLPARSER.setValidationMode(p, FALSE);
DBMS_XMLPARSER.setErrorLog(p, dir || '/' || errfile);
DBMS_XMLPARSER.setBaseDir(p, dir);

-- parse input file
DBMS_XMLPARSER.parse(p, dir || inpfile);

-- get document
doc := DBMS_XMLPARSER.getDocument(p);

-- Print document elements
dbms_output.put('The elements are: ');
printElements(doc);

-- Print document element attributes
dbms_output.put_line('The attributes of each element are: ');
printElementAttributes(doc);

-- deal with exceptions
exception when others then null;

end domsample;


Family.xml
==========
<?xml version="1.0"?>
<!DOCTYPE SONG SYSTEM "c:\song.dtd">
<SONG>
<TITLE>Hot Cop</TITLE>
<COMPOSER>Jacques Morali</COMPOSER>
<COMPOSER>Henri Belolo</COMPOSER>
<COMPOSER>Victor Willis</COMPOSER>
<PRODUCER>Jacques Morali</PRODUCER>
<PUBLISHER>PolyGram Records</PUBLISHER>
<LENGTH>6:20</LENGTH>
<YEAR>1978</YEAR>
<ARTIST>Village People</ARTIST>
</SONG>

family.dtd
-----------

<!ELEMENT SONG (TITLE, COMPOSER+, PRODUCER*, PUBLISHER*,
LENGTH?, YEAR?, ARTIST+)>

<!ELEMENT TITLE (#PCDATA)>

<!ELEMENT COMPOSER (#PCDATA)>
<!ELEMENT PRODUCER (#PCDATA)>
<!ELEMENT PUBLISHER (#PCDATA)>
<!ELEMENT LENGTH (#PCDATA)>
<!-- This should be a four digit year like "1999",
not a two-digit year like "99" -->
<!ELEMENT YEAR (#PCDATA)>

<!ELEMENT ARTIST (#PCDATA)>



Help is needed urgently. Please solve my problem.


Thanks,

Venkat
Jun 24 '07 #1
0 4005

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: ST | last post by:
Hi, I keep getting the parser error, and I have no idea why. I've tried a number of things including: 1)building/rebuilding about 100x 2)making sure all dll's are in the bin folder in the root...
6
by: ST | last post by:
Hi, I keep getting the parser error, and I have no idea why. I've tried a number of things including: 1)building/rebuilding about 100x 2)making sure all dll's are in the bin folder in the root...
2
by: Brett | last post by:
I uploaded an ASP.NET website from my developer machine to a remote server. The paths differ slightly as follows: Local Path: C:\Inetpub\wwwroot\mysite Server Path: C:\Inetpub\mysite.com\ I...
8
by: Brett Romero | last post by:
I get this error when I try to run my ASP.NET app on our server: Server Error in '/' Application. -------------------------------------------------------------------------------- Parser Error...
14
by: brett | last post by:
I have an ASP.NET 2.0 web application that runs fine on my local machine. However, once I upload it, I get this error: Parser Error Description: An error occurred during the parsing of a...
0
by: poojamangal | last post by:
I want to upload images or pdf files. but i m unable to do so. i got error. please help me to sort it out.. my code is: <% 'on error resume next Class FreeASPUpload Public UploadedFiles...
0
by: =?Utf-8?B?VWxmIFRob3JzZW4=?= | last post by:
I use Visual Studio 2005 for a C-project using an external compiler, and came up with the idea that error parsing would be neat, i.e. enabling the functionality available for a "normal" build...
12
by: jonatan | last post by:
Hello All, I am making a program and need the grt_main.c but i try to compile have the error c1004.Please help me how to solve it? Thank you. --------------------Configuration: pre - Win32...
3
by: =?Utf-8?B?RGFuYQ==?= | last post by:
I am re-posting this message after registering my posting alias. When I specify an end tag for the clear element of namespaces in my web.config file, the parser error "Unrecognized element 'add'"...
3
by: GazK | last post by:
I have been using an xml parsing script to parse a number of rss feeds and return relevant results to a database. The script has worked well for a couple of years, despite having very crude...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.