IXMLParser::SetURL
4/8/2010
This method provides input to the parser by passing in a base URL and relative URL from which files can be loaded.
Syntax
HRESULT SetURL(
const WCHAR * pszBaseUrl,
const WCHAR * pszRelativeUrl,
BOOL fAsync
);
Parameters
- pszBaseUrl
[in] This parameter is optional and eliminated the need to manually resolve URLs.
pszRelativeUrl
[in] Passing a full URL for pszRelativeURL overrides the value of pszBaseURL, and the pszBaseURL can be NULL. The value of pszRelativeURL cannot be null.The value of this parameter can be a directory as long as there is a trailing "/" (https://www.microsoft.com/xml/, for example).
- fAsync
[in] The async flag. Controls whether an HTTP request is handled synchronously or asynchronously. If the value of this parameter is async, IXMLParser::Run will return E_PENDING and the message queue must be pumped. When data becomes available, the parser will be notified by URLMON (through the message queue) and will parse the new data and the IXMLNodeFactory interface will continue to be called.
Return Value
This function returns S_OK if the function is successful, otherwise an error code is returned.
Remarks
The IXMLParser::SetURL method is one of four different methods for providing input to the parser. The other methods are IXMLParser::Load, IXMLParser::SetInput, and IXMLParser::PushData. The IXMLParser::SetURL method takes a base URL and a relative URL.
For example, if the base URL is https://www.microsoft.com/xml/test.htm and the relative URL is test.xml, the resulting file that will be loaded is https://www.microsoft.com/xml/test.htm.
Note
This example shows how this method is useful when the base URL of an HTML page is known and an XML document relative to that page is to be fetched without doing with any string manipulation. The file name "test.htm" is arbitrary; it has nothing to do with the function of the XML parser.
File URLs have some additional behavior. The base URL file://central/, where central is the name of a server, is not valid. The name of the "share" on that server must also be specified (file://central/public/, for example). Relative file URLs without a base URL load the file from the "current directory" for that process.
Requirements
Header | xmlparser.h |
Windows Mobile | Pocket PC 2000 and later, Smartphone 2002 and later |
See Also
Reference
IXMLParser
IXMLParser::Load
IXMLParser::PushData
IXMLParser::SetInput