473,659 Members | 2,922 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error in parsing XML File

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 24 '07 #1
0 4041

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

Similar topics

2
412
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
6
3875
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
2
1472
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 get the following error on the server:
8
1898
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.
14
2049
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 resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: The file '/index.ascx.cs' does not exist.
0
2020
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
0
1987
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 where you can double click a compile error/warning message and be guided to the file/line in question. Using sed to filter output from the compiler i managed to make the error output look like the ones generated from the regular compiler, and...
12
7179
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 Debug-------------------- Compiling... pre.c c:\matlab6p5\work\penat\grt_main.c(661) : fatal error C1004: unexpected end of file found Error executing cl.exe.
3
4592
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'" is reported. .... <pages> <namespaces> <clear></clear> <add namespace="System"/>
3
4507
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...
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8627
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
7356
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
6179
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
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2752
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
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.