473,322 Members | 1,314 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,322 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 1319

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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.