Name: revXMLCreateTreeFromFileWithNamespaces

Type: function

Syntax: revXMLCreateTreeFromFileWithNamespaces(<filePath>, <parseBadData>, <createTree>, <sendMessages>)

Summary: Reads an <XML> <file>, optionally creating an <XML> tree and returning XML namespace tags and attributes as part of the tree.

Introduced: 4.5.1

OS: mac,windows,linux,ios,android

Platforms: desktop,server,web,mobile

Security: disk

Example:
revXMLCreateTreeFromFileWithNamespaces("New.xml",false,true,false)

Example:
if revXMLCreateTreeFromFileWithNamespaces(it,true,true,false) then next repeat

Parameters:
filePath: The name and location of a file containing <XML> text.
parseBadData (bool): 
createTree (bool): 
sendMessages (bool): 

Returns:
The <revXMLCreateTreeFromFileWithNamespaces> <function(control_st)> returns a tree ID which can be used to refer to the tree in other <XML library> <command|commands> and <function(glossary)|functions>. The tree ID is always a positive <integer>. (If the <createTree> is false, the <function(control_st)> <return|returns> zero.)
If the function encounters an error while parsing the file, it returns an error message beginning with "xmlerr".

Description:
Use the <revXMLCreateTreeFromFileWithNamespaces> <function> to read the contents of an <XML document> and create an <XML tree (glossary)>from it in memory, XML namespace tags and attributes are included as part of the tree.

Use the <revXMLCreateTreeFromFileWithNamespaces> function to make and XML file into an XML Tree,  ignoring XML Namespace related tags and functions. The <revXMLCreateTreeFromFileWithNamespaces> function returns namespace tags and attributes as part of the tree without doing any processing.

Use the <revXMLCreateTreeFromFileWithNamespaces> function when an application needs the namespace information to perform correctly.

If the <parseBadData> is true, the <revXMLCreateTreeFromFileWithNamespaces> <function> tries to parse <XML> data even if it is not well-formed. Otherwise, the <function> stops executing as soon as it encounters data that is not well-formed <XML>.

If the <createTree> is true, the <function> creates a tree structure in memory. Otherwise, the <function> simply parses the <XML> data without creating an <XML tree>.

If the <sendMessages> is true, the <revXMLStartTree>, <revStartXMLNode>, <revStartXMLData>, <revEndXMLNode>, and <revXMLEndTree> <message|messages> are sent while the <file> is being parsed. Otherwise, these <message|messages> are not sent.

If the <revXMLCreateTreeFromFileWithNamespaces> <function> encounters an error, it <return|returns> an error message starting with "xmlerr".

>*Important:*  The revXMLCreateTreeFromFileWithNamespaces function is part of the <XML library>. To ensure that the <function> works in a <standalone application>, you must include this <Revolution custom library|custom library> when you create your <standalone application|standalone>. In the Inclusions section on the General screen of the <Standalone Application Settings> window, make sure "XML Library" is selected in the list of script libraries.

References: revStartXMLData (message), revStartXMLNode (message), revEndXMLNode (message), revXMLStartTree (message), revXMLEndTree (message), XML library (library), Revolution custom library (library), file (keyword), integer (keyword), return (glossary), XML tree (glossary), Standalone Application Settings (glossary), message (glossary), standalone application (glossary), XML (glossary), XML document (glossary), command (glossary), function (glossary), revXMLValidateDTD (function), revXMLTrees (function), revXMLCreateTreeWithNamespaces (function), revXMLDeleteAllTrees (command), revXMLAppend (command), function (control_st)

Tags: text processing
