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

Xerces External Entity reference problem

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">
]>
<doc>
<abc>xyz</abc>
<cop>&copyright;</cop>
<neha>morning</neha>
</doc>

External File: test2.xml
<copied>omg</copied>

Output:
<doc>
<abc>xyz</abc>
<cop>cop</cop>
<neha>morning</neha>
</doc>

Expected Output:
<doc>
<abc>xyz</abc>
<cop>
<copied>omg</copied>
</cop>
<neha>morning</neha>
</doc>

Questions:

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

User defined Entity Resolver (follows the Redirect sample from Xerces
documentation)

#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_Resolver:public xercesc_2_7::XMLEntityResolver
{
public:
InputSource * resolveEntity (XMLResourceIdentifier* xmlri)
{
xmlri->getSystemId();

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
appreciated.
Thanks,
Neha.

Aug 2 '06 #1
0 1316

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

Similar topics

0
by: peter greaves | last post by:
hi everyone i am having a bad time with an entity resolver. my application uses a resolver to locally-cache the nested schemas that the basic xsd includes to a local directory. however i am...
11
by: Douglas Reith | last post by:
Hi There, Can someone please tell me why the XML spec states that an attribute value with an external entity is forbidden? Or point me to the appropriate document? Or better still, perhaps you...
4
by: blu4899 | last post by:
Hi, The Xerces XML parser is reading external DTD references in DOCTYPEs by default, but is not doing anything with them because validation is turned off by default. This is documented in...
0
by: BODIN | last post by:
I have an XML document, which is actually physically stored in 2 separated files. doc1.xml and doc2.xml I NEED a WAY FOR THIS SIMPLE NEED : XML file splitted into two physical files, and use...
3
by: indo3 | last post by:
Hello Is it right that a XML document is only wellformed if all entity references can be resolved in the document? this would mean that Xerces needs to retrieve external DTD files to get...
1
by: Vineeth | last post by:
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...
4
by: SL | last post by:
Hi, Im' using Xerces-j (version 2.0.1 and 2.6.2). When parsing this prolog : <!DOCTYPE teiCorpus PUBLIC "-//TEI Consortium//DTD TEI P4//EN" "d:/Program Files/tei-emacs/sgml/dtds/tei/tei2.dtd"...
2
by: __PPS__ | last post by:
Hello everybody, I use xerces for cpp and I'm tring to adapt domprint for my own needs. What I cannot find how to do is how can I preserve certain enteties. For example, if domprint run without...
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.