You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Arindam Chandra <Ar...@ushacomm.co.in> on 2002/06/15 14:57:58 UTC

Problem with external entities.

Hi,
    I am encountering some problems in refering external entities from
an xml file using Xerces C++ parser version 1.7.0. I am working with
Windows NT. The problems are described below,-
 
In the refered.xml there is an element refered-elem. From the
refering.xml I am referring to this element as 
 
<pls>&refered-elem;</pls>
 
and I have declared this entity in testref.dtd (refered.xml refers to
this DTD) as
 
<!ENTITY refered-elem SYSTEM "refered.xml">
refered.xml and refering.xml are located under the same directory in the
local file system. When I am running the Xerces java parser with these
files I'm getting the expected output. But when I run the Xerces C++
parser through SAX2Count.cpp (provided as a sample with the downloaded
parser), I am getting the following error,-
Fatal Error at file
E:\Arindam\CPPTests\xerces-c-src1_7_0\xerces-c-src1_7_0\Build\Win32\VC6\
Release\refered.xml, line 2, char 2
  Message: Expected comment or CDATA

Seems that it can't recognize the document type definition <!DOCTYPE
refered-elem SYSTEM "testref1.dtd">. One point to note here is that we
really don't need any DTD for refered.xml . If I remove this DOCTYPE
line from refered.xml, it works fine with the java parser. But with the
C++ parser it gives the following errors,-

Error at file
E:\Arindam\CPPTests\xerces-c-src1_7_0\xerces-c-src1_7_0\Build\Win32\VC6\
Release\refered.xml, line 3, char 15
  Message: Unknown element 'refered-elem'


Error at file
E:\Arindam\CPPTests\xerces-c-src1_7_0\xerces-c-src1_7_0\Build\Win32\VC6\
Release\refering.xml, line 17, char 27
  Message: Element 'refered-elem' is not valid for content model:
'(#PCDATA)'

Seems that the parser is looking for a DTD for refered.xml. Any
suggestion to solve this will be very much welcome.

Thanks and Regards,

Arindam Chandra

Software Professional
Product Dev - R & D
Ushacomm India Limited
Bangalore
Ph: 91-33-2822803 extn-328.