ParseXmlFromURL method: XmlDoc class
Syntax
ParseXmlFromURL(path [, DTDValidation])
Where path can have one of the following forms—a string URL, containing the filename and extension:
http://www.example.com/filename.ext
Or an absolute file path, including the filename and extension:
c:\directory\filename.ext
Note:
HTTPS is not a supported protocol for path.
Description
Use the ParseXmlFromURL method to convert the XML file located at path into an XmlDoc object that you can then manipulate using PeopleCode. The XmlDoc object executing the method is populated with the XML string after it's been converted. Any data already existing in the XmlDoc object is overwritten.
Using this method also does basic validation of the XML string, comparing it to the document type declaration (DTD) if the DOCTYPE for the DTD is provided in the XML string.
Note:
PeopleSoft only supports UTF-8 encoding. Therefore, if the input file is encoded, it must be encoded in UTF-8.
Parameters
| Parameter | Description |
|---|---|
|
path |
Specify the URL or file path to the XML that file you want to manipulate. If you specify a string URL, the URL must be contained in quotation marks. Note: HTTPS is not a supported protocol for path. |
|
DTDValidation |
Specify whether to validate a document type definition (DTD.) This parameter takes a Boolean value. If you specify true, the DTD validation occurs if a DTD is provided. If you specify false, and if a DTD is provided, it is ignored and the XML isn't validated against the DTD. The default value for this parameter is false. In the case of application messaging, if a DTD is provided, it's always ignored and the XML isn't validated against the DTD. If the XML cannot be validated against a DTD, an error is thrown saying that there was an XML parse error. |
Returns
A Boolean value: True, the XML file converted successfully and was validated, False otherwise. (If the XML file is not valid, the PeopleCode program terminates.)
Example
The following PeopleCode program loads a file from a file path:
Local XmlDoc &inXMLDoc;
Local boolean &ret;
&inXMLDoc = CreateXmlDoc("");
&ret = &inXMLDoc.ParseXmlFromURL("c:\temp\in.xml");
The following PeopleCode program loads a file from a URL:
Local XmlDoc &inXMLDoc;
Local boolean &ret;
&inXMLDoc = CreateXmlDoc("");
&ret = &inXMLDoc.ParseXmlFromURL("http://www.example.com/xmlfile.xml");
Related Topics