473,729 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error parsing xml files - Help urgently needed.

2 New Member
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','er ror.txt')
BEGIN domsample('c:\' ,'song.xml','er ror.txt

*
ERROR at line 1:
ORA-31001: Invalid resource handle or path
ORA-06512: at "SYS.XDBURITYPE ", line 11
ORA-06512: at "XDB.DBMS_XSLPR OCESSOR", line
ORA-29280: invalid directory path
ORA-29280: invalid directory path
ORA-29280: invalid directory path
ORA-06512: at "XDB.DBMS_XMLPA RSER", line 11
ORA-06512: at "BRREG.DOMSAMPL E", 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.DOM Document;

-- prints elements in a document
procedure printElements(d oc xmldom.DOMDocum ent) is
nl xmldom.DOMNodeL ist;
len number;
n dbms_xmldom.DOM Node;

begin
-- get all elements
nl := dbms_xmldom.get ElementsByTagNa me(doc, '*');
len := dbms_xmldom.get Length(nl);

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

dbms_output.put _line('');
end printElements;

-- prints the attributes of each element in a document
procedure printElementAtt ributes(doc dbms_xmldom.DOM Document) is
nl dbms_xmldom.DOM NodeList;
len1 number;
len2 number;
n dbms_xmldom.DOM Node;
e dbms_xmldom.DOM Element;
nnm dbms_xmldom.DOM NamedNodeMap;
attrname varchar2(100);
attrval varchar2(100);

begin

-- get all elements
nl := dbms_xmldom.get ElementsByTagNa me(doc, '*');
len1 := dbms_xmldom.get Length(nl);

-- loop through elements
for j in 0..len1-1 loop
n := dbms_xmldom.ite m(nl, j);
e := dbms_xmldom.mak eElement(n);
dbms_output.put _line(dbms_xmld om.getTagName(e ) || ':');

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

if (dbms_xmldom.is Null(nnm) = FALSE) then
len2 := dbms_xmldom.get Length(nnm);

-- loop through attributes
for i in 0..len2-1 loop
n := dbms_xmldom.ite m(nnm, i);
attrname := dbms_xmldom.get NodeName(n);
attrval := dbms_xmldom.get NodeValue(n);
dbms_output.put (' ' || attrname || ' = ' || attrval);
end loop;
dbms_output.put _line('');
end if;
end loop;

end printElementAtt ributes;

begin

-- new parser
p := DBMS_XMLPARSER. newParser;

-- set some characteristics
DBMS_XMLPARSER. setValidationMo de(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(d oc);

-- Print document element attributes
dbms_output.put _line('The attributes of each element are: ');
printElementAtt ributes(doc);

-- deal with exceptions
exception when others then null;

end domsample;


Family.xml
==========
<?xml version="1.0"?>
<!DOCTYPE SONG SYSTEM "c:\song.dt d">
<SONG>
<TITLE>Hot Cop</TITLE>
<COMPOSER>Jacqu es Morali</COMPOSER>
<COMPOSER>Hen ri Belolo</COMPOSER>
<COMPOSER>Victo r Willis</COMPOSER>
<PRODUCER>Jacqu es Morali</PRODUCER>
<PUBLISHER>Poly Gram Records</PUBLISHER>
<LENGTH>6:20</LENGTH>
<YEAR>1978</YEAR>
<ARTIST>Villa ge 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 22 '07 #1
1 4929
debasisdas
8,127 Recognized Expert Expert
Since this question was in Article section Moved to Oracle Forum.
Jun 22 '07 #2

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

Similar topics

0
423
by: ex laguna | last post by:
I have run into this problem below with py2exe version 0.5.0 and python 2.3.3. Does anyone know a solution or workaround for this? Thanks much! ## Begin of test.py import shelve f = shelve.open('test.txt') f = 'world' f.close()
67
4268
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. Unfortunately these ad hominem rhetorts are frequently introduced into purely technical discussions on the feasibility of supporting such functionality in C++. That usually serves to divert the discussion from the technical subject to a discussion of the...
4
2717
by: Don Wash | last post by:
Hi All! I'm getting the following Error: No DLLs has been compiled yet and nothing in the \bin directory. So it is not the versioning problem or anything like that. And here are the source of the files...
6
3886
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 of the web app 3)restarting IIS 4)recreating the virtual dir in IIS 5)playing with any and all settings I could find for the web app in IIS, including changing permissions 6)recopying the machineconfig file from my asp v1.4... onto my local server
8
1904
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 Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
3
4385
by: toton | last post by:
Hi, I have some ascii files, which are having some formatted text. I want to read some section only from the total file. For that what I am doing is indexing the sections (denoted by .START in the file) with the location. And for a particular section I parse only that section. The file is something like, .... DATAS
0
4046
by: janakivenk | last post by:
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
0
2025
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 Public FormElements Private VarArrayBinRequest
3
4512
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 error-trapping (if it finds an error in one of the xml files, the script stops). Recently, the script has stopped working because one of the xml files is badly formed. So I decided to rewrite the script with better error trapping; the script should...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8148
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2163
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.