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 "Neha Chopra (JIRA)" <xe...@xml.apache.org> on 2006/08/02 22:13:13 UTC

[jira] Created: (XERCESC-1622) external entity reference

external entity reference
-------------------------

                 Key: XERCESC-1622
                 URL: http://issues.apache.org/jira/browse/XERCESC-1622
             Project: Xerces-C++
          Issue Type: Bug
          Components: DOM
         Environment: Visual Studio
            Reporter: Neha Chopra


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>


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.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


[jira] Closed: (XERCESC-1622) external entity reference

Posted by "Alberto Massari (JIRA)" <xe...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XERCESC-1622?page=all ]

Alberto Massari closed XERCESC-1622.
------------------------------------

    Resolution: Cannot Reproduce

Running DOMPrint -v=never test1.xml retruned this

<?xml version="1.0" encoding="UTF-8" standalone="no" ?><!DOCTYPE doc [
<!ENTITY copyright SYSTEM "test2.xml">
]><doc>
<abc>xyz</abc>
<cop><copied>omg</copied> </cop>
<neha>morning</neha>
</doc>

with the entity reference expanded

> external entity reference
> -------------------------
>
>                 Key: XERCESC-1622
>                 URL: http://issues.apache.org/jira/browse/XERCESC-1622
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: DOM
>         Environment: Visual Studio
>            Reporter: Neha Chopra
>
> 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>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org