Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-498

External entities cannot be referred properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Incomplete
    • 1.7.0
    • None
    • None
    • Operating System: Windows NT/2K
      Platform: PC
    • 9907

    Description

      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.

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--SAX2Count.hpp
          5 kB
          Arindam Chandra
        2. ASF.LICENSE.NOT.GRANTED--SAX2Count.cpp
          13 kB
          Arindam Chandra
        3. ASF.LICENSE.NOT.GRANTED--SAX2CountHandlers.hpp
          6 kB
          Arindam Chandra
        4. ASF.LICENSE.NOT.GRANTED--SAX2CountHandlers.cpp
          7 kB
          Arindam Chandra
        5. ASF.LICENSE.NOT.GRANTED--testref1.dtd
          0.1 kB
          Arindam Chandra
        6. ASF.LICENSE.NOT.GRANTED--testref.dtd
          0.5 kB
          Arindam Chandra
        7. ASF.LICENSE.NOT.GRANTED--refered.xml
          0.1 kB
          Arindam Chandra
        8. ASF.LICENSE.NOT.GRANTED--refering.xml
          0.4 kB
          Arindam Chandra

        Activity

          People

            Unassigned Unassigned
            arindam.chandra@ushacomm.co.in Arindam Chandra
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: