xmlDocumentFromFile()
Opens a file and reads the complete content building the DOM structure in memory.
Synopsis
int xmlDocumentFromFile(string fileName, string &errMsg, int
&errLine, int &errColumn);
Parameters
Parameter | Description |
---|---|
fileName | Absolute path to the file which shall be opened. |
errMsg | Alert message of the failure. |
errLine | Line in the document where the failure occurred. |
errColumn | Column in the document where the failure occurred. |
Return value
Returns a document ID which will be passed in future other XML calls.
If an error occurs, -1 will be returned.
Description
Opens a file and reads the complete content building the DOM structure in memory. Returns a document identifier which will be passed in future other XML calls. The returned ID is valid until a call of xmlCloseDocument().
In case of an error, errMsg, errLine, errColumn contain a reference to the position where the parsing failed.
Example
#uses "CtrlXml"
main()
{
int Id;
string fileName = "c:/XmlTest.xml";
string errMsg;
int errLine, errColumn;
Id = xmlDocumentFromFile(fileName, errMsg, errLine,
errColumn);
DebugN("The ID:", Id);
DebugN("Errors:", errMsg, errLine, errColumn);
}
Assignment
Availability
CTRL. In every script where the "CtrlXml" extension (#uses "CtrlXml") is used.