473,385 Members | 1,542 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,385 software developers and data experts.

Stopping Xerces-j parser from resolving entities on its own

Hi,

I am using xerces2.6.0 and am developing a program for converting an
xml document to a text file. My program is extending the
DefaultHandler. The first problem I am facing is that even though I
have turned the Validation feature off, the SAX parser still needs the
DTD to be present. If I remove the DOCTYPE declaration from the XML
file then it raises an exception for unparsed entities. If I provide a
zero byte DTD then the SX parser parses the document. Can someone
suggest how I can remove this dependency.

The second problem that I am facing is that my XML file contains many
external entities which I donot want the SAX parser to resolve on its
own. I would be resolving those entities programatically using java
code. I want the SAX parser to return all the text as it is to me
through the characters event. In my present case it is returning only
null values in place of any external entity. I would really
appreciate any hep in the above problems.

Thankx,
Vineeth
Jul 20 '05 #1
1 2318
Hi,

Vineeth wrote:
I am using xerces2.6.0 and am developing a program for converting an
xml document to a text file. My program is extending the
DefaultHandler. The first problem I am facing is that even though I
have turned the Validation feature off, the SAX parser still needs the
DTD to be present. If I remove the DOCTYPE declaration from the XML
file then it raises an exception for unparsed entities. If I provide a
zero byte DTD then the SX parser parses the document. Can someone
suggest how I can remove this dependency.
There is a xerces-feature to ignore DTDs, see
http://xml.apache.org/xerces2-j/feat...d-external-dtd
However, afaik this is xerces-dependend, not a sax-feature.
The second problem that I am facing is that my XML file contains many
external entities which I donot want the SAX parser to resolve on its
own. I would be resolving those entities programatically using java
code. I want the SAX parser to return all the text as it is to me
through the characters event. In my present case it is returning only
null values in place of any external entity. I would really
appreciate any hep in the above problems.


You can write your own EntityResolver.

frank

--
mailto: (<mai00eej>) at (<studserv>) . (<uni-leipzig>) . (<de>)
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bekkali Hicham | last post by:
hi, i have downloaded the latest version 2.4 of Xerces, and unziped it, i end up with a diectory hierarchy like this c:\xerces-2_4_0\XercesImpl.jar c:\xerces-2_4_0\XercesSamples.jar...
1
by: Stu | last post by:
I am trying to build the xerces shared library with 2.3.0 version of their source code on an AIX 5.1 32 bit machine with the following version of the g++ compiler /usr/local/bin/g++ -v Reading...
0
by: Jim Phelps | last post by:
After having memory leak issues with Xerces-c 2.3.0 for Solaris 2.7 for CC 6.2 I have decided to update to at least 2.4. I have downloaded the binary tarball and have installed it on my...
0
by: Dale Gerdemann | last post by:
I've been trying to use DOM level 3 with xerces-2_6_2. There's a sample called samples/DOM3.java, but I've had trouble with compilation. I've downloaded Xerces-J-bin.2.6.2 and...
4
by: MBR | last post by:
Help! Does anybody know a simple example how to use xerces (http://xml.apache.org) with C++ to parse a simple xml file, go from node to node and read the data in the nodes? Thanks, Matthias
18
by: jacksu | last post by:
I have a simple program to run xpath with xerces 1_2_7 XPathFactory factory = XPathFactory.newInstance(); XPath xPath = factory.newXPath(); XPathExpression xp = xPath.compile(strXpr);...
4
by: Sanjay Kumar | last post by:
Folks ! I am working with VC++ after a long time and having problem linking latest xerces 2.7 in VC++ 2005 Express Edition. I have done following: 1. downloaded and unpacked the the...
2
by: Vlad Zorinov | last post by:
I'm getting the following error after a couple of months of XML processing, using Xerces 2.0.0 in an apache tomcat. Does anyone have any ideas what this problem may be or what I should do to solve...
3
by: Raphael Tagliani | last post by:
(english version below) Bonjour! Je travaille sur un gros projet java, qui parse beaucoup de fichiers xml au lancement d'un serveur. Nous avons un problème de concurrence qu lancement. En...
5
by: mearvk | last post by:
Hello, Let me preface this post by saying I'm new to C/C++ and to gcc/g++. Now then, I'm trying to get Xerces (C++) working on a (64-bit) redhat machine. The Xerces binaries were part of the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.