Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Xerces External Entity reference problem

Thread Tools

Xerces External Entity reference problem
Posts: n/a
I am developing an Application which currently has two XML files. One
XML file with some nodes and an external entity reference to another
XML file. The source XML file is being parsed using Xerces (DOM
Parser), upon reaching an external entity reference node the external
file being referenced does not get parsed. Instead an empty node or the
current node name is substituted in place and the remaining nodes
parsed from original source file are seen in the output text file.

Source XML File: test.xml
<?xml version="1.0"?>
<!DOCTYPE doc [
<!ENTITY copyright SYSTEM "test2.xml">

External File: test2.xml


Expected Output:


An entity resolver was installed but resulted in similar output as
defined above.

User defined Entity Resolver (follows the Redirect sample from Xerces

#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/util/XMLResourceIdentifier.hpp>
#include <xercesc/util/XMLEntityResolver.hpp>
#include <xercesc/framework/LocalFileInputSource.hpp>

Static const XMLCh module[] = {
chLatin_t,chLatin_e,chLatin_s,chLatin_t,chDigit_2, chPeriod,chLatin_x,chLatin_m,chLatin_l};

class My_Resolverublic xercesc_2_7::XMLEntityResolver
InputSource * resolveEntity (XMLResourceIdentifier* xmlri)

return new LocalFileInputSource(module);



I have searched the API documentation and looked at the mail archive
but not found anything. Any help toward solving this problem would be

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Entity, problem with entity key ASP .Net 1 09-07-2009 02:20 AM
How to relate a SQL based entity with an Object based entity in Entity Framework markla ASP .Net 1 10-06-2008 09:42 AM
Upgrade of Xalan 1.2.2 and Xerces 1.4.4 to Xalan 2.6 and Xerces 2.6.2 cvissy XML 0 11-16-2004 07:06 AM
PyXML, Sax, error in processing external entity reference David Dorward Python 2 02-28-2004 06:59 AM
Xerces exception with entity resolver and nested XSDs peter greaves XML 0 06-25-2003 02:00 PM