Edit report at https://bugs.php.net/bug.php?id=65365&edit=1

 ID:                 65365
 User updated by:    mike at skew dot org
 Reported by:        mike at skew dot org
-Summary:            baseURI should always be a real URI
+Summary:            Allow defining baseURI of doc not loaded directly
                     from URL
 Status:             Open
 Type:               Feature/Change Request
 Package:            DOM XML related
 Operating System:   FreeBSD 8.4-RELEASE
 PHP Version:        5.4.17
 Block user comment: N
 Private report:     N

 New Comment:

Fixed summary (request title).


Previous Comments:
------------------------------------------------------------------------
[2013-07-31 05:49:18] mike at skew dot org

Description:
------------
As I noted in Request #65364, when loading an XML document from memory (string, 
file, whatever), such as via DOMDocument::loadXml(), PHP tells libxml to use a 
particular default value as the base URI, and this value is then exposed 
through 
the baseURI property in the DOM.

It's quite possible that the XML has been cached or otherwise came from 
somewhere that's known, and the app will want to use a particular URL as the 
base URI at parse time. It would be nice, then, when the app does get around to 
parsing, for it to see the same baseURI properties as if DOMDocument::load() 
had 
been used with the original URL.

So, regardless of what the default base URI is, PHP should provide a way to 
override it at parse time. I suggest allowing loadXml() to take another 
argument: a string for the base URI.

This will help with using the baseURI property for what is ostensibly its 
purpose: resolving relative URI references in the document, such as href values 
in XHTML documents and Atom feeds.



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65365&edit=1

Reply via email to