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

Relative URL resolving broken

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 2.5.0
    • 2.6.0
    • Miscellaneous
    • None
    • Operating System: Other
      Platform: Other
    • 27898

    Description

      Filesystem structure:

      /a.xml
      /dtd/a.dtd
      /ent/a.ent

      • A dokument (a.xml for example) with an external DTD give (dtd/a.dtd for example).
      • The DTD declares an external entity (../ent/a.ent for example)
      • The dokument refers to the entity

      =>The parser tries to resolve (../ent/a.ent) relative to the path of the
      document and not to the dtd => That's wrong!

      The problem - in my opinion - is within the function createReader in
      internal/ReaderMgr.cpp:

      XMLReader* ReaderMgr::createReader( const XMLCh* const baseURI
      , const XMLCh* const sysId
      , const XMLCh* const pubId
      , const bool xmlDecl
      , const XMLReader::RefFrom refFrom
      , const XMLReader::Types type
      , const XMLReader::Sources source
      , InputSource*& srcToFill
      , const bool calcSrcOfs)
      {
      ...
      if ((!urlTmp.setURL((!baseURI || !*baseURI) ? lastInfo.systemId :
      baseURI, expSysId.getRawBuffer(), urlTmp)) ||
      (urlTmp.isRelative()))

      { if (!fStandardUriConformant) srcToFill = new (fMemoryManager) LocalFileInputSource ( lastInfo.systemId // !!!! sould be (!baseURI || !*baseURI) ? lastInfo.systemId : baseURI , expSysId.getRawBuffer() , fMemoryManager ); else ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); }

      ...
      }

      This path works for me within Xerces-C 2.5

      Attachments

        Activity

          People

            Unassigned Unassigned
            floerke@doctronic.de Holger Floerke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: