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 bu...@apache.org on 2004/03/24 11:17:58 UTC

DO NOT REPLY [Bug 27898] New: - Relative URL resolving broken

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27898>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27898

Relative URL resolving broken

           Summary: Relative URL resolving broken
           Product: Xerces-C++
           Version: 2.5.0
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Miscellaneous
        AssignedTo: xerces-c-dev@xml.apache.org
        ReportedBy: floerke@doctronic.de


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

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